<#
.SYNOPSIS
<A brief description of the script>
.DESCRIPTION
<A detailed description of the script>
.PARAMETER <paramName>
<Description of script parameter>
.EXAMPLE
<An example of using the script>
#>
CLS
# HAP available at http://htmlagilitypack.codeplex.com/
# (originally http://www.nuget.org/packages/HtmlAgilityPack)
Add-Type -path C:\pstemp\HtmlAgilityPack\Net40\htmlagilitypack.dll
#Add-Type -path C:\pstemp\HtmlAgilityPack\Net20\htmlagilitypack.dll
$Website = 'http://espn.go.com/nfl/schedule/_/year/2012'
$wc = New-Object System.Net.WebClient;
$doc = New-Object HtmlAgilityPack.HtmlDocument
$doc.LoadHtml($wc.DownloadString($Website))
$games = @()
$Allgames = @()
foreach ($day in $doc.DocumentNode.SelectNodes('//table["tablehead"]'))
{
$rows = $day.SelectNodes('tr')
$Week = $rows[0].InnerText -replace "back to top »", ""<# [DateTime] #>
foreach ($row in $rows[2..$rows.Count])
{
$col = $row.Element('td');
$time = $col.InnerText
# $col = $col.NextSibling;
$teams = $col.InnerText[2] #| Select -ExpandProperty InnerText) #-join " at "
$games += New-Object PsObject -Property @{Week = $Week; Day = $time; Teams = $teams}
}
}
$Allgames += $games
$Allgames | select Week,Day,@{Name='Games';Expression={[string]$_.Teams}} | Format-Table -AutoSize
ASKER
ASKER
The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.
TRUSTED BY
$Allgames += $games
$Allgames | select Week,Day | fl
gives the output of:
Week : Week 17
Day : Denver 38, Kansas City 3
Week : Week 17
Day : Washington 28, Dallas 18