My experience at Microsoft Containers OpenHack featuring Kubernetes challenges.Azure Building Blocks – The Forgotten IaC Tool.N2WS Backup & Recovery v3.0 – A big step forward.Hub and Spoke network topology in Azure.OpenSource Blogging with Jekyll GitHub VSCode Part2.Search our blog Search Blog Post Category Filter Blog Post Category Filter Recent Blog Posts Maybe once I’ve watched these 25 I’ll go back and modify the script to grab the rest… To fetch the next batch of 25 items the RSS feed accepts a ?page=n querystring parameter, so I could add a loop that increments a page counter until the feed returns no items. However, there’s one small glitch – the RSS feed only returns the most recent 25 videos. Iwr -Uri $_.link -OutFile (join-path "D:\Videos\" $_.name) ` From these, I’ll extract the video link and create my filename by removing non-alphanumeric characters from the title. PS> Get-Alias -Definition Invoke-RestMethod | select NameĪnd there is, the not entirely unguessable irm, which downloads the RSS and returns it as a nicely formatted array of XmlElement objects. Next, because this script is going to be a pithy one-liner, I want to find whether there’s a shorthand alias for Invoke-RestMethod.
That should make it easier later to extract the video title and download link from the XML. That’ll do nicely, in fact there’s two almost identical cmdlets to choose from, but I’ll go with Invoke-RestMethod because, according to the documentation, it automatically deserialises XML response content into objects. PS> Get-Help * -Parameter Uri | select Name There must be a cmdlet somewhere that takes a Uri parameter to download content from the web.
The first challenge, I’ve no idea how to download a file over HTTP in PowerShell. Now I’ve got all the data I need, it’s time to start writing some PowerShell, so I’ll fire up the PowerShell ISE and create a new script file. Here’s what the the RSS XML looks like with extraneous bits removed.
I’ve picked the High Quality MP4 HD feed which has all the information I need, video titles and download links. Far better to use one of the many conveniently available RSS feeds. I could scrape and shred this data, from either the or Channel 9 websites, using an HTML parser like Html Agility Pack or CsQuery. It’s great, and soon you’ll be able to watch it offline from the comfort of your own mobile device.įirst, I’ll need to get a catalogue of all the video titles and their corresponding download links. If you’re not familiar with this fantastic series, Scott Hanselman talks to the actual engineers who build Microsoft Azure to discuss cloud development in small bite-sized episodes. As it’s Friday, I’ve set myself the challenge of downloading all the Azure Friday videos from the Channel 9 website with a single line of PowerShell.