Created
October 11, 2015 10:03
-
-
Save bundyfx/1d41c8c95898d6cdc158 to your computer and use it in GitHub Desktop.
October 2015 Scripting Games (NBA RSS)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Requires -Version 3.0 | |
<# | |
.Synopsis | |
Get the latest updates on your favourite NBA teams! | |
.EXAMPLE | |
Get-RSSFeed -Team Lakers | |
.EXAMPLE | |
Get-RSSFeed Spurs | |
.NOTES | |
Why not combine two of my favourite things! PowerShell/NBA | |
#> | |
Function Get-RSSFeed { | |
Param | |
( | |
[Parameter(Mandatory=$true, | |
ValueFromPipeline=$true, | |
ValueFromPipelineByPropertyName=$true, | |
Position=0)] | |
[ValidateNotNullOrEmpty()] | |
[ValidateSet( | |
"Lakers", | |
"Bucks", | |
"Bulls", | |
"Spurs", | |
"Celtics", | |
"Clippers", | |
"Grizzlies", | |
"Hawks", | |
"Heat", | |
"Hornets", | |
"Jazz", | |
"Kings", | |
"Knicks", | |
"Magic", | |
"Mavericks", | |
"Nets", | |
"Nuggets", | |
"Pacers", | |
"Pelicans", | |
"Pistons", | |
"Raptors", | |
"Rockets", | |
"Sixers", | |
"Suns", | |
"Thunder", | |
"Blazers", | |
"Timberwolves", | |
"Warriors", | |
"Wizards", | |
"Cavaliers" )] | |
$Team | |
) | |
BEGIN { | |
} | |
PROCESS{ | |
[xml]$x = Invoke-WebRequest "http://www.nba.com/$team/rss.xml" -DisableKeepAlive | |
$x.rss.channel.item.where({$_.link -notmatch 'espanol' -and $_.link -notmatch 'chinese'}) | Select Title,Link | Format-Table | |
} | |
END{ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment