Created
July 1, 2013 11:05
-
-
Save nzthiago/5899989 to your computer and use it in GitHub Desktop.
Download all BUILD 2013 sessions and powerpoint slides
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on script from http://www.toddklindt.com/Scripts/downloadmp4-pptx.ps1.txt | |
[Environment]::CurrentDirectory=(Get-Location -PSProvider FileSystem).ProviderPath | |
$rss = (new-object net.webclient) | |
# Grab the RSS feed for the MP4 downloads | |
$a = ([xml]$rss.downloadstring("http://channel9.msdn.com/Events/Build/2013/RSS/mp4high")) | |
# Walk through each item in the feed | |
$a.rss.channel.item | foreach{ | |
$code = $_.comments.split("/") | select -last 1 | |
# Grab the URL for the MP4 file | |
$url = New-Object System.Uri($_.enclosure.url) | |
# Create the PPTX URL from the MP4 URL | |
$urlpptx = ($_.enclosure.url).replace(".mp4",".pptx") | |
# Create the local file name for the MP4 download | |
$file = $code + "-" + $_.creator + "-" + $_.title.Replace(":", "-").Replace("?", "").Replace("/", "-").Replace("<", "") + ".mp4" | |
# Create the local file name for the PPTX download | |
$filepptx = $code + "-" + $_.creator + "-" + $_.title.Replace(":", "-").Replace("?", "").Replace("/", "-").Replace("<", "") + ".pptx" | |
# Make sure the PPTX file doesn't already exist | |
if (!(test-path $filepptx)) | |
{ | |
# Echo out the file that's being downloaded | |
$filepptx | |
$wc = (New-Object System.Net.WebClient) | |
# Download the PPTX file | |
$wc.DownloadFile($urlpptx, $filepptx) | |
} | |
# Make sure the MP4 file doesn't already exist | |
if (!(test-path $file)) | |
{ | |
# Echo out the file that's being downloaded | |
$file | |
# Download the MP4 file | |
$wc.DownloadFile($url, $file) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@nzthiago The script doesn't work flawlessly. it seems, it blocks process if file doesn't exist. I tried skipping 404's with try catch block but subsequent downloads halt. Hard time to debug the problem as well.