@csandfeld 2015 - October Scripting Games Puzzle
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 { | |
[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