It’s very easy to read RSS feeds via Powershell. You just need to use Invoke-WebRequest and convert the output to XML:
$chfeed = [xml](Invoke-WebRequest "https://arminreiter.com/feed/") $chfeed.rss.channel.item | Select-Object @{Name="Id";Expression={$_."post-id".InnerText}}, title, link, pubDate
As we can see, it returns only 10 entries. So…
How to get older RSS feeds via Powershell?
It’s not so easy because it depends on the RSS type – ATOM e.g. works with “?page=2” … Other feed types do not support paging. If it’s an RSS 2.0 feed, then you can simply add “?paged=2” to the URL and you’ll get the second page.
Let’s use this information to create a Powershell script that returns all entries of a RSS feed:
$i = 1 while($true) { try { $chfeed = [xml](Invoke-WebRequest "https://arminreiter.com/feed/?paged=$i") } catch { break; } $chfeed.rss.channel.item | Select-Object @{Name="Id";Expression={$_."post-id".InnerText}}, title, link, pubDate $i++ }
One response
Just used this today. Thank you! Powershell scripting guy blog didn’t cover what you did. Casting as [xml] did the trick along with a little navigation prompting.