Results 1 to 13 of 13

Thread: get song title from youtube

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2013
    Posts
    336

    get song title from youtube

    hi,

    how can i get the song title of a song, as fast as possible, the text in the box ------>



    i'm downloading the song with webclient....

  2. #2
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Posts
    12,371

    Re: get song title from youtube

    I've don't work with the WebClient much, but in the HtmlDocument class you'd call GetElementByID. The ID for the title is: eow-title. From there you'd call GetAttribute, the attribute you're looking for is: title. But like I said, that's using the HtmlDocument class, I'm not sure about the WebClient, but I'm sure it isn't to much different.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | HtmlLessons | CssLessons | Code Tags | Sword of Fury - Jameram

  3. #3
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: get song title from youtube

    but I'm sure it isn't to much different.
    Oooooooh yes it is!!!!!
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  4. #4
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Posts
    12,371

    Re: get song title from youtube

    Quote Originally Posted by dunfiddlin View Post
    Oooooooh yes it is!!!!!
    Sorry for my ignorance, I just never had to work with the WebClient. I'm sure a quick google search should pull up something more than asking for a full blown working piece of code, so that's my follow up with the OP :P
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | HtmlLessons | CssLessons | Code Tags | Sword of Fury - Jameram

  5. #5
    Bad man! ident's Avatar
    Join Date
    Mar 2009
    Location
    Cambridge
    Posts
    5,401

    Re: get song title from youtube

    Quote Originally Posted by dunfiddlin View Post
    Oooooooh yes it is!!!!!
    Indeed since it's simply a string value.

    vb Code:
    1. Imports System.Net
    2. Imports System.Text.RegularExpressions
    3.  
    4. Public Class Form1
    5.  
    6.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    7.         Dim url As String = "http://www.youtube.com/watch?v=jrNLsC_Y9Oo"
    8.         Dim source As String = Nothing
    9.         Dim uri As New Uri(url)
    10.  
    11.         Using wClient As New WebClient
    12.             source = wClient.DownloadString(uri)
    13.         End Using
    14.  
    15.         Dim rx As New Regex("(?<=<span id=""eow-title"" class=""watch-title long-title yt-uix-expander-head"" dir=""ltr"" title="").+(?="">)")
    16.         MessageBox.Show(rx.Match(source).Value)
    17.     End Sub
    18. End Class
    My Github - 1d3nt

  6. #6
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: get song title from youtube

    Indeed since it's simply a string value.
    That's assuming that it is the source that he's downloading. Not sure we have enough information to be confident of that.
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2013
    Posts
    336

    Re: get song title from youtube

    @ident, that shows me an empty msgbox

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2013
    Posts
    336

    Re: get song title from youtube

    Im downloading the mp3 via another site using youtube

  9. #9
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Posts
    12,371

    Re: get song title from youtube

    That is illegal. Section 5b.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | HtmlLessons | CssLessons | Code Tags | Sword of Fury - Jameram

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2013
    Posts
    336

    Re: get song title from youtube

    Quote Originally Posted by dday9 View Post
    That is illegal. Section 5b.
    Yes m8 it is but im only converting the vi..

  11. #11
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Posts
    12,371

    Re: get song title from youtube

    That doesn't matter what you're doing to it, you're still breaking the law. Which is not only against YouTube's terms, but also VBForums acceptable use policy. The acceptable use policy(AUP) is what you agreed to when signing up with VBForums and can be found at the bottom of any page your at on VBForums.

    The rule I'm referring to in the AUP is:
    You will not violate any laws nor to discuss illegal activities.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | HtmlLessons | CssLessons | Code Tags | Sword of Fury - Jameram

  12. #12

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2013
    Posts
    336

    Re: get song title from youtube

    Ok fair point, for the record; most peoples download from youtube these days.....

  13. #13
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: get song title from youtube

    Breaking the AUP is something that could get you banned from this forum. Please don't do it again.

    Thread closed.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width