Download all Microsoft #Build2016 conference videos and slides

For whom missed the great conference of Microsoft Build 2016, here you are the chance to download all the conference without following each link or running out of time!

I have re-developed a PowerShell script to do so, thanks to Vlad Catrinescu whom first made a script for downloading SharePoint conference videos (https://absolute-sharepoint.com/2014/03/ultimate-script-download-sharepoint-conference-2014-videos-slides.html)

You can save the following code as (Build2016.PS1) file and then execute it with PS normally, if PowerShell refused to execute it You just need to change theExecution policy on your computer using a simple Powershell command.

Set-ExecutionPolicy RemoteSigned

This will allow you to run scripts that have been written by “a trusted publisher” (Microsoft determines who is trusted and who isn’t).

Here you are the code:

# Script: DownloadMSBuild2016.ps1
# Version: 1.0 - 2016-04-02
# Author:Hossam kamal (Sr. SharePoint Developer, blog: https://sharepointhero.wordpress.com/)
# Originally published as a SharePoint Conf script by: Vlad Catrinescu (http://absolute-sharepoint.com/2014/03/ultimate-script-download-sharepoint-conference-2014-videos-slides.html)
# I Customized it for Microsoft Build 2016 Conference



Write-Host "###############################################################################################"  -ForegroundColor Yellow
Write-Host "                                                                                               "  -ForegroundColor Yellow
Write-Host "                     Download Microsoft Build 2016 Videos and PPTX                            "  -ForegroundColor Green
Write-Host "                by Hossam kamal (Sr. SharePoint Developer, blog: https://sharepointhero.wordpress.com/)                    "  
Write-Host "                                                                                               "  -ForegroundColor Yellow
Write-Host "         Based on the SharePoint Conference download script by Vlad Catrinescu                 "
Write-Host "                                                                                               "  -ForegroundColor Yellow
Write-Host "###############################################################################################"  -ForegroundColor Yellow

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

# Grab the RSS feed for the MP4 Mobile quality downloads
# Microsoft Build  Conference 2016 Videos and Slides
$a = ([xml]$rss.downloadstring("https://s.ch9.ms/Events/Build/2016/RSS/mp4")) 
$b = ([xml]$rss.downloadstring("https://s.ch9.ms/Events/Build/2016/RSS/slides")) 

#High quality for the videos or if you want mp3 replace the bellow links with the upper
# $a = ([xml]$rss.downloadstring("https://s.ch9.ms/Events/Build/2016/RSS/mp4high")) 
#$a = ([xml]$rss.downloadstring("https://s.ch9.ms/Events/Build/2016/RSS/mp3")) 


$downloadlocation = "C:\Build2016"

	if (-not (Test-Path $downloadlocation)) { 
		Write-Host "Folder $fpath dosen't exist. Creating it..."  
		New-Item $downloadlocation -type directory 
	}
set-location $downloadlocation

#Download all the slides	
$b.rss.channel.item | foreach{   
	$code = $_.comments.split("/") | select -last 1	   
	
	# Grab the URL for the PPTX file
	$urlpptx = New-Object System.Uri($_.enclosure.url)  
    $filepptx = $code + "-" + $_.creator + " - " + $_.title.Replace(":", "-").Replace("?", "").Replace("/", "-").Replace("<", "").Replace("|", "").Replace('"',"").Replace("*","")
	$filepptx = $filepptx.substring(0, [System.Math]::Min(120, $filepptx.Length))
	$filepptx = $filepptx.trim()
	$filepptx = $filepptx + ".pptx" 
	if ($code -ne "")
	{
		 $folder = $code + " - " + $_.title.Replace(":", "-").Replace("?", "").Replace("/", "-").Replace("<", "").Replace("|", "").Replace('"',"").Replace("*","")
		 $folder = $folder.substring(0, [System.Math]::Min(100, $folder.Length))
		 $folder = $folder.trim()
	}
    if ($folder.EndsWith("."))
         {
            $folder = $folder.substring(0, ($folder.Length) - 1).trim()
         }

	else
	{
		$folder = "NoCodeSessions"
	}
	
	if (-not (Test-Path $folder)) { 
		Write-Host "Folder $folder dosen't exist. Creating it..."  
		New-Item $folder -type directory 
	}
	
	#text description from session 
	$OutFile = New-Item -type file "$($downloadlocation)\$($Folder)\$($Code.trim()).txt" -Force  
    $Category = "" ; $Content = ""
    $_.category | foreach {$Category += $_ + ","}
    $Content = $_.title.trim() + "`r`n" + $_.creator + "`r`n" + $_.summary.trim() + "`r`n" + "`r`n" + $Category.Substring(0,$Category.Length -1)
   add-content $OutFile $Content

	# Make sure the PowerPoint file doesn't already exist
	if (!(test-path "$downloadlocation\$folder\$filepptx"))     
	{ 	
		# Echo out the  file that's being downloaded
		$filepptx
		$wc = (New-Object System.Net.WebClient)  

		# Download the MP4 file
		$wc.DownloadFile($urlpptx, "$downloadlocation\$filepptx")
		mv $filepptx $folder 

	}
	}

#download all mp4 mobile quality only
# 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 local file name for the MP4 download
	$file = $code + "-" + $_.creator + "-" + $_.title.Replace(":", "-").Replace("?", "").Replace("/", "-").Replace("<", "").Replace("|", "").Replace('"',"").Replace("*","")
	$file = $file.substring(0, [System.Math]::Min(120, $file.Length))
	$file = $file.trim()
	$file = $file + ".mp4"  
	
	if ($code -ne "")
	{
		 $folder = $code + " - " + $_.title.Replace(":", "-").Replace("?", "").Replace("/", "-").Replace("<", "").Replace("|", "").Replace('"',"").Replace("*","")
		 $folder = $folder.substring(0, [System.Math]::Min(100, $folder.Length))
		 $folder = $folder.trim()
	}
    if ($folder.EndsWith("."))
         {
            $folder = $folder.substring(0, ($folder.Length) - 1).trim()
         }
	else
	{
		$folder = "NoCodeSessions"
	}
	
	# Make sure the MP4 file doesn't already exist

	if (!(test-path "$folder\$file"))     
	{ 	
		# Echo out the  file that's being downloaded
		$file
		$wc = (New-Object System.Net.WebClient)  

		# Download the MP4 file
		$wc.DownloadFile($url, "$downloadlocation\$file")
		mv $file $folder
	}
	
		
	}

If you want a downloaded copy of .PS1 file you can download it from here:

https://www.dropbox.com/s/whazl6x0nncr8yw/MSBuild2016VideoAndSlides.ps1?dl=0

Enjoy J.

Advertisements

About Hossam Kamal

Hossam Kamal Senior SharePoint Developer with high development skills in C#, ASP.NET, SharePoint Server Technologies, jQuery, CSS, XML, O.O.D, SSRS and MS.SQL Server.
This entry was posted in SharePoint General. Bookmark the permalink.

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 )

Google+ photo

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

Connecting to %s