Retrieve Information about your Favorite Podcast with PowerShell
This past weekend, I attended the 2017 Atlanta MVP Community Connection. While there, I met fellow Microsoft MVP Allen Underwood who is one of the co-host of the {CodingBlocks}.NET podcast. I listened to their podcast on my trip back home from Atlanta and later discovered that their podcast has an RSS feed for episodes.
A simple PowerShell one-liner can be used to retrieve information about each episode of their podcast:
1Invoke-RestMethod -Uri http://www.codingblocks.net/podcast-feed.xml |
2Select-Object -Property title, @{label='date';expression={($_.PubDate -as [datetime]).ToShortDateString()}}, link |
3Out-GridView -Title 'Podcast Episodes' -OutputMode Multiple |
4ForEach-Object {
5 Start-Process -FilePath $_.link
6}
Keep in mind that a PowerShell one-liner is one continuous pipeline and not necessarily a command that’s on one physical line. Not all commands that are on one physical line are one-liners.
The code shown in the previous example requires PowerShell version 3.0 or higher. It returns a list of all of their podcast episodes:
I've gone ahead and selected the episodes I want to listen to as shown in blue in the previous example. Click OK and those episodes are automatically opened in your default web browser:
Anytime you're going to be opening a web browser from PowerShell, I recommend running PowerShell non-elevated otherwise you're bypassing UAC (User Access Control) and asking for drive by malware (any application that's run from an elevated PowerShell session also runs elevated).
µ