Skip Ribbon Commands
Skip to main content

Quick Launch

Todd Klindt's home page > Todd Klindt's Office 365 Admin Blog > Posts > PowerShell script to download TechEd NA 2013 slides and recordings
June 10
PowerShell script to download TechEd NA 2013 slides and recordings

I had a blast last week at TechEd but because of scheduling conflicts, and me sleeping in the Resource Center I missed some of the sessions I wanted to see. Fortunately this morning my Twitter and blog feed has been sprouting ways do download the scripts like the dandelions sprout in my yard in the spring. I found one I liked on Github that downloaded all of the videos in MP4 format, but it didn’t download the accompanying PPTX files. I tweaked their script some so it would get the MP4s and the PPTXs. It will also check locally for them before it downloads them, so you can run it more than once. As a speaker, I know I don’t always get my PPTXs turned in like I’m supposed to, so some of those might be popping up over the next few days.

Here’s the script I used:

# Originally published at https://gist.github.com/nzthiago/5736907
# I took that script and added the PPTX pieces, and a few comments
# If you like it, leave me a comment
# If you don't like it, complain to Github. :)

[Environment]::CurrentDirectory=(Get-Location -PSProvider FileSystem).ProviderPath
$rss = (new-object net.webclient)

# Grab the RSS feed for the MP4 downloads
$a = ([xml]$rss.downloadstring("
http://channel9.msdn.com/Events/TechEd/NorthAmerica/2013/RSS/mp4high"))

# Walk through each item in the feed
$a.rss.channel.item | foreach{  
    $code = $_.comments.split("/") | select -last 1      
   
    # Grab the URL for the MP4 file
    $url = New-Object System.Uri($_.enclosure.url) 
   
    # Create the PPTX URL from the MP4 URL
    $urlpptx = ($_.enclosure.url).replace(".mp4",".pptx")
   
    # Create the local file name for the MP4 download
    $file = $code + "-" + $_.creator + "-" + $_.title.Replace(":", "-").Replace("?", "").Replace("/", "-").Replace("<", "") + ".mp4" 
   
    # Create the local file name for the PPTX download
    $filepptx = $code + "-" + $_.creator + "-" + $_.title.Replace(":", "-").Replace("?", "").Replace("/", "-").Replace("<", "") + ".pptx" 
   
    # Make sure the PPTX file doesn't already exist
    if (!(test-path $filepptx))    
    {    
        # Echo out the file that's being downloaded
        $filepptx  
        $wc = (New-Object System.Net.WebClient) 
       
        # Download the PPTX file
        $wc.DownloadFile($urlpptx, $filepptx)
        }
   
    # Make sure the MP4 file doesn't already exist
    if (!(test-path $file))    
    {    
        # Echo out the  file that's being downloaded
        $file

        # Download the MP4 file
        $wc.DownloadFile($url, $file) 
        }    
   }

Sorry for the crappy PowerShell formatting. You can download the full script here. All the usual warnings apply. This script will dull the knives in your kitchen, and leave soap scum in the shower. Be careful when you run that, it downloaded about 65 GB of stuff when I ran it last.

tk

ShortURL: http://www.toddklindt.com/TechEd2013Downloads

Comments

Re: PowerShell script to download TechEd NA 2013 slides and recordings

Good script, I made some changes (added a progress bar and put all the talks into folders:
function DownloadFile($url, $targetFile)

{

   $uri = New-Object "System.Uri" "$url"
   $request = [System.Net.HttpWebRequest]::Create($uri)
   $request.set_Timeout(15000) #15 second timeout
   $response = $request.GetResponse()
   $totalLength = [System.Math]::Floor($response.get_ContentLength()/1024)
   $responseStream = $response.GetResponseStream()
   $targetStream = New-Object -TypeName System.IO.FileStream -ArgumentList $targetFile, Create
   $buffer = new-object byte[] 10KB
   $count = $responseStream.Read($buffer,0,$buffer.length)
   $downloadedBytes = $count

   while ($count -gt 0)

   {
       $targetStream.Write($buffer, 0, $count)
       $count = $responseStream.Read($buffer,0,$buffer.length)
       $downloadedBytes = $downloadedBytes + $count
       Write-Progress -activity "Downloading file '$($url.split('/') | Select -Last 1)'" -status "Downloaded ($([System.Math]::Floor($downloadedBytes/1024))K of $($totalLength)K): " -PercentComplete ((([System.Math]::Floor($downloadedBytes/1024)) / $totalLength)  * 100)
   }

   Write-Progress -activity "Finished downloading file '$($url.split('/') | Select -Last 1)'"
   $targetStream.Flush()
   $targetStream.Close()
   $targetStream.Dispose()
   $responseStream.Dispose()

}


# Originally published at https://gist.github.com/nzthiago/5736907
# I took that script and added the PPTX pieces, and a few comments
# If you like it, leave me a comment
# If you don't like it, complain to Github. :)

[Environment]::CurrentDirectory=(Get-Location -PSProvider FileSystem).ProviderPath
$rss = (new-object net.webclient)

# Grab the RSS feed for the MP4 downloads
#$a = ([xml]$rss.downloadstring("http://channel9.msdn.com/Events/TechEd/NorthAmerica/2013/RSS/mp4high"))
$a = ([xml]$rss.downloadstring("http://channel9.msdn.com/Events/TechEd/NorthAmerica/2013/RSS/mp4high?sort=sequential&direction=desc&term=&r=SharePoint+%26+Enterprise+Social"))

# Walk through each item in the feed
$a.rss.channel.item | foreach{ 
    $code = $_.comments.split("/") | select -last 1     
   
    # Grab the URL for the MP4 file
    $url = New-Object System.Uri($_.enclosure.url)
    # Create the PPTX URL from the MP4 URL
    $urlpptx = ($_.enclosure.url).replace(".mp4",".pptx")
   
    #Create the local folder
    $folder = $code + " - " + $_.title.Replace(":", "-").Replace("?", "").Replace("/", "-").Replace("<", "")
if (!(test-path $folder))   
    {
mkdir $folder | out-null
}

    # Create the local file name for the MP4 download
    $file = $_.creator + " - " + $_.title.Replace(":", "-").Replace("?", "").Replace("/", "-").Replace("<", "") + ".mp4"
   
    # Create the local file name for the PPTX download
    $filepptx = $_.creator + " - " + $_.title.Replace(":", "-").Replace("?", "").Replace("/", "-").Replace("<", "") + ".pptx"
   
    # Make sure the PPTX file doesn't already exist
    if (!(test-path $folder\$filepptx))   
    {   
        # Echo out the file that's being downloaded
        $filepptx 
        #$wc = (New-Object System.Net.WebClient)
       
        # Download the PPTX file
        #$wc.DownloadFile($urlpptx, $filepptx)
downloadFile $urlpptx $filepptx
        mv $filepptx $folder
        }
    # Make sure the MP4 file doesn't already exist
    if (!(test-path $folder\$file))   
    {   
   return
        # Echo out the  file that's being downloaded
        $file

        # Download the MP4 file
        #$wc.DownloadFile($url, $file)
downloadFile $url $file
        mv $file $folder
        }   
   }
 on 6/11/2013 6:04 AM

Re: PowerShell script to download TechEd NA 2013 slides and recordings

Ah - and I added a filter so it only downloads SharePoint content - of course one can also use the original url.
 on 6/11/2013 6:05 AM

Re: PowerShell script to download TechEd NA 2013 slides and recordings

Cool script. I'll leave it up for other people to enjoy.

tk
Todd O. KlindtNo presence information on 6/11/2013 4:28 PM

Re: PowerShell script to download TechEd NA 2013 slides and recordings

Unfortunately, this is not ALL of the sessions.  The RSS feed is missing large numbers of the sessions.

Do we know if the RSS feed will be updated anymore, or do we have to find another way to get the missing ones?

(eg:  it only downloaded 1 of the ATC group of sessions)
 on 6/12/2013 2:15 PM

Few Questions

Went to New Orleans and did your PreCourse and bought your book - Excellent.  Been setting up my test farm and made a few notes.  Page 63 Step2 - the shell has to be run as administrator.
Got the farm running and now want to add a WFE.  Just follow "Adding More Servers to the Farm"? on page 65.  What I wanted was a SQL, APP, and WFE in the end.  Will the APP server that I loaded SP on first always server content?
 on 7/1/2013 8:14 AM

Add Comment

Items on this list require content approval. Your submission will not appear in public views until approved by someone with proper rights. More information on content approval.

Title


Body *


Today's date *

Select a date from the calendar.
Please enter today's date so I know you are a real person

Twitter


Want a message when I reply to your comment? Put your Twitter handle here.

Attachments

 

 SysKit