Download All Sessions in MID Quality

$feedUrl = 'https://channel9.msdn.com/Events/Visual-Studio/Connect-event-2015/RSS'
 
[Environment]::CurrentDirectory=(Get-Location -PSProvider FileSystem).ProviderPath
function Get-Media
{
    [CmdletBinding()]
    param
    (
        [Object]
        $url,
        [Object]
        $title
    )
     
    $u = New-Object System.Uri($url)
    $name = $title
    $extension = [System.IO.Path]::GetExtension($u.Segments[-1])
    $fileName = $name + $extension

    $fileName = $fileName -replace "’", ''
    $fileName = $fileName -replace "\?", ''
    $fileName = $fileName -replace ":", ''
    $fileName = $fileName -replace '/', ''
    $fileName = $fileName -replace ",", ''
    $fileName = $fileName -replace '"', ''

    $fileName
            
    if (Test-Path($fileName)) {
        Write-Host 'Skipping file, already downloaded' -ForegroundColor Yellow
    }
    else
    {
        Invoke-WebRequest $url -OutFile $fileName
    }
}
  
$feed=[xml](New-Object System.Net.WebClient).DownloadString($feedUrl)
 
foreach($i in $feed.rss.channel.item) {
    foreach($m in $i.group){
        foreach($u in $m.content `
                | Where-Object { `
                        $_.url -like '*mid.mp4' `
                     } | Select-Object -Property @{Name='url'; Expression = {$_.url}}, `
                                                 @{Name='title'; Expression = {$i.title}})
        {
            Get-Media -url $u.url -title $u.title
        }             
    }
}

3 responses to Download Microsoft Connect(); // 2015 Sessions Using PowerShell

  1. 

    Excellent. Thanks dude..

    Like

  2. 

    I am getting the following error when attempting to run the script. Any ideas?
    Exception calling “DownloadString” with “1” argument(s): “Too many automatic redirections were attempted.”
    http://bit.ly/1lvPEXr

    Like

Trackbacks and Pingbacks:

  1. Dew Drop – November 19, 2015 (#2135) | Morning Dew - November 19, 2015

    […] Download Microsoft Connect(); // 2015 Sessions Using PowerShell (Alexandre Brisebois) […]

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.