Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Download Visual Studio 2017 Launch Series
$downloadDir = "~\Desktop\VS2017Launch"
mkdir $downloadDir
Set-Location $downloadDir
[Environment]::CurrentDirectory=(Get-Location -PSProvider FileSystem).ProviderPath
$r = ([xml](new-object net.webclient).downloadstring("https://channel9.msdn.com/Events/Visual-Studio/Visual-Studio-2017-Launch/RSS/mp4high"))
$r.rss.channel.item | ForEach-Object{
Set-Location $downloadDir
$url = New-Object System.Uri($_.enclosure.url)
$title = $_.title.trim().Replace(":", "-").Replace("?", "").Replace("/", "-").Replace("<", "").Replace("|", "").Replace('"',"").Replace("*","")
$videodir = $title
$file = $title + " - " + $_.creator
$file = $file.substring(0, [System.Math]::Min(120, $file.Length))
$file = $file.trim()
if (!(test-path "$downloadDir\$videodir\$file.txt")) {
mkdir $videodir
Set-Location "$downloadDir\$videodir\"
$OutFile = New-Item -type file "$file.txt" -Force
$Content = ""
$Content = $_.title.trim() + "`r`n" + $_.summary.trim()
add-content $OutFile $Content
}
if (!(test-path "$downloadDir\$videodir\$file.mp4")) {
"Downloading: " + $file + ".mp4"
$wc = (New-Object System.Net.WebClient)
$wc.DownloadFile($url, "$file.mp4")
Move-Item "$downloadDir\$file.mp4" "$downloadDir\$videodir\"
}
}
$s = ([xml](new-object net.webclient).downloadstring("https://channel9.msdn.com/Events/Visual-Studio/Visual-Studio-2017-Launch/RSS/slides"))
$s.rss.channel.item | ForEach-Object{
Set-Location $downloadDir
$url = New-Object System.Uri($_.enclosure.url)
$title = $_.title.Replace(":", "-").Replace("?", "").Replace("/", "-").Replace("<", "").Replace("|", "").Replace('"',"").Replace("*","")
$videodir = $title
$file = $title + " - " + $_.creator
$file = $file.substring(0, [System.Math]::Min(120, $file.Length))
$file = $file.trim()
if (!(test-path "$downloadDir\$videodir\$file.pptx")) {
"Downloading: " + $file + ".pptx"
$wc = (New-Object System.Net.WebClient)
$wc.DownloadFile($url, "$file.pptx")
Move-Item "$downloadDir\$file.pptx" "$downloadDir\$videodir\"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment