Download All Sessions in SD Quality

$feedUrl = 'http://s.ch9.ms/Events/Ignite/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
        }             
    }
}

# Find and Download Keynotes

foreach($i in $feed.rss.channel.item) {
    foreach($m in $i.group){
        foreach($u in $m.content `
                | Where-Object { `
                        $_.url -like '*KEY0*' `
                        -and $_.type -eq 'video/mp4' `
                       
                     } `
                     | Select-Object -Unique `
                     | Select-Object -Property @{Name='url'; Expression = {$_.url}}, `
                                                 @{Name='title'; Expression = {$i.title}})
        {
            Get-Media -url $u.url -title $u.title
        }             
    }
}

Download Sessions Based on Filters in SD Quality

$feedUrl = 'http://s.ch9.ms/Events/Ignite/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' `

                        # Filter by keywords
                        -and ($i.description.'#cdata-section' -like '*azure*' `
                              -or $i.title -like '*azure*' `

                         ) `
                     } | Select-Object -Property @{Name='url'; Expression = {$_.url}}, `
                                                 @{Name='title'; Expression = {$i.title}})
        {
            #Get-Media -url $u.url -title $u.title
            Write-Output $u.title
        }
    }
}
 
# Find and Download Keynotes
 
foreach($i in $feed.rss.channel.item) {
    foreach($m in $i.group){
        foreach($u in $m.content `
                | Where-Object { `
                        $_.url -like '*KEY0*' `
                        -and $_.type -eq 'video/mp4' `                        
                     } `
                     | Select-Object -Unique `
                     | Select-Object -Property @{Name='url'; Expression = {$_.url}}, `
                                                 @{Name='title'; Expression = {$i.title}})
        {
            Write-Output $u.title
            #Get-Media -url $u.url -title $u.title
        }             
    }
}

Trackbacks and Pingbacks:

  1. Dew Drop – May 5, 2015 (#2007) | Morning Dew - May 5, 2015

    […] #Build 2015 Sessions Using PowerShell and Download Microsoft Ignite 2015 Sessions Using PowerShell (Alexandre […]

    Like

  2. Download Channel 9 Series using PowerShell « Alexandre Brisebois ☁ - May 5, 2015

    […] learning season again, and I’m gearing up for lots of Azure this year. Between Build, Ignite, the Microsoft Virtual Academy and the endless stream of content on Channel 9, it’s easy to […]

    Like

  3. SQLvNext–SQL Server 2016 [Parte 1] | Luan.Moreno a.k.a [SQL.Soul] - May 10, 2015

    […] Para quem perdeu o evento ou não sabia do mesmo, TODAS as sessões foram gravadas e disponibilizadas gratuitas para o público, veja todas as sessões aqui – https://channel9.msdn.com/Events/Ignite/2015 e boa sorte, aqui tem muitas horas de estudo para quem tiver interesse. Além disso foi disponibilizado um script em PowerShell para o download de todas as sessões do Ignite automaticamente – https://alexandrebrisebois.wordpress.com/2015/05/04/download-microsoft-ignite-2015-sessions-using-po…  […]

    Like

Leave a comment

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