PowerShell to retrieve and parse RSS news feeds

RSS is a very command news feeds, often I need to retrieve the feeds and load into the relational database. Recently I’ve been using PowerShell to manage schedule jobs on Windows system. I found it’s pretty easy to do RSS feeds in PowerShell. Here is a small sample code to share:

# Program name: Get-RSS.ps1
# Author: Kevin C. L.
#
 $rssUri="https://www.yeektalk.com/feed/"
 Write-Host -ForegroundColor "green" "RSS-Feed source: " $rssUri
 Download RSS feed
 $wsRss = New-Object System.Net.WebClient
 $rssContent = [xml]$wsRss.DownloadString($rssUri)
 Show title
 Write-Host  "RSS Site Title: " $rssContent.rss.channel.title
 Display title and description of entries
 $rssContent.rss.channel.item | Select-Object title, pubDate, description | format-list

Leave a Reply