Skip to content

Instantly share code, notes, and snippets.

@jcmm33
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jcmm33/d488973f54bbfa4a7daf to your computer and use it in GitHub Desktop.
Save jcmm33/d488973f54bbfa4a7daf to your computer and use it in GitHub Desktop.
Build 2015 Video Downloader
# Insert code here to change to directory where you wish to download videos if you so desire
[Environment]::CurrentDirectory=(Get-Location -PSProvider FileSystem).ProviderPath
$a = ([xml](new-object net.webclient).downloadstring("http://s.ch9.ms/Events/dotnetConf/2015/RSS/mp4high"))
$a.rss.channel.item | foreach{
$url = New-Object System.Uri($_.enclosure.url)
$file = "- " + $_.creator + " - " + $_.title.Replace(":", "-").Replace("?", "").Replace("/", "-").Replace("<", "").Replace("|", "").Replace('"',"").Replace("*","")
$file = $file.substring(0, [System.Math]::Min(120, $file.Length))
$file = $file.trim()
$OutFile = New-Item -type file "$file.txt" -Force
$Content = ""
$Content = $_.title.trim() + "`r`n" + $_.summary.trim()
add-content $OutFile $Content
$file = $file+".mp4"
"Downloading: " + $file
if (!(test-path $file))
{
$wc = (New-Object System.Net.WebClient)
$wc.DownloadFile($url, $file)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment