Ecosystem

Two prominent contenders, Solana and Ethereum, have the potential to shape the future of decentralized applications and digital finance. Although Ethereum is the 800-pound gorilla today, things can…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Write your own Youtube Downloader

Youtube is one of the top three most visited websites in the world. Many people upload their personal moments, funny stuff, cover songs, podcasts, screencasts etc, all globally shared over the Internet.

So let’s just start writing a youtube downloader using C#, Windows Form and YoutubeExplode library.

You can make your own UI. This is how my UI looks:

Below is the table of unique ids or element names as numbered

Now let's start writing the code for this

In Check function, we are first checking that the “textURL” box is not blank and if it is blank then the popup is shown.

Then we Check the path for saving the video has been selected if it is not then the popup is shown.

MessageBox.Show just shows the pop up like this.

2)Now let’s write the code for browsing the path on clicking the button “browse the path to save video”. For this, one element from the toolbox “folderBrowserDialog” has been selected with unique id or name as “folderBrowserForConvertingVideo”.

3)Now since we have written the functions to check the conditions now we should write the functionality on button click “buttonDownloadMp4”.

4)Now we will also write the functionality for the button “buttonDowloadMp3”.

5)Now we will write the DownloadAsyc task but before that, we need to download YoutubeExplode library.

a)Right click on Solution under Solution Explorer.

b)Then the popup window will open and then click on Manage NuGet Packages for Solution.

c)Then a window will open and then click on browse and then in a search field type Youtube explode.

d)Then select the first one and then a popup will appear.

e)Tick mark the boxes then you will get the option to install. Since in my project, the library has already been added so there is an option for uninstalling but if you have not installed you will get the option to install it. So install it and then click on OK when it gets installed.

After the library has been installed add these two header files.

Then we will write the DownloadAsync task.

Split function splits the line on the bases of the string we pass so by that we get the youtube id in fileLines[1].

The URL from the above image is split as below :

After the video has been downloaded the show function is called to display the message with the path where the video has been downloaded. So we will write the Show() function now.

So you have just built your own youtube downloader. If you face any difficulty or have any questions post in the comments.

You can also check the code on my Github repository

Let me know if this worked for you (it does for me!), and if you have any feedback.

Add a comment

Related posts:

Joker Spring Assisted Opening Wholesale Legal Automatic Knife

Joker Spring Assisted Opening Wholesale Legal Automatic Knife is the perfect choice for anyone looking for a reliable and legal everyday carry knife. The wholesale Tactical Pocket Knives make it easy…

Week 4

As we are heading towards week five where we discuss how formal and informal education prepares you for leadership, I came across this post on my Facebook wall recently that sums up a critical and…

Physical Model Project for Influenceth

The goal of this project is to create 3D printable models of various buildings and spacecraft from Influence. The project started with test-modeling the Escape Module, which was a prrof-of-work for…