Leo Torres
asked on
Powershell select leaf nodes
I believe I in the right top node. I how do I traverse down to the node I need. Code is attached and a Screen shot of Node I am on and node I want to get to. I want to return the "UTA" for away team.
Add-Type -path C:\pstemp\HtmlAgilityPack\Net40\htmlagilitypack.dll
CLS
$Website = "http://www.nba.com/gameline/20151031/"
$wc = New-Object System.Net.WebClient;
$doc = New-Object HtmlAgilityPack.HtmlDocument
$doc.LoadHtml($wc.DownloadString($Website))
$games = @()
$Allgames = @()
foreach ($node1 in $doc.DocumentNode.SelectNodes("//div[@class='nbaModOuterBox gameModule']"))
{
foreach ($node2 in $node1.DocumentNode.SelectNodes("//div[@class='nbaModTopTeamAw']") )
{
$AwayTeam = $node2.Innertext
Write-Host $AwayTeam
}
}
Hi,
could you please explain in words, which parts of the page you want to capture?
As far as I can see, the gametime is only available on the current day, not in the past.
Thanks.
Rainer
could you please explain in words, which parts of the page you want to capture?
As far as I can see, the gametime is only available on the current day, not in the past.
Thanks.
Rainer
ASKER
Hello Rainer correct. just replace the "/20151031/" at the end of the link to a future date
I need the gametime value and the to teams playing at that time
I need the gametime value and the to teams playing at that time
I'm not clear about the intended output. Can you show a future game result as you expect it to be?
ASKER
sorry for the delayed response. I need the gametime, and each team. That's it 3 itmes.
ASKER
Sample
Gametime AwayTeam Hometeam
7:30PM MIA ORL
This is an example this data may not exists I just created off the top of my head. If you want to test the webpage you have to choose a future date in the link. Games in the past do not have a Gametime value.
Gametime AwayTeam Hometeam
7:30PM MIA ORL
This is an example this data may not exists I just created off the top of my head. If you want to test the webpage you have to choose a future date in the link. Games in the past do not have a Gametime value.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank You!
ASKER
Open in new window