ProgrammerNazaryman

Untitled

Mar 22nd, 2012
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.88 KB | None | 0 0
  1. Hello all
  2. This is the Source for How to Make a Youtube to MP3 Downloader / Generator /Converter
  3.  
  4. Using Webbrowser
  5. By Using this you Need
  6. Webbrowser
  7. textbox1/textbox2
  8. Button1 for Navigate
  9. Button2 for Download/Convert/Generator
  10. On the Form Load add this Code
  11.  
  12. Code:
  13. webbrowser1.navigate("http://www.youtube-mp3.org/")
  14.  
  15. Click the Button1 and add this Code
  16.  
  17.  
  18. Code:
  19. webbrowser1.document.GetElementById("youtube-url").SetAttribute("Value", TextBox1.Text)
  20. webbrowser1.document.GetElementById("submit").InvokeMember("Click")
  21.  
  22. Click the Button2 and add this code
  23.  
  24.  
  25. Code:
  26. Dim s As String = WebBrowser1.Document.GetElementById("dl_link").InnerHtml
  27. 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>", "")
  28. TextBox2.Text = redirect
  29. webbrowser1.navigate(redirect)
  30. Using Webclient
  31. This site [http://www.youtube-mp3.org] uses the GET method
  32. so Simple Code
  33.  
  34.  
  35. You Need
  36.  
  37. [*]Button
  38. [*]Textbox1/Textbox2
  39. [*]PictureBox to show screenshot
  40.  
  41. Our Imports
  42.  
  43. Code:
  44. Imports system.net
  45. Imports System.Text.RegularExpressions
  46.  
  47.  
  48. Add a Button then enter this code
  49. [i've Used the Regex to Grab the Values
  50.  
  51.  
  52. Code:
  53. Dim s as new webclient
  54. Dim y As String = s.DownloadString("http://www.youtube-mp3.org/api/itemInfo/?video_id=" + Textbox1.text )
  55. Dim linkoriginal As New System.Text.RegularExpressions.Regex("""image"" : ""(\S+)""\D+\S+\D+""h"" : ""(\S+)""")
  56. Dim matches As MatchCollection = linkoriginal.Matches(y)
  57. For Each showlink As Match In matches
  58. Dim u As String = (showlink.Groups(1).Value)
  59. Dim t As String = (showlink.Groups(2).Value)
  60. TextBox2.Text = "http://www.youtube-mp3.org/get?video_id=" + TextBox1.Text + "&h=" + t
  61. PictureBox1.Image = New Drawing.Bitmap(New IO.MemoryStream(s.DownloadData(u)))
  62. Next
  63.  
  64.  
  65. Example Image http://i.imgur.com/zHp4n.png
Advertisement
Add Comment
Please, Sign In to add comment