Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@csandfeld 2015 - October Scripting Games Puzzle
function Get-RSSFeed {
[CmdletBinding()]
Param(
[Parameter(
Mandatory = $True
)]
[String[]]
$Uri
)
BEGIN {
$Items = @()
$Select = @{
#'Property' = @('title', @{ l = 'Date' ; e = { Get-Date $_.pubDate } } )
'Property' = @(
@{ l = 'Channel' ; e = { $_.channel.title } },
'title',
'pubDate',
'Date'
)
}
}
PROCESS {
foreach ($feed in $Uri) {
$xml = [xml](Invoke-WebRequest -Uri $feed).Content
$FeedName = $xml.rss.channel.title
foreach ($Item in $xml.rss.channel.item) {
$Properties = [Ordered]@{
'Feed' = $FeedName
'FeedUri' = $feed
'Title' = $Item.title
'Date' = (Get-Date -Date $Item.pubDate)
'Link' = $Item.link
}
$Items += New-Object -TypeName PSObject -Property $Properties
}
}
$Items | Sort-Object -Property Date -Descending
}
}
Get-RSSFeed -Uri http://powershell.org/wp/feed/, http://blogs.technet.com/b/heyscriptingguy/rss.aspx | fl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment