Created
February 9, 2017 14:33
-
-
Save jdhitsolutions/c129c2de124e2a455880391d125eadf2 to your computer and use it in GitHub Desktop.
A PowerShell script to get the RSS feed from Planet PowerShell.
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 4.0 | |
<# | |
get current entries in the PlanetPowerShell RSS feed | |
Because of the way entries are syndicated not every feed item | |
will parse cleanly or with information. | |
#> | |
[cmdletbinding()] | |
Param() | |
Invoke-RestMethod http://www.planetpowershell.com/feed | | |
Select Title, | |
@{Name="Site";Expression = { | |
[regex]$rx = "http[s]?:\/\/.*\.(org|com|net|edu|io)" | |
if ($_.link -is [array]) { | |
#take the first link | |
$url = $_.link[0] | |
} | |
else { | |
$url = $_.link | |
} | |
$rx.Match($url).Value | |
}}, | |
@{Name="Published";Expression = {$_.pubdate -as [datetime]}}, | |
link, | |
@{Name="Author";Expression={$_.creator.'#text'}}, | |
@{Name="Summary";Expression={ | |
#regex to strip off html tags | |
[regex]$rx="<(.|\n)+?>" | |
$rx.replace($_.description,"").Substring(0,255) | |
}} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Running this script should give you output like this: