[vb.net]Youtube to Mp3 Converter/Downloader [Source Code] 02-12-2012, 05:49 PM
#1
This is the Source for How to Make a Youtube to MP3 Downloader / Generator /Converter
Using Webbrowser
By Using this you Need
Webbrowser
textbox1/textbox2
Button1 for Navigate
Button2 for Download/Convert/Generator
On the Form Load add this Code
Click the Button1 and add this Code
Click the Button2 and add this code
Using Webclient
This site [http://www.youtube-mp3.org] uses the GET method
so Simple Code
You Need
Imports
Add a Button then enter this code
[i've Used the Regex to Grab the Values![Biggrin Biggrin](https://sinister.ly/images/smilies/set/biggrin.png)
Using Webbrowser
By Using this you Need
Webbrowser
textbox1/textbox2
Button1 for Navigate
Button2 for Download/Convert/Generator
On the Form Load add this Code
Code:
webbrowser1.navigate("http://www.youtube-mp3.org/")
Click the Button1 and add this Code
Code:
webbrowser1.document.GetElementById("youtube-url").SetAttribute("Value", TextBox1.Text)
webbrowser1.document.GetElementById("submit").InvokeMember("Click")
Click the Button2 and add this code
Code:
Dim s As String = WebBrowser1.Document.GetElementById("dl_link").InnerHtml
Dim redirect As String = s.Replace("<A href=""", "").Replace("""><B>Download</B></A> · <A onclick=""showLinkBox(); return false;"" href=""http://www.youtube-mp3.org/#"">Link this mp3</A>", "")
TextBox2.Text = redirect
webbrowser1.navigate(redirect)
Using Webclient
This site [http://www.youtube-mp3.org] uses the GET method
so Simple Code
You Need
Code:
[*]Button
[*]Textbox1/Textbox2
[*]PictureBox to show screenshot
Imports
Code:
Imports system.net
Imports System.Text.RegularExpressions
Add a Button then enter this code
[i've Used the Regex to Grab the Values
![Biggrin Biggrin](https://sinister.ly/images/smilies/set/biggrin.png)
Code:
Dim s as new webclient
Dim y As String = s.DownloadString("http://www.youtube-mp3.org/api/itemInfo/?video_id=" + Textbox1.text )
Dim linkoriginal As New System.Text.RegularExpressions.Regex("""image"" : ""(\S+)""\D+\S+\D+""h"" : ""(\S+)""")
Dim matches As MatchCollection = linkoriginal.Matches(y)
For Each showlink As Match In matches
Dim u As String = (showlink.Groups(1).Value)
Dim t As String = (showlink.Groups(2).Value)
TextBox2.Text = "http://www.youtube-mp3.org/get?video_id=" + TextBox1.Text + "&h=" + t
PictureBox1.Image = New Drawing.Bitmap(New IO.MemoryStream(s.DownloadData(u)))
Next
![[Image: zHp4n.png]](http://i.imgur.com/zHp4n.png)