Click here to Skip to main content
Full site     10M members (39.9K online)    

YouTube to mp3

Introduction

Hello! In this post, I'll show you my small new project. With this software, you can download Youtube videos as mp3 files. It works with http://www.youtube-mp3.org where program sends commands that convert video and sends download link of mp3 file to the program.

Using the Code

To convert a video, you must do the following three steps:

  1. Submit a link of the video you want to convert.
  2. Send command to www.youtube-mp3.org and get the download link of mp3 file.
  3. Download mp3 file.

Now see that in code!

  1. TextBox1 is textbox for video URL. Button2 is convert button. This code checks video URL. Place this code on Button1_Click event. Button1 is submit or check button.
    If TextBox1.Text.StartsWith("http://www.youtube.com/watch?v=") Then
    	Button2.Enabled = True
    Else
    	Button2.Enabled = False
    End If  
  2. This code sends video URL and convert command. Button3 is download button. Place this code on Button2_Click event.
    WebBrowser1.Document.GetElementById("youtube-url").SetAttribute("value", TextBox1.Text)
    WebBrowser1.Document.GetElementById("submit").InvokeMember("click")  
    Button3.Enabled = True  
  3. This code starts downloading the mp3 file. Place this code on Button3_Click event.
    Dim download_link As HtmlElement = WebBrowser1.Document.GetElementById("dl_link")
    Dim links As HtmlElementCollection = download_link.GetElementsByTagName("a")
    Dim link As String = links(0).GetAttribute("href")
    System.Diagnostics.Process.Start(link)   
  4. This code navigates web browser to the webpage where converting starts. Put it on Form1_Load event.
    WebBrowser1.Navigate("http://www.youtube-mp3.org/")  

In this project, you need TextBox1, Button1, Button2, Button3, WebBrowser1.

Download

The source isn't available, but you can download the application here.

The software is available only in Serbian language!

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search 
Per page   
-- There are no messages in this forum --

Last Updated 4 May 2013 | Advertise | Privacy | Terms of Use | Copyright © CodeProject, 1999-2013