|
-
Feb 13th, 2008, 05:58 PM
#1
Thread Starter
Fanatic Member
[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
-
Feb 13th, 2008, 10:05 PM
#2
Thread Starter
Fanatic Member
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.
-
Feb 14th, 2008, 07:03 AM
#3
Re: error with youTube link
planethax: What is the specific error message you are getting?
-
Feb 14th, 2008, 01:06 PM
#4
Thread Starter
Fanatic Member
Re: error with youTube link
 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.
-
Feb 15th, 2008, 09:27 AM
#5
Thread Starter
Fanatic Member
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.
-
Feb 15th, 2008, 12:17 PM
#6
Lively Member
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
-
Feb 15th, 2008, 12:27 PM
#7
Thread Starter
Fanatic Member
Re: error with youTube link
 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.
-
Feb 15th, 2008, 12:34 PM
#8
Lively Member
Re: error with youTube link
I googled it, other people having the same problems - http://answers.yahoo.com/question/in...0083426AARvKaV.
Mathy.
-
Feb 16th, 2008, 01:07 AM
#9
Thread Starter
Fanatic Member
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.
-
Feb 18th, 2008, 04:31 PM
#10
Thread Starter
Fanatic Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|