Skip to content

Instantly share code, notes, and snippets.

@jdhitsolutions
Created February 9, 2017 14:33
Show Gist options
  • Save jdhitsolutions/c129c2de124e2a455880391d125eadf2 to your computer and use it in GitHub Desktop.
Save jdhitsolutions/c129c2de124e2a455880391d125eadf2 to your computer and use it in GitHub Desktop.
A PowerShell script to get the RSS feed from Planet PowerShell.
#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)
}}
@jdhitsolutions
Copy link
Author

Running this script should give you output like this:

title     : Part V – Introducing the FoxDeploy DSC Designer
Site      : https://foxdeploy.com
Published : 9/20/2016 9:25:40 AM
link      : https://foxdeploy.com/2016/09/20/part-v-introducing-the-foxdeploy-dsc-designer/
Author    : FoxDeploy
Summary   : This post is part of the Learning DSC Series here on FoxDeploy.com. To see the other articles, click the
            banner above! For years now, people have been asking for a DSC GUItool. Most prominently me, I&#8217;ve
            been asking for it&#8230;  Continue reading &

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment