Downloading Youtube clips
Hi everyone
I'm trying to create a program on which i can download youtube clips bye pasting their links into a textbox and pressing a button but don't know how to do it. I searched in google but i couldn't find the right solution. I hope someone can help me.
Thanks in advanced!!!!!
Re: Downloading Youtube clips
Have you seen if they have any info on that on http://www.youtube.com/dev?
Re: Downloading Youtube clips
What language are you using?
Re: Downloading Youtube clips
Hi
I'm using Visual basic (vb.net 2005 IDE).
Re: Downloading Youtube clips
How about something like (untested)
Code:
My.Computer.Network.DownLoadFile(Textbox1.Text, "c:\vadi", "username", password")
Re: Downloading Youtube clips
The hard part might be trying to get the URL to the actual media file/flash video embedded in the page.
I could be mistaken, but I think they use JavaScript or something else to encode the URL to the .swf video file.
Re: Downloading Youtube clips
Its a dynamically determined path on a different server for downloading the flv file
Re: Downloading Youtube clips
is there a way to determine the actual link? Perhaps calling the javascript?
Re: Downloading Youtube clips
Well there is a javascript variable that contains the path.
var swfUrl = '/player2.swf';
var swfArgs = {"e": "h", "sourceid": "y", "video_id": "6MFMEUtmF-A", "l": 44, "sk": "JKO_asxtlW_xe3eIs0UZ9AU", "t": "OEgsToPDskIZ6fUnnYIqLcvRuEZxQKSz", "hl": "en", "plid": "AARFlSgZ9IjBOJviAAAAoAAYAAA", "sdetail": "p%3A/browse"};
Re: Downloading Youtube clips
I have The Method to Access to Those Clip flv without any programme
so if interested i can post how to get it & then we can you cree the algo for it & running in vb.Net 2005 & post it in the CodeBank !
Re: Downloading Youtube clips
Re: Downloading Youtube clips
oK let's Take an Example !
1/This is the Link original from Youtube
http://www.youtube.com/watch?v=Ulf5CdFykX0
2/we will change This Url Like This way
http://www.youtube.com/watch/v/Ulf5CdFykX0
we removed the ? & = and replaced with /
when you type this 2 url you will Get The Url of the page like this
3/In The Browser Get The Url After &t= like
http://www.youtube.com/swf/l.swf?vid...n7pyvjYR30g849
Now This is The mean what we need , if we look well in the url what we need is this
&t=OEgsToPDskIpUGfLc8AzYa2_L5Zq_MSI
The one started from &t
4/Now enter The Full URL Like this & download Your file
http://youtube.com/get_video.php?vid...AzYa2_L5Zq_MSI
if we see very well
Ulf5CdFykX0 = The id of the url
&t=OEgsToPDskIpUGfLc8AzYa2_L5Zq_MSI = The link to download it
so Now we need to work on a algo that will do those operations
Thanks !
Re: Downloading Youtube clips
Oh yes I remember that method. Its from this post by Chris001
http://www.vbforums.com/showpost.php...78&postcount=2
But it seems there are some issues with it as noted in the thread. ;)
Quote:
My solution works fine if you want to download the video right away, but you can't post the final link on an other webpage, because the link expires.
Re: Downloading Youtube clips
sorry I havent seen This Thread before , because this way i got it from my sister ;)
Re: Downloading Youtube clips
Well as long as the issue gets solved ;)
We cant be sure but it may appear that its for immediate download but if not then the links will be broken.
Re: Downloading Youtube clips
First of all thanks for your replies!!!!!!
Guys i tried this things but it only downloads only a small file like 100kb or so.
So it doesnt work. I would eppriciate if someone could give me a sample of that cos i don't think that i can do it otherwise.
Thanks in advanced!!!
Re: Downloading Youtube clips
I followed the directions ffrom the link I posted and it downloaded a 7.9 MB file.
This is my end result url I constructed but remember that it will only be available for a short time.
http://www.youtube.com/get_video.php...GWOFRYyCQ4KOqd
Re: Downloading Youtube clips
they worked for me too, IN A BROWSER. If you try to copy the link into a download accelerator, it fails. Incidently, if you get a 100kb file, rename it with a .htm extension and look again...
Re: Downloading Youtube clips
Guys thanks for your efforts but this is not what i was looking for. I expected code or a sample program. I will google a bit and see what i can find.
Thank
Re: Downloading Youtube clips
Quote:
Originally Posted by vadi
Guys thanks for your efforts but this is not what i was looking for. I expected code or a sample program. I will google a bit and see what i can find.
Thank
Because it's Not a Direct Link !
Re: Downloading Youtube clips
i put this together, it's best to run it in another thread ( Backgroundworker ) otherwise the app will sit there locked out until the download has done.
i tested it on a few vids.
Code:
'/// ENTER THE URL THAT YOU WOULD WATCH THE VID ON IN BROWSER ...
Dim request As HttpWebRequest = DirectCast(HttpWebRequest.Create("http://www.youtube.com/watch?v=FJaAe7sYoCA"), HttpWebRequest)
Dim response As HttpWebResponse = DirectCast(request.GetResponse, HttpWebResponse)
Dim source As String = New StreamReader(response.GetResponseStream, System.Text.Encoding.Default).ReadToEnd
If source.IndexOf("video_id=") > -1 Then
Dim url As String = System.Text.RegularExpressions.Regex.Split(source, "video_id=")(1)
url = "http://www.youtube.com/get_video?video_id=" & System.Text.RegularExpressions.Regex.Split(url, "&title=")(0)
Dim wc As New WebClient
wc.DownloadFile(url, "C:\FJaAe7sYoCA.flv")
End If
response.Close()
might start you off. :)
1 Attachment(s)
Re: Downloading Youtube clips
Here's a VB6 version. Internet Explorer must be installed, because it uses DoFileDownload to download the video.
Re: Downloading Youtube clips
Quote:
Originally Posted by killer7k
thank you!!! for share this code:)
Re: Downloading Youtube clips
Quote:
Originally Posted by dynamic_sysop
i put this together, it's best to run it in another thread ( Backgroundworker ) otherwise the app will sit there locked out until the download has done.
i tested it on a few vids.
Code:
'/// ENTER THE URL THAT YOU WOULD WATCH THE VID ON IN BROWSER ...
Dim request As HttpWebRequest = DirectCast(HttpWebRequest.Create("http://www.youtube.com/watch?v=FJaAe7sYoCA"), HttpWebRequest)
Dim response As HttpWebResponse = DirectCast(request.GetResponse, HttpWebResponse)
Dim source As String = New StreamReader(response.GetResponseStream, System.Text.Encoding.Default).ReadToEnd
If source.IndexOf("video_id=") > -1 Then
Dim url As String = System.Text.RegularExpressions.Regex.Split(source, "video_id=")(1)
url = "http://www.youtube.com/get_video?video_id=" & System.Text.RegularExpressions.Regex.Split(url, "&title=")(0)
Dim wc As New WebClient
wc.DownloadFile(url, "C:\FJaAe7sYoCA.flv")
End If
response.Close()
might start you off. :)
thanks man it works great