Last active
October 4, 2015 19:58
-
-
Save SitrucHtims/0087700f88f003ec5440 to your computer and use it in GitHub Desktop.
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
function Get-RSSFeed { | |
<# | |
.SYNOPSIS | |
Reads RSS feeds from supplied URI\s and outputs the Title, Link and Description properties | |
.PARAMETER URI | |
Parameter supports one or more URIs representing RSS feeds | |
.EXAMPLE | |
Get-RSSFeed -uri "http://rss.msn.com/", "http://www.npr.org/rss/rss.php?id=1019" | Out-GridView | |
Pulls the RSS feed from both MSN.COM and NPR.org, and displays the article's Title, Description and Link in a grid view. | |
.EXAMPLE | |
"http://rss.msn.com/", "http://www.npr.org/rss/rss.php?id=1019" | Get-RSSFeed | Export-CSV RSSFeeds.csv -NoTypeInformation | |
Pulls the RSS feed from both MSN.COM and NPR.org using pipeline input, and displays the article's Title, Description and Link to a csv file. | |
#> | |
[CmdLetBinding()] | |
Param ( | |
[Parameter(Mandatory=$True, ValueFromPipeline=$True)] | |
[string[]]$uri | |
)#param | |
Begin{}#begin | |
Process { | |
ForEach ($target in $uri) { | |
$Content = [xml](Invoke-WebRequest -Uri $target -ContentType "text/xml") | |
$content.rss.channel.ChildNodes | Where-Object {$_.title -ne $null} | Select-Object Title, @{Label = 'Description'; Expression = {$_.Description.ToString()}}, Link | |
}#foreach | |
}#process | |
End{}#end | |
}#function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment