Created
May 28, 2014 12:32
-
-
Save marcelodeaguiar/857f35114b15f4015ff9 to your computer and use it in GitHub Desktop.
Download channel9 video/audio feeds (proxy supported)
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
Function Get-ProxyWebClient { | |
$webclient = New-Object System.Net.WebClient | |
$proxy = New-Object System.Net.WebProxy($global:ProxyUrl, $global:ProxyPort) | |
$proxy.Credentials = (Get-Credential).GetNetworkCredential() | |
$webclient.Proxy = $proxy | |
return $webclient | |
} | |
Function Channel9Downloader( [string]$feed, [string]$destination ) { | |
# $feed = "http://channel9.msdn.com/Shows/Azure-Friday/feed/mp4high" | |
# $destination = "AzureFriday" | |
mkdir "~\Desktop\${destination}" | |
cd "~\Desktop\${destination}" | |
$w = Get-ProxyWebClient | |
$a = ([xml]($w).downloadstring($feed)) | |
$a.rss.channel.item | foreach{ | |
$url = New-Object System.Uri($_.enclosure.url) | |
$file = $url.Segments[-1] | |
if (!(test-path $file)) | |
{ | |
Start-BitsTransfer -Source $url -Destination $file -Asynchronous | |
} | |
} | |
Start-Job { | |
While ((Get-BitsTransfer).JobState -contains 'Transferring') { | |
Get-BitsTransfer | Where-Object { $_.JobState -eq 'Transferred' } | Foreach { Complete-BitsTransfer -BitsJob $_ } | |
Start-Sleep 5 | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment