Results 1 to 10 of 10

Thread: [RESOLVED] error with youTube link

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2005
    Posts
    651

    Resolved [RESOLVED] error with youTube link

    Ok, I have some code I am working with, however seem to be stuck
    Not sure if it is because youtube changed something?

    Code:
    Private Sub cmdStart_Click()
        Dim opts As String, html As String, videoId As String, token As String
        Dim matches As MatchCollection
        Dim uri As String
        
        If InStr(txtURL.Text, "http://") <> 1 Then
            MsgBox "Video URL must start with " & Chr(34) & "http://" & Chr(34) & ".", _
                vbExclamation
            txtURL.SetFocus
            Exit Sub
        End If
        
        If txtURL.Text = "http://" Then
            MsgBox "Video URL cannot be empty.", vbExclamation
            Exit Sub
        End If
        ' Perform simple validatino on the video URL
                    
        http.open "GET", txtURL.Text, False
        http.setRequestHeader "User-Agent", USER_AGENT
        
        On Error GoTo NetworkErr
        http.send
        On Error GoTo 0
        
        html = http.responseText
        
        re.Pattern = "/watch_fullscreen\?video_id=(.*?)&.*?&t=(.*?)&"
        If re.Test(html) Then
            Set matches = re.Execute(html)
            videoId = matches(0).SubMatches(0)
            token = matches(0).SubMatches(1)
        Else
            MsgBox "The URL does not appear to be a YouTube video page.", vbExclamation
            Exit Sub
        End If
        
        uri = "http://www.youtube.com/get_video?video_id=" & videoId _
            & "&t=" & token & "&eurl="
        
        opts = ""
        
        If cbQuality.ListIndex = 0 Then
            opts = opts & ":ffmpeg-pp-q=6 "
        ElseIf cbQuality.ListIndex = 1 Then
            opts = opts & ":ffmpeg-pp-q=3 "
        End If
            
        opts = opts & ":sout=#transcode{vcodec=mp1v,vb="
        
        If cbQuality.ListIndex = 0 Then
            opts = opts & "2048"
        Else
            opts = opts & "1024"
        End If
        
        opts = opts & ",acodec=mpga,ab="
        
        If cbQuality.ListIndex = 0 Then
            opts = opts & "256"
        Else
            opts = opts & "128"
        End If
        
        If cbQuality.ListIndex = 0 Then
            opts = opts & ",deinterlace=blend"
        ElseIf cbQuality.ListIndex = 1 Then
            opts = opts & ",deinterlace"
        End If
            
        opts = opts & "}:std{access=file,mux=mpeg1,url=" _
            & Chr(34) & GetMyVideosFolder() & "\" & videoId & ".mpg" & Chr(34) _
            & "}"
        
        vlc.addTarget uri, opts, VLCPlayListReplace, 0
        vlc.play
        
        pbProgress.Visible = True
        EnableUI False
        highestPos = 0
        tmrTranscode.Enabled = True
        
        pbProgress.Value = 1
        
        Exit Sub
        
    NetworkErr:
        MsgBox "Unable to access the video at " & txtURL.Text & ".", vbExclamation
    End Sub
    this is where I am getting an error,
    re.Pattern = "/watch_fullscreen\?video_id=(.*?)&.*?&t=(.*?)&"
    If re.Test(html) Then
    Set matches = re.Execute(html)
    videoId = matches(0).SubMatches(0)
    token = matches(0).SubMatches(1)
    Else
    MsgBox "The URL does not appear to be a YouTube video page.", vbExclamation
    Exit Sub
    End If

    Using this or any other youtube url.

    How can I change code to fix?

    Thanx

  2. #2

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2005
    Posts
    651

    Re: error with youTube link

    This may help me get help....
    The code I pasted and trying to incorporate is from
    smoothtube (http://www.drbatter.com/smoothtube )
    even their fullapp doesnt seem to work anymore, which leaves me to beleive that youtube changed something.

    SO if you want the complete source it is posted there.
    Thanx.

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: error with youTube link

    planethax: What is the specific error message you are getting?

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2005
    Posts
    651

    Re: error with youTube link

    Quote Originally Posted by Hack
    planethax: What is the specific error message you are getting?
    Sorry, I wasnt very clear there.
    I am not getting an error, it is just that every link I put in I get the message box
    "The URL does not appear to be a YouTube video page."
    Even though I know it is a correct URL
    I think Youtube changed the way their links work since this code was written, and I am having a hard time figuring out what exactly the code is looking for so I can correct it.

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2005
    Posts
    651

    Re: error with youTube link

    Well I had sent an Email to the Original author of this code 2 days ago, no reply yet.

    If anyone could help me figure out what the code is looking for, so I can update it that would be great.
    Thanx.

  6. #6
    Lively Member
    Join Date
    Jul 2007
    Posts
    74

    Re: error with youTube link

    Hi, I have VDownloader to download videos from youtube and just to let yous know that it looks like youtube have changed the codes as vdownloader is NOT working either!

    Mathy

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2005
    Posts
    651

    Re: error with youTube link

    Quote Originally Posted by mathy2007
    Hi, I have VDownloader to download videos from youtube and just to let yous know that it looks like youtube have changed the codes as vdownloader is NOT working either!

    Mathy
    Thanx, thats what I thought, I can still get them manually, so if I could figure out what this code is looking for, then I will be able to change it to get it to work again.

  8. #8
    Lively Member
    Join Date
    Jul 2007
    Posts
    74

    Re: error with youTube link

    I googled it, other people having the same problems - http://answers.yahoo.com/question/in...0083426AARvKaV.

    Mathy.

  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2005
    Posts
    651

    Re: error with youTube link

    I realize that many programs have stopped working, however I have figured out how to get them manually,
    I am wanting to know what this code is looking for so I can change it to work.
    example, to get get the files from youtube manually you need to

    "Go find the video you want to watch then get it's ID.
    http://www.youtube.com/watch?v=A2P4Zesf_l4
    The video ID is:
    A2P4Zesf_l4
    Now in your browser head to:
    http://www.youtube.com/v/A2P4Zesf_l4
    You'll get back this long URL in your browser window:
    http://www.youtube.com/p.swf?video_i...lJWE481mMNotYZ
    What you need to extract is the &t= variable. This is like a tracking ID which I'm pretty sure changes every hour or day (not really sure). Anyway, the tracking variable is right at the end of the URL and it's this:
    OEgsToPDskJG2DA_SllJWE481mMNotYZ
    Next point your browser to this URL and replace the ID and T_ID with the file ID and tracking ID:
    http://www.youtube.com/get_video?video_id=ID&t=T_ID
    So thats:
    http://www.youtube.com/get_video?vid...lJWE481mMNotYZ

    after downloading, rename file with a .flv extsion"

    Now I need to change the previous code to incorporate these new changes.

    Thanx
    Last edited by planethax; Feb 17th, 2008 at 09:20 PM.

  10. #10

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2005
    Posts
    651

    Re: error with youTube link

    Ok, I still do not understand what the code I posted is looking for, which really sucks, as I would like to learned it.
    However, with some hacking with it, I figured out why it was not working.
    I had to change
    re.Pattern = "/watch_fullscreen\?video_id=(.*?)&.*?&t=(.*?)&"
    to
    re.Pattern = "\?video_id=(.*?)&.*?&t=(.*?)&"

    Now it works.

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