Skip to content

Instantly share code, notes, and snippets.

@erichexter
Last active March 31, 2016 14:12
Show Gist options
  • Select an option

  • Save erichexter/c22556f4b9f17ee72f7ff8695249fe81 to your computer and use it in GitHub Desktop.

Select an option

Save erichexter/c22556f4b9f17ee72f7ff8695249fe81 to your computer and use it in GitHub Desktop.
[Environment]::CurrentDirectory=(Get-Location -PSProvider FileSystem).ProviderPath
$rss = (new-object net.webclient)
#Set the username for windows auth proxy
$rss.proxy.credentials=[system.net.credentialcache]::defaultnetworkcredentials
$a = ([xml]$rss.downloadstring("https://s.ch9.ms/Events/Build/2016/rss?media=True&tag[0]=.net&tag[1]=application-insights&tag[2]=asp.net&tag[3]=azure&tag[4]=csharp&tag[5]=cordova&tag[6]=data&tag[7]=devops&tag[8]=diagnostics&tag[9]=internet-of-things&tag[10]=javascript&tag[11]=machine-learning&tag[12]=managed-languages&tag[13]=node.js&tag[14]=open-source&tag[15]=security&tag[16]=testing&tag[17]=typescript&tag[18]=visual-studio&tag[19]=visual-studio-code&tag[20]=web-platform"))
$a.rss.channel.item | foreach{
try{
$urlstring=$_."group"."content" | where-object type -eq "video/mp4" | select -ExpandProperty url | where {$_ -notlike "*_mid.mp4"} | select-object -first 1
$url = New-Object System.Uri($urlstring)
$file = $_.creator + "-" + $_.title.Replace(":", "-").Replace("?", "").Replace("/", "-") + ".mp4"
if (!(test-path $file))
{
$wc = (New-Object System.Net.WebClient)
#Set the username for windows auth proxy
$wc.proxy.credentials=[system.net.credentialcache]::defaultnetworkcredentials
$wc.DownloadFile($url, $file)
}
}catch{}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment