Closed dfang closed 11 years ago
yes you can by using -g or --get-url as the parameter. For example:
youtube-dl -g www.youtube.com/watch?v=a15KgyXBX24
On Thu, May 2, 2013 at 3:07 PM, dfang notifications@github.com wrote:
Can i just extract youtube video download url but not download ?
Thanks !
— Reply to this email directly or view it on GitHubhttps://github.com/rg3/youtube-dl/issues/816 .
thanks yasoob , it works ! however the url is different from the results from 10youtube.com , i mean even the first part (http://r6---sn-o097zne7.c.youtube.com/ vs http://r6---sn-a5m7znez.c.youtube.com, when i paste the url to browser , one is directly downable , one is for streaming) is different , and there are so many parameters , which parameters are required to download the video ? where can i find the documentation about all the parameters ? i know by extracting the video_info file , i can get the urls , but the url is not downloadable .
Thanks !
you can not use it like that. because youtube requires some headers which are not there in the requests you make with your browser so you can only use youtube-dl to download youtube videos because it sets up these headers for you or if you want to reinvent the wheel you can make your own script.
On Thu, May 2, 2013 at 6:58 PM, dfang notifications@github.com wrote:
thanks yasoob , it works ! however the url is different from the results from 10youtube.com , i mean even the first part ( http://r6---sn-o097zne7.c.youtube.com/ vs http://r6---sn-a5m7znez.c.youtube.com, when i paste the url to browser , one is directly downable , one is for streaming) is different , and there are so many parameters , which parameters are required to download the video ? where can i find the documentation about all the parameters ? i know by extracting the video_info file , i can get the urls , but the url is not downloadable .
Thanks !
— Reply to this email directly or view it on GitHubhttps://github.com/rg3/youtube-dl/issues/816#issuecomment-17339295 .
The above explanation was according to my knowledge and the difference in the url is there because youtube has different servers for different areas and so these servers have different urls........:) I hope this helps. If you want to discuss further then i ll suggest you to pm me. You can get my email from my github profile.
On Thu, May 2, 2013 at 7:48 PM, Yasoob Khalid yasoobkhld@gmail.com wrote:
you can not use it like that. because youtube requires some headers which are not there in the requests you make with your browser so you can only use youtube-dl to download youtube videos because it sets up these headers for you or if you want to reinvent the wheel you can make your own script.
On Thu, May 2, 2013 at 6:58 PM, dfang notifications@github.com wrote:
thanks yasoob , it works ! however the url is different from the results from 10youtube.com , i mean even the first part ( http://r6---sn-o097zne7.c.youtube.com/ vs http://r6---sn-a5m7znez.c.youtube.com, when i paste the url to browser , one is directly downable , one is for streaming) is different , and there are so many parameters , which parameters are required to download the video ? where can i find the documentation about all the parameters ? i know by extracting the video_info file , i can get the urls , but the url is not downloadable .
Thanks !
— Reply to this email directly or view it on GitHubhttps://github.com/rg3/youtube-dl/issues/816#issuecomment-17339295 .
As @yasoob pointed out, youtube uses (its internal) CDN, and the domain name depends on your locale, timing, and youtube's configuration. The URL will be the correct one for whatever arguments (mainly --format
) you pass into youtube-dl. The download request must also regularly come from the same IP, and with the same cookie, although youtube sometimes relaxes that requirement - for example, any IPv6 address usually works if the original extraction happened over IPv6.
I'm not sure why you don't let youtube-dl download the video in the first place. Can you elaborate why? In any case, I'm closing this issue for now, but feel free to comment if the current explanations are not sufficient.
Hi @phihag : I am a little late to this discussion. I am trying to grab the download url of a video using -g option. Then I want to use third party download accelerators for faster downloading. For example, axel download youtube videos with 3MBps (when given proper download link) while youtube-dl use only <200KBps. So I want to get correct download link from youtube-dl, but as mentioned before, link given by youtube-dl is only for streaming. I can't download it. Is there any option to get the correct download-ready link?
Please provide a sample.
@juancri :
Original youtube link:
http://www.youtube.com/watch?v=McLq1hEq3UY&list=PL3D9A62846A129C47&index=1
It works with axel.
Axel throws an error: HTTP/1.1 403 Forbidden
@abidrahmank The problem seems to be that the url extracted with youtube-dl uses https
(other downloaders like curl or aria2c download it fine). You can get http
urls using the --prefer-insecure
option, but I would personally avoid using it, I would use a downloader that support https
urls.
@jaimeMF : Thank you.. that works.
Hello guys, Sorry for late coming.
My issue is the filename of video downloaded from url fetched from youtube-dl -g
when i try to download this. it gives me a file like videoplayback.mp4
what i need is a file whose name is not videoplayback but the video title.
Any suggestions?
@AdnanHussainTurki
`<?php $url = 'https://youtube.com/watch?v='.$_GET['v'].'';
$cmd =' youtube-dl -g -f36 ' . escapeshellarg($url); exec($cmd, $outputsd);
$results = print_r($outputsd[0], true); $pat = '/^(https:\/\/)[a-zA-Z0-9-.]+.googlevideo.com\//'; $results1 = preg_replace($pat, 'https://redirector.googlevideo.com/', $results); $cmd2 =' youtube-dl -g -f18 ' . escapeshellarg($url); exec($cmd2, $outputss);
$results2 = print_r($outputss[0], true); $results3 = preg_replace($pat, 'https://redirector.googlevideo.com/', $results2);
$cmd3 =' youtube-dl -g -f22 ' . escapeshellarg($url); exec($cmd3, $outputsss); $results4 = print_r($outputsss[0], true); $results5 = preg_replace($pat, 'https://redirector.googlevideo.com/', $results4);
$cmd4 =' youtube-dl -g -f17 ' . escapeshellarg($url); exec($cmd4, $outputssss);
$name =' youtube-dl -e ' . escapeshellarg($url);
exec($name, $outputs);
echo 'Download 3gp 176x144p
Download MP4 320x240p
Download MP4 640x360p
Download MP4 HD720p
';
?>`
@praburamWAPKA Thanks a lot, brother. It worked.
@praburamWAPKA On analysing that replacement, I came to know this only works for 720p video + audio type video.
you need to encode url and set filename well its similar to project https://github.com/jeckman/YouTube-Downloader you will get it :)
@AdnanHussainTurki Add title query param at the end of the link.
@praburamWAPKA
`<?php $url = 'https://youtube.com/watch?v='.$_GET['v'].'';
$cmd =' youtube-dl -g -f36 ' . escapeshellarg($url); exec($cmd, $outputsd);
$results = print_r($outputsd[0], true); $pat = '/^(https://)[a-zA-Z0-9-.]+.googlevideo.com//'; $results1 = preg_replace($pat, 'https://redirector.googlevideo.com/', $results); $cmd2 =' youtube-dl -g -f18 ' . escapeshellarg($url); exec($cmd2, $outputss);
$results2 = print_r($outputss[0], true); $results3 = preg_replace($pat, 'https://redirector.googlevideo.com/', $results2);
$cmd3 =' youtube-dl -g -f22 ' . escapeshellarg($url); exec($cmd3, $outputsss); $results4 = print_r($outputsss[0], true); $results5 = preg_replace($pat, 'https://redirector.googlevideo.com/', $results4);
$cmd4 =' youtube-dl -g -f17 ' . escapeshellarg($url); exec($cmd4, $outputssss);
$name =' youtube-dl -e ' . escapeshellarg($url); exec($name, $outputs); echo 'Download 3gp 176x144p
Download MP4 320x240p Download MP4 640x360p Download MP4 HD720p
'; ?>`
can u fix this code pls its not working with me :(
@shaniax420 Make sure you have installed youtube-dl under /usr/local/bin this path
`<?php
header('Content-Disposition:filename="video.mp4"');
$url = 'https://youtube.com/watch?v='.$_GET['v'].'';
$cmds = ("/usr/local/bin/youtube-dl -g -f22 $url 2>&1 ") ; exec($cmds,$out);
$link_720=print_r($out[1],true);
$cmdss = ("/usr/local/bin/youtube-dl -g -f18 $url 2>&1 ") ; exec($cmdss,$outt);
$link_360=print_r($outt[1],true);
$cmdsss = ("/usr/local/bin/youtube-dl -g -f36 $url 2>&1 ") ; exec($cmdsss,$outtt);
$link_240=print_r($outtt[1],true);
$cmdssss = ("/usr/local/bin/youtube-dl -g -f140 $url 2>&1 ") ; exec($cmdssss,$outttt);
$link_mp3=print_r($outttt[1],true);
$name =' /usr/local/bin/youtube-dl -e ' . escapeshellarg($url); exec($name, $outputs);
echo '
echo '
echo '
echo '
`
@praburamWAPKA
Happy to see your reaply but your code i cant see perfect Already installed in /usr/local/bin getting error on my website http://prntscr.com/odw18j your code look like this http://prntscr.com/odw1df
can you pls add your code in this website https://pastebin.com/ :)
Hi @praburamWAPKA Can you help me? Actually I am getting 0 byte Txt file for some downloads ,The link is working perfect but its gives me 0 bytes . Here is my code.
router.get('/download', function(req, res){
var url = req.query.url;
var filename = req.query.filename;
filename=encodeURIComponent(filename);
https.get(url, function(response) {
console.log(url);
filename = filename.split('%20').join('_');
res.setHeader('Content-disposition', 'attachment; filename='+filename);
response.pipe(res);
})
https://pastebin.com/LcLZz5rr @shaniax420
@MSZ991 use this https://github.com/jeckman/YouTube-Downloader to generate links.... Don't forget to enable Ciphered Option on Config file(default.php) under Config folder
@praburamWAPKA Thank you so much bro :) <3
Vevo & Tseries videos 720x240 not working
Using this way but no sound 720 any way to get link 720 with Sound Vevo Videos
<?php
header('Content-Disposition:filename="video.mp4"');
$url = 'https://youtube.com/watch?v='.$_GET['v'].'';
$cmdss = ("/usr/local/bin/youtube-dl -g $url 2>&1 ") ; exec($cmdss,$outt);
$link_720=print_r($outt[1],true);
?>
Hi, I found that -g
give me
https://r4---sn-a5meknes.googlevideo.com/videoplayback?expire=1579700257&ei=wfsnXorED5HKgQPQjaHADQ&ip=172.105.229.224&id=o-AI2gi9Nsn68-C2ClEc8Z5EdPdCvJthJ7t-We8bF3toqx&itag=137&aitags=133%2C134%2C135%2C136%2C137%2C160%2C242%2C243%2C244%2C247%2C248%2C278&source=youtube&requiressl=yes&mm=31%2C29&mn=sn-a5meknes%2Csn-a5mlrnes&ms=au%2Crdu&mv=m&mvi=3&pl=22&initcwndbps=381250&vprv=1&mime=video%2Fmp4&gir=yes&clen=23014401&dur=213.099&lmt=1535971690686753&mt=1579678577&fvip=4&keepalive=yes&fexp=23842630&beids=9466586&c=WEB&sparams=expire%2Cei%2Cip%2Cid%2Caitags%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=ALgxI2wwRQIhAM4sjkHurzTp14DWGwTOSvJxMr91MjArcfHrACecgWLsAiBfZ-HdHiAetCn0ZlSMjOJPL-aal2KKSiaGit7qcbxnPg%3D%3D&lsparams=mm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AHylml4wRgIhAMGnVZmITNZ-N-FBURKT9nbWn_Y973_sLE7lGonC31eKAiEA-D67Kb1ZzBVA90EvOQXp7IzHdJU9rPObkIqvVkHNhFM%3D&ratebypass=yes
but what I really want is the url of the video such as
https://www.youtube.com/watch?v=7E-cwdnsiow
how can I solve it?
Thanks
@scut-salmon Don’t you give that URL as input? You should already have it. Or am I misunderstanding your question?
Hello guys, Sorry for late coming.
My issue is the filename of video downloaded from url fetched from youtube-dl -g
when i try to download this. it gives me a file like videoplayback.mp4
what i need is a file whose name is not videoplayback but the video title.
Any suggestions?
The default switch gives video without audio, to get them together use -f22
LIKE this (this uses the forked project):
yt-dlp -g https://www.youtube.com/watch?v=M7Ew_zube4M -f22
which gives:
https://rr1---sn-8vq54voxxb-j5pk.googlevideo.com/videoplayback?expire=1688220907&ei=i-CfZI-MDc7OW5uLpIAL&ip=196.221.209.152&id=o-AMLSskzxMejmSAc9ACcwfgnexMDnuY17P3nuf4DmDVQp&itag=22&source=youtube&requiressl=yes&mh=HF&mm=31%2C29&mn=sn-8vq54voxxb-j5pk%2Csn-hpa7znz6&ms=au%2Crdu&mv=m&mvi=1&pl=24&initcwndbps=336250&spc=Ul2Sq_eYXZXW5O1tyj2zxyRLgSdEeL4&vprv=1&svpuc=1&mime=video%2Fmp4&cnr=14&ratebypass=yes&dur=253.283&lmt=1688154968175300&mt=1688198957&fvip=2&fexp=24007246%2C51000022&beids=24350017&c=ANDROID&txp=5532434&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cspc%2Cvprv%2Csvpuc%2Cmime%2Ccnr%2Cratebypass%2Cdur%2Clmt&sig=AOq0QJ8wRQIhAOqLg-bXyGmQpPwdbjOpwPEr_GeqPg1RSioxMsxvE26rAiBMgeRyL1sayFB4UlsbauQ7BFhGAtzic5ygSH8A2zOsig%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRAIgR-ZtCYY3IGkUTH9g-aWkoEyzgErXqJ2YQJ-104RikWICIHw61RpjEGTXLCOlQuHUoAMwPBNEjceVtneY8Tfcw8TY
Using this way but no sound 720 any way to get link 720 with Sound Vevo Videos
header('Content-Disposition:filename="video.mp4"'); $url = 'https://youtube.com/watch?v='.$_GET['v'].''; $cmdss = ("/usr/local/bin/youtube-dl -g $url 2>&1 ") ; exec($cmdss,$outt); $link_720=print_r($outt[1],true); ?>
use -f22 and the screenshot for work: The -f22 info is: 22 mp4 1280x640 30 2 │ ≈ 11.37MiB 368k https │ avc1.64001F mp4a.40.2 44k [en] 720p
Can i just extract youtube video download url but not download ?
Thanks !