Last active
August 29, 2015 14:20
-
-
Save jcmm33/d488973f54bbfa4a7daf to your computer and use it in GitHub Desktop.
Build 2015 Video Downloader
This file contains 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
# 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