Scott Hanselman

How to download over 80 free 101-level C#, .NET, and ASP.NET for beginners videos for offline viewing

September 26, '19 Comments [5] Posted in DotNetCore | Learning .NET
Sponsored By

Earlier this week I announced over 80 new free videos in our .NET Core 3.0 launch video series - Announcing free C#, .NET, and ASP.NET for beginners video courses and tutorials

Three questions came up consistently:

  • My work or country blocks YouTube! What about me?
  • How can I download these and watch them offline?
  • I have very low bandwidth. Can I get smaller versions I can download over 3G/4G?

Here's some answers for you!

My work or country blocks YouTube! What about me?

First, we have updated http://dot.net/videos to include links to BOTH YouTube *and* to the same videos hosted on Microsoft's Channel 9, which shouldn't be blocked by you country or company!

How can I download these and watch them offline?

Good question! Here's how to download a whole series with PowerShell! Let's say I want to download "C# 101."

First, head over to https://dot.net/videos.

C# 101 videos

Second, click "Watch on Channel 9" there at the bottom of the series you want, in my case, C# 101.

Note that there's a link there in the corner that says "RSS" - that's Really Simple Syndication!

RSS Videos for Channel 9 Videos

Right click on the one you want, for example MP4 Low for people on low bandwidth connections! (Question #3 gets answered too, two for one!), and say "Copy Link Address." Now that link is in your clipboard!

Next, I made a little PowerShell script and put it here in a Gist. If you want, you can right click on this link here and Save Link As and name it something like DownloadVideos.ps1. Maybe save it in C:\temp or c:\users\YOURNAME\Desktop\DotNetVideos. Whatever makes you happy. Make sure you saved it with a *.ps1 extension.

Finally, open up the PS1 file in a text editor and check lines 2 and 3. Put in a path that's correct for YOUR computer, again, like C:\temp, or your downloads folder.

#CHECK THE PATH ON LINE 2 and the FEED on LINE 3
cd "C:\users\scott\Downloads"
$a = ([xml](new-object net.webclient).downloadstring("https://channel9.msdn.com/Series/CSharp-101/feed/mp4"))
$a.rss.channel.item | foreach{
$url = New-Object System.Uri($_.enclosure.url)
$file = $url.Segments[-1]
$file
if (!(test-path $file)) {
(New-Object System.Net.WebClient).DownloadFile($url, $file)
}
}

Make sure the RSS link that you copied earlier above is correct on line 3. We need a Local Folder and we need our Remote RSS Link.

NOTE: If you're an expert you might think this PowerShell script isn't fancy enough or doesn't do x or y, but it'll do pretty nicely for this project. You're welcome to fork it or improve it here.

And finally, open up PowerShell on your machine from the Start Menu and run your downloadvideos.ps1 script like in this screenshot.

What about getting Low Bandwidth videos I can download on a slow connection!

The low bandwidth videos are super small, some smaller than a JPEG! The largest is just 20 megs, so the full C# course is under 200 megs total.

You can download ALL the videos for EACH playlist by visiting http://dot.net/videos, getting the RSS URL for the video playlist you want, and running the PS1 script again with the changed URL on line 3.

Hope this helps!


Sponsor: Like C#? We do too! That’s why we've developed a fast, smart, cross-platform .NET IDE which gives you even more coding power. Clever code analysis, rich code completion, instant search and navigation, an advanced debugger... With JetBrains Rider, everything you need is at your fingertips. Code C# at the speed of thought on Linux, Mac, or Windows. Try JetBrains Rider today!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb
Sunday, September 29, 2019 6:19:08 AM UTC
@Scott: Okay, that's the coolest script someone connected to Microsoft has ever posted online. (And I am counting Dr. Scripto too! Sorry, doctor; your script fragments are very functional and utilitarian, but there is nothing cool about them.)

@Everyone else: A word of warning! This script downloads the files for you, but then, you must figure out the order in which you should watch them all by yourself. Here is a hint: Use File Explorer to sort them by "Date modified" in descending order.
FleetCommand
Monday, September 30, 2019 11:23:52 AM UTC
Or get the episode from the title, and pre-pend it to the nicely formatted title as the file name


$title = [string]$_.title
$sp = $title.IndexOf('[')
$episode = [Int32] $title.Substring($sp + 1, 2)
$file = $episode.ToString("00_") + $title.Substring(0, $sp - 1)
bez
Monday, September 30, 2019 11:25:57 AM UTC
oops, may want to put .mp4 on the end of that
bez
Friday, October 04, 2019 10:55:39 PM UTC
Wget.exe has this functionality for ~20 years without writing a single line of powershell code.

wget URL -o output

Or get two levels deep from a single web page to get the list of video files and then the individual mp4 video files.

Why re-invent the wheel yet again in powershell.
Bob
Saturday, October 05, 2019 11:34:44 AM UTC
Any plans to do a Typescript series?
Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.