Skip to content

Instantly share code, notes, and snippets.

@SitrucHtims
Last active October 4, 2015 19:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SitrucHtims/0087700f88f003ec5440 to your computer and use it in GitHub Desktop.
Save SitrucHtims/0087700f88f003ec5440 to your computer and use it in GitHub Desktop.
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