Build A YouTube Downloader With C# And GitHub

Push Your Skills To A New Level By Building A Real Application!
4.3 (29 ratings) Instead of using a simple lifetime average, Udemy calculates a
course's star rating by considering a number of different factors
such as the number of ratings, the age of ratings, and the
likelihood of fraudulent ratings.
274 students enrolled
$19
$20
5% off
Take This Course
  • Lectures 32
  • Length 2.5 hours
  • Skill Level Intermediate Level
  • Languages English
  • Includes Lifetime access
    30 day money back guarantee!
    Available on iOS and Android
    Certificate of Completion
Wishlisted Wishlist

How taking a course works

Discover

Find online courses made by experts from around the world.

Learn

Take your courses with you and learn anywhere, anytime.

Master

Learn and practice real-world skills and achieve your goals.

About This Course

Published 11/2015 English

Course Description

Why take this course? In this course you learn how to build a professional YouTube downloader application using Visual Studio Community 2015. This application can download video files, audio files, and even files from YouTube play lists. During the process, you see how to build an interface, how to add class files, how to add external files, and how to make use of libraries already posted on GitHub. The construction of the project is decomposed into small steps so you can build along with the course, and not feel overwhelmed. The course consists of HD videos, many of which are short, some challenges, along with the solutions, and complete visual studio files that you can download as zips or clone from GitHub. Let's get coding!

What are the requirements?

  • Intermediate Level C#
  • Have Access To Visual Studio 2015 Community

What am I going to get from this course?

  • Build An Interface That Does Not Freeze During Program Execution
  • Write Code That Uses YouTube Application Programming Interfaces
  • Write Code That Can Download Video Files From YouTube
  • Write Code That Can Download Audio Files From YouTube
  • Write Code That Ensures That YouTube Links Are Correctly Formatted
  • Become Familiar With The Concept Of Normalized YouTube Links
  • Learn How To Download Files From YouTube Play Lists
  • Write Code That Uses Asynchrony For Improved Program Performance
  • Write Code That Uses Try/Catch To Ensure Errors Are Gracefully Handled
  • Learn How To Use Background Worker Controls
  • Learn How To Use Timer Controls

What is the target audience?

  • You should take this course if you already understand the fundamentals of C#
  • You should not take this course if you're new to C#

What you get with this course?

Not for you? No problem.
30 day money back guarantee.

Forever yours.
Lifetime access.

Learn on the go.
Desktop, iOS and Android.

Get rewarded.
Certificate of completion.

Curriculum

Section 1: Introduction
02:35

Lesson Objective: To show you the final form of the project

How This Step Fits Into Project: This step illustrates the final stage of the project so that you have a reference point as we complete the course

Learning Objectives:

1) Learn how to run the complete project by importing it into Visual Studio 2015

2) Learn how the program operates by downloading a video, and an audio file

3) You can get Visual Studio 2015 Community below

05:27

Lesson Objective: Become familiar with cloning a repository from GitHub

How This Step Fits Into Project: This step matters because it gives you important resources for ensuring that you have a definite and complete reference to each stage of the project

Learning Objectives:

1) Learn about GitHub

2) Learn how to clone a repository inside Visual Studio

3) See how each stage of the project can also be downloaded as a zip file

Section 2: Designing the User Interface
04:23

Lesson Objective: Create the project in Visual Studio

How This Fits Into Project: This step builds the basic user interface

Learning Results:

1) Learn how to create a Windows Forms C# project

2) Learn how to change the text property of the form so it says "YouTube Downloader 1.0"

3) Learn how to change the code name of the form so it says frmYTDownloader

4) Learn how to add a picture box, and how to change the name of the box in code to picBox

5) Learn how to populate the picture box with the attached picture, and how to stretch the picture properly

6) Learn how to set the horizontal position of the picture box with complete control

7) Learn how to set the FormBorderStyle property of the form so it cannot be resized after program launch

8) Learn how to set the icon property of the form using the attached icon

9) You can get the Visual Studio files, image and icon in the attached zip

08:13

Lesson Objective: Add user controls to the to build the interface

How This Fits Into Project: This step builds the user interface to make the program usable

Learning Results:

1) Learn how to make the interface

2) Learn how to set the values to be displayed inside the combo box

3) Learn how to view all the components defined inside a form

4) You can view the components inside the attached picture

5) You can view the the full interface in the attached picture

6) There is also a PDF attached showing all the controls labeled with their names in code

7) The preview picture box will be added towards the end of the course

05:05

Lesson Objective: Setup a folder browser dialog for choosing paths to files

How This Fits Into Project: This step gives the user control over the storage location of downloaded files

Learning Results:

1) Set up a default download location

2) Add a folder browser dialog

3) Connect the button labeled "Choose" to the folder browser dialog

5) Write code to populate the path box

Section 3: Using Free C# Libraries From Github
03:37

Lesson Objective: Become aware of free C# code libraries on GitHub, especially those focusing on YouTube

How This Fits Into Project: This step is important because it's the one that shows how we can use existing C# libraries to create the heart of our application

Learning Results:

1) Learn how to go to GitHub.com and search for the YouTube Extractor library

2) Become aware of Nuget packages, and that VS supports importing Nuget packages

3) Take a look at some of the supported platforms

4) Take a look at examples of how the YouTube Extractor library can be used to download videos and MP3's

5) Learn how to check on the .Net Framework inside Visual Studio

6) Install YouTube extractor in our application using a Nuget package

7) Confirm that the YouTubeExtractor and NewtonSoft.Json references and packages are installed

02:52

Lesson Objective: Decide which of the classes available in the YouTube Extractor library is the right one

How This Step Fits Into Project: There are some additional classes into the YouTube Extractor library, so this step helps us to focus on the ones that are most important to adding the functionality we need to build our app

Learning Results:

1) Learn how to browse a namespace using the object browser

2) Review the classes that are important to our project

3) Take a look at some of the key methods needed to make our program work

4) Take a look at the VideoInfo class as a way of representing downloads

05:08

Lesson Objective: Confirm that the video download function works as expected

How This Step Fits In: This step allows us to confirm that the function works as expected by trying it with an actual YouTube URL

Learning Results:

1) Before we do it together, see whether you can figure out how to download a file

2) Use the code on GitHub at: https://github.com/flagbug/YoutubeExtractor

3) You can use the video at: https://www.youtube.com/watch?v=pv-6rweZR_s

4) Become aware of the fact that this step runs synchronously, so the app freezes

5) Learn how to add the YouTubeExtractor namespace

6) Learn how to add the System.IO name space to make Path.Combine work

7) The download path in the Path.Combine must be changed to the path on your drive

8) Make sure you disable the progress bar for now

05:27

Lesson Objective: Confirm that the audio download function works as expected

How This Step Fits In: This step allows us to confirm that the function works as expected by trying it with an actual YouTube URL

Learning Results:

1) Before we do it together, see whether you can figure out how to download the audio file

2) Use the code on GitHub at: https://github.com/flagbug/YoutubeExtractor

3) You can use the video at: https://www.youtube.com/watch?v=3E2bOe_LDrc

4) The download path in the Path.Combine must be changed to the path on your drive

5) Make sure you disable the progress bars for now

6) The complete stage of this project is available as a zip download


Section 4: Building The Data Model
10:10

Lesson Objective: Learn what a data model is and how creating one improves our project

How This Step Fits In: This step helps us understand why we need to create three new classes to help organize the structure of the project. Instances of these classes will be made later to help us download files.

Learning Results:

1) Learn why we need a data model class

2) Learn that this particular class contains only properties that describe each download

3) Understand that having a data model allows passing objects around, together with all the properties, so the code is more clean

4) For example, writing download(YouTubeModel) is cleaner then download(URL, Location,...) and so on

5) Create a new class file called YouTubeModel.cs

6) Create code that defines the YouTubeModel class

7) Create code that defines the YouTubeVideoModel class

8) Create code that defines the YouTubeAudioModel class

Section 5: Data Validation and Interface Control Access
02:30

Lesson Objective: Try to figure out how to validate a YouTube URL

How This Step Fits In: This lesson challenges you to construct a function that ensures that the YouTube links entered by the user are correctly formatted

Learning Results:

1) Become aware of the concept of a Tuple as a simple data structure that can store multiple data types

2) Learn how to launch a MessageBox to display a message to the user

3) There are two hints available as PDF's in the supplementary materials area

04:55

Lesson Objective: See how to write a function that validates YouTube URL's to ensure they are correctly formatted

How This Step Fits In: This steps illustrates the solution to the challenge posted above, and helps to ensure our application runs more smoothly

Learning Results:

1) Learn how to create a method that perform link validation

2) Learn how to use an existing method called TryNormalizeYoutubeURL

3) Become familiar with the concept of an out parameter as representing a value that a method can set and return to the calling code

4) See how to confirm that this validation works as expected

02:16

Lesson Objective: Learn how to check that a folder exists

How This Step Fits In: This step counts because it helps to ensure a user cannot enter an invalid download location

Learning Results:

1) Understand that the folder path text box can be typed in

2) Learn how to ensure that the path entered in the box is valid

3) Learn how to confirm that the folder validation works

04:35

Lesson Objective: Pass a tuple return type into another method to perform a download

How This Step Fits In: This step matters because it illustrates how we can make use of a validated link

Learning Objectives:

1) Learn how to use part of a tuple in an if condition check

2) See a detailed description of the difference between normalized and unnormalized URL's

3) Example of a normalized URL:

https://www.youtube.com/watch?v=nmsXmr6WV_c

4) Example of a URL to be normalized:

https://www.youtube.com/watch?v=68k_Tdx42MY&list=PLJQL6rmQXweVpjBOfXHgCCM7f38wsa_1V&index=1

01:14

Lesson Objective: This lesson challenges you to figure out how to restrict access to the components of the interface while a download is in progress

How This Step Fits In: This step matters because we want to ensure that users cannot start multiple downloads while a download is in progress

Learning Results:

1) See how to add a simple method where it's called, and also how to add the method stub

2) See whether you can figure out how to disable the controls in the form before watching the solution video

3) The solution is provided in the next video

02:21

Lesson Objective: Write code to restrict access to interface components while a download is in progress

How This Step Fits In: This step shows the solution to the challenge above

Learning Results:

1) Learn how to use the Enabled property of controls to restrict access to them

2) See how to test the code with a real download

02:13

Lesson Objectives: This lesson challenges you to enable the controls on the interface after a download completes

How This Step Fits In: This step matters because it ensures that the interface becomes usable again after a download

Learning Results:

1) Add a call to EnableAccessibility()

2) Use thread sleeping to simulate the process of downloading a file

3) Put in stub for EnableAccessibility()

03:11

Lesson Objective: Learn how to enable interface controls after a download completes

How This Step Fits In: This step counts because it makes the program ready for another run

Learning Results:

1) Learn how to make interface controls work again after a download completes

2) Understand there is a difference between clearing the text property of a control and enabling the control

Section 6: Getting Ready To Download
04:59

Lesson Objective: Add FileDownloader.cs to the project

How This Step Fits In: This step matters because the FileDownloader.cs file contains methods that actually download both MP3 and video files from YouTube, and code that prevents the user interface from freezing

Learning Results:

1) Learn how to add an existing C# file

2) Learn why FileDownloader.cs has to be added to the project

3) Understand that Task.Run in DownloadAudio and DownloadVideo makes the user interface not freeze during a download

4) Understand why FileDownloader contains certain name spaces


03:15

Lesson Objective: Create a YouTubeVideoModel object, and pass it to the DowloadVideo method

How This Step Fits In: This step matters because it connects the YouTubeVideoModel class with the combo box to allow selecting a video to download

Learning Results:

1) Learn how to create an instance of the YouTubeVideoModel class

2) Learn how to set a couple properties of this instance

3) Learn how to pass this instance into the DownloadVideo method

01:54

Lesson Objective: Create A YouTubeAudioModel object, and pass it to the DownloadAudio method

How This Step Fits In: This step matters because it shows how to set some of the properties of a YouTubeAudioModel object

Learning Results:

1) See how to instantiate an object of type YouTubeAudioModel

2) Set some of the properties of this object

3) Learn how to pass the object into DownloadAudio

Section 7: Downloading The Video Files
07:38

Lesson Objective: Populate the YouTubeVideoModel and call the DownloadVideo method to complete a download

How This Step Fits In: This is the step that actually downloads a video from YouTube

Learning Results:

1) Create the DownloadVideo method

2) Set the properties of the object to be downloaded

3) Call FileDownloader.DownloadVideo with the YouTubeVideoModel as argument

4) Understand why a try/catch construct is needed to wrap the code

08:05

Lesson Objective: Hook up event handlers so that accessibility, the progress bar, and opening the download folder are enabled after a download

How This Step Fits In: This is code that executes after a download, or during a download to make the application more user friendly by updating the progress bar, and opening the download location with the downloaded file selected

Learning Results:

1) Learn how to enable control access after a download completes

2) Learn how to update a progress bar as a download runs

3) Learn how to open a folder after a download completes

00:56

Lesson Objective: Pose challenge to update the label that shows the name of a file being downloaded

How This Step Fits In: This step matters because a file name is more friendly to users than a URL

Learning Results:

1) Figure out how to update the file name label with the name of a file being updated

2) A hint is provided in the supplementary materials area

02:29

Lesson Objective: Show solution to file name label challenge

How This Fits In: This step shows how to correctly position a method call to ensure a file name is displayed

Learning Results:

1) Learn how to position a method call

2) Learn how to write a method that displays the title of a file as it downloads


Section 8: Downloading The Audio Files
01:10

Lesson Objective: Pose challenge to figure out how to implement audio downloading

How This Step Fits In: This step completes the download functionality of the application, and is very similar to the step taken to figure out how to download video

Learning Results:

1) Figure out how to download audio using the DownloadAudio method

04:52

Lesson Objective: Present a solution to the audio download challenge

How This Step Fits In: This step completes the audio download portion of the application

Learning Results:

1) Learn how to set the properties of an audio downloader object

2) Learn how to call the DownloadAudio method with the audio downloader object

03:54

Lesson Objective: Hook up event handlers

How This Step Fits In: This step matters because it makes the progress bar, and check box respond during and after an audio download

Learning Results:

1) Learn how to connect events and event handler to enable control access after a download

2) Learn how to update the progress bar

3) Learn how to open the folder with the downloaded file selected

Section 9: Add Preview Picture Box
07:58

Lesson Objective: See how to add a background worker to fetch images from YouTube to show in preview box

How This Step Fits In: In case a video takes a while to download, this gives the user the option to preview the download

Learning Results:

1) Add picture box for showing pictures to preview

2) Learn how to add a background worker

3) Learn how to write code to make the backgroundworker work

4) Add the System.Net namespace reference

09:36

Lesson Objective: Add a timer control to run through a sequence of pictures as a video downloads

How This Step Fits In: This step helps to ensure the pictures in the preview box changes

Learning Results:

1) Add a timer control

2) Write code to start the timer

3) Write code to stop the timer

03:34

Lesson Objective: Update the file name label, and perform final testing of software

How This Step Fits In: This step counts because it confirms the application works as shown at the beginning of the course

1) Install the application

2) Increase the font size

3) Run the application through a complete cycle of possible inputs to confirm all the features work as expected

Section 10: Where To Go From Here
Article

Lesson Objective: Learn about similar projects on GitHub that can be used to add new features to ours

Students Who Viewed This Course Also Viewed

  • Loading
  • Loading
  • Loading

Instructor Biography

Tom Owsiak, Web, Math, Stats., and Physics Expert

  • I have nine years experience as a teacher of mathematics, physics, statistics, and programming. I worked for five years as a database programmer using various technologies such as .NET, Clipper, SQL, SQL Server, SAS, Excel, and others. I'm the publisher of one of the most successful programming courses on udemy, called "Learn C# With Visual Studio 2013". Currently, I work as a mathematics and computer science teacher at a college in NY.
  • Related Education:
  • Master of Science in Applied Statistical Computing, Kennesaw State University
  • Bachelor of Arts, Pure Mathematics, Queens College
  • Associates of Science in Computer Programming
  • Creator of more than 1620 math, physics, statistics and programming videos
  • Programmer of more than 500 educational simulations


Ready to start learning?
Take This Course