/*
Made by [egyJs.com](https://www.instagram.com/egyjs/);
*/
install it on your localhost and try it :
/*
Made by [egyJs.com](https://www.instagram.com/egyjs/);
*/
install it on your localhost and try it :
<?php | |
/* | |
Made by [egyJs.com](https://www.instagram.com/egyjs/); | |
v2.0 | |
*/ | |
header('Access-Control-Allow-Origin: *'); | |
header('Content-Type: application/json'); | |
function get_error($ErrorExaction){ | |
$myObj = new stdClass(); | |
$myObj->error = true; | |
$myObj->msg = $ErrorExaction; | |
$myObj->madeBy = "A.El-zahaby"; | |
$myObj->instagram = "egy.js"; | |
$myJSON = json_encode($myObj,JSON_PRETTY_PRINT); | |
echo $myJSON; | |
exit; | |
} | |
function get_log($dump){ | |
if (isset($_GET['log'])) var_dump($dump).'\n\n\n'; | |
} | |
if(isset($_GET['url']) && $_GET['url'] != ""){ | |
parse_str( parse_url( $_GET['url'], PHP_URL_QUERY ), $vars ); | |
$id=$vars['v']; | |
$dt=file_get_contents("https://www.youtube.com/get_video_info?video_id=$id&el=embedded&ps=default&eurl=&gl=US&hl=en"); | |
if (strpos($dt, 'status=fail') !== false) { | |
$x=explode("&",$dt); | |
$t=array(); $g=array(); $h=array(); | |
foreach($x as $r){ | |
$c=explode("=",$r); | |
$n=$c[0]; $v=$c[1]; | |
$y=urldecode($v); | |
$t[$n]=$v; | |
} | |
$x=explode("&",$dt); | |
foreach($x as $r){ | |
$c=explode("=",$r); | |
$n=$c[0]; $v=$c[1]; | |
$h[$n]=urldecode($v); | |
} | |
$g[]=$h; | |
$g[0]['error'] = true; | |
$g[0]['instagram'] = "egy.js"; | |
$g[0]['apiMadeBy'] = 'El-zahaby'; | |
echo json_encode($g,JSON_PRETTY_PRINT); | |
}else{ | |
$x=explode("&",$dt); | |
$t=array(); $g=array(); $h=array(); | |
foreach($x as $r){ | |
$c=explode("=",$r); | |
$n=$c[0]; $v=$c[1]; | |
$y=urldecode($v); | |
$t[$n]=$v; | |
} | |
$streams = explode(',',urldecode($t['url_encoded_fmt_stream_map'])); | |
// if(empty($streams[0])){ get_error('ops! this video has something wrong! :( '); } | |
if(empty($streams[0])){ | |
get_log($streams); | |
} | |
foreach($streams as $dt){ | |
$x=explode("&",$dt); | |
foreach($x as $r){ | |
$c=explode("=",$r); | |
if ($c[0] == 'itag'){ // reference: https://superuser.com/q/1386658 | |
switch ($c[1]){ | |
case '18': | |
$h['mimeType'] = "mp4"; | |
$h['width'] = "640"; | |
$h['height'] = "360"; | |
$h['qualityLabel'] = '360p'; | |
break; | |
case '22': | |
$h['mimeType'] = "mp4"; | |
$h['width'] = "1280"; | |
$h['height'] = "720"; | |
$h['qualityLabel'] = '720p'; | |
break; | |
case '43': | |
$h['mimeType'] = "webm"; | |
$h['width'] = "640"; | |
$h['height'] = "360"; | |
$h['qualityLabel'] = '360p'; | |
break; | |
default: | |
$h['mimeType'] = null; | |
$h['width'] = null; | |
$h['height'] = null; | |
$h['qualityLabel'] = ''; | |
} | |
} | |
$n=$c[0]; /* => */ $v=$c[1]; | |
$h[$n]=urldecode($v); | |
} | |
$g[]=$h; | |
} | |
echo json_encode($g,JSON_PRETTY_PRINT); | |
// var_dump( $g[1]["quality"],true); | |
} | |
}else{ | |
get_error("Ops, there is no youtube link!"); | |
} |
Hi everyone.
I have an issue when get information of video.
With some videos, i received: "The uploader does not make this video available in your country."
How to resolve it ? Thanks everyone!
Fantastic tool!
I'm trying to load it using a developer tool that cannot run javascript..
Unfortunately I get errors..
How can I get the JSON output already being generated so I can GATHER it in a non javascript tool?
thank you!
Stephane
(I'm using http://youlink.epizy.com/?url=https://www.youtube.com/watch?v=[ID])
It's seems that the script is broken. @el3zahaby
i can not download anymore from youtube since today, there is an error "Undefined index: url_encoded_fmt_stream_map"
i can not download anymore from youtube since today, there is an error "Undefined index: url_encoded_fmt_stream_map"
I think the way this goes is youtube keeps patching this api from working and then OP fixes it... Not a really reliable system but not much you can do when you're using an API that breaks terms of service...
parse_str(file_get_contents("https://www.youtube.com/get_video_info?video_id=N-1IiYkrvgE&asv=3&el=detailpage&hl=en_US"),$info);
$streams = $info['player_response'];
$jsn_str=str_replace("\u0026","&",$streams);
$streamin_data_json=json_decode($jsn_str, true);
foreach ($streamin_data_json["streamingData"]["adaptiveFormats"] as $stream) {
parse_str($stream["cipher"],$dturl);
echo $dturl['url'].'
';
}
parse_str(file_get_contents("https://www.youtube.com/get_video_info?video_id=N-1IiYkrvgE&asv=3&el=detailpage&hl=en_US"),$info,$info));
$streams = $info['player_response'];
$jsn_str=str_replace("\u0026","&",$streams);
$streamin_data_json=json_decode($jsn_str, true);
foreach ($streamin_data_json["streamingData"]["adaptiveFormats"] as $stream) {parse_str($stream["cipher"],$dturl);
echo $dturl['url'].'
';
}
I think there's some param you need that can be found in the youtube video player. (Here's someone who completly reverse engineered this api (if you'd even call it that).)[https://tyrrrz.me/blog/reverse-engineering-youtube]. I think this is missing the sts param
, as it is called in his blog.
my code
https://gist.github.com/lhuxman-lhux/bade6474d6b4616d29594541a9e11888
this is really good work ,, i will fork it and improve it if you don't mind
oke, no problem
no audio i any video @lhuxman-lhux
first url,
first url,
i did not understand this
first url,
i did not understand this
I'm playing around with lhuxman-lhux's script and starting to figure it out... Not every itag is working in his code (he says it's still in development). The ones that are working for me are 299, 251, 313, 137, 248. You can see what those itags correspond to within his switch statement at the top of the script. There are more of them that work, but the ones I listed are for 1080p60, 1080p, 360p, and 4k.
Also, @lhuxman-lhux do you mind if I also fork this? This is really well made.
first url,
i did not understand this
I'm playing around with lhuxman-lhux's script and starting to figure it out... Not every itag is working in his code (he says it's still in development). The ones that are working for me are 299, 251, 313, 137, 248. You can see what those itags correspond to within his switch statement at the top of the script. There are more of them that work, but the ones I listed are for 1080p60, 1080p, 360p, and 4k.
Also, @lhuxman-lhux do you mind if I also fork this? This is really well made.
please contact me:
lhuxman19@gmail.com
Why I am getting no response.
Entered URL: http://youlink.epizy.com/?url=https://www.youtube.com/watch?v=QIKv7j0bTyM
Why I am getting no response.
Entered URL: http://youlink.epizy.com/?url=https://www.youtube.com/watch?v=QIKv7j0bTyM
Yeah the API doesn't seem to be working anymore... There arent any good alternatives I could find either...
So after all the research, I have done, I found a better solution and implemented and hosted it on Heroku...
Link: https://maadhav-ytdl.herokuapp.com/
Please let me know if any more features are needed. Thanks.
I hope it helps all others...
So after all the research, I have done, I found a better solution and implemented and hosted it on Heroku...
Link: https://maadhav-ytdl.herokuapp.com/
Please let me know if any more features are needed. Thanks.
I hope it helps all others...
This is really good, great work! Is it, by chance, open source? I may be able to add if the video has audio or not. I'd have to look at some old code of mine and see...
Edit: nevermind, seems like you got that already implemented. Might I suggest the "format" be an array just to make things easier?
Thanks! I have given the source code just below the title.
Anyway: https://github.com/Maadhav/youtube-downloader-API
Thanks! I have given the source code just below the title.
Anyway: https://github.com/Maadhav/youtube-downloader
Cool man! Big ups for making this.
@Maadhav
I just tried with the package you built.
$yt = new YouTubeDownloader();
$links = $yt->getDownloadLinks("https://www.youtube.com/watch?v=LJzCYSdrHMI");
var_dump($links); exit;
I am getting array(0) {}
as a result.
How can I get working url with above url ?
does this still work?
I love u <3 <3 u saved my life <3 its working
Thanks! I have given the source code just below the title.
Anyway: https://github.com/Maadhav/youtube-downloader-API
Great work man.. hopefully this remains working for a longer time.
I found an error when running on Repl.it:
[Tue Dec 15 22:14:00 2020] PHP Notice: Undefined index: url_encoded_fmt_stream_map in /home/runner/FreeYoutube/index.php on line 66 [Tue Dec 15 22:14:00 2020] PHP Notice: Undefined offset: 1 in /home/runner/FreeYoutube/index.php on line 102
@jazzy8 Can u send the repl.it public URL for the project u are trying to run?
I created a Javascript variant for anyone not wanting to rely on calling an external API, https://gist.github.com/JMV2112/f131f6d7c7782eb6e54c72f4da735ec0
this doesnt work
This no longer works 😞
This doesn't work for the following URL: https://www.youtube.com/watch?v=AwdRHqMLBTc (it returns an empty collection)
According to websites like keepvid the url should be: https://redirector.googlevideo.com/videoplayback?expire=1574590992&ei=sAXaXbOUOO7Zj-8Pv72h6AE&ip=198.8.91.30&id=o-APJeDvDbY1_zvWmVMoY0Ki7ibHmdmXvXPGCxAzXWlDBE&itag=22&source=youtube&requiressl=yes&mm=31%2C29&mn=sn-5uaeznrz%2Csn-5ualdn7r&ms=au%2Crdu&mv=m&mvi=0&pl=24&initcwndbps=473750&mime=video%2Fmp4&ratebypass=yes&dur=4151.333&lmt=1574559415747673&mt=1574569308&fvip=1&fexp=23842630&c=WEB&txp=4432432&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cmime%2Cratebypass%2Cdur%2Clmt&sig=ALgxI2wwRQIhAK4RKcEB5beRKWZ84xTdiKaKJVni2HtMa1_xkB4PoZtkAiBlDyUaMqPrMl2HPDazUlDIY0DZDM1uh8H_GnVYP9kIag%3D%3D&lsparams=mm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AHylml4wRgIhAKULGTx05lE4Xq3RufhbgNguNBJeY9oHbVXsJbnnk2P1AiEAv3v8IN3czvo5Kc3FXV17vhbN4V4M1EKgfplLb0pW-Tg%3D&title=Minecraft%20But%20It%27s%20Literally%20A%20Map%20Of%20Earth%20(Minecraft%20SMP%20Earth%20%231)