Created
March 7, 2018 10:11
-
-
Save malikkurosaki/6db376fc77dfd153ec45e1b06e630b43 to your computer and use it in GitHub Desktop.
download youtube video to server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
preg_match("/^(?:http(?:s)?:\/\/)?(?:www\.)?(?:m\.)?(?:youtu\.be\/|youtube\.com\/(?:(?:watch)?\?(?:.*&)?v(?:i)?=|(?:embed)\/))([^\?&\"'>]+)/","https://www.youtube.com/watch?v=W8drxRl1fiY",$gtlk); | |
//echo $gtlk[1]; | |
$fg = file_get_contents("https://www.youtube.com/get_video_info?video_id=".$gtlk[1]."&cpn=CouQulsSRICzWn5E&eurl&el=adunit"); | |
$xp = explode(",",$fg); | |
parse_str($xp[0],$rst); | |
$url = $rst['url_encoded_fmt_stream_map']; | |
parse_str($url,$hasil); | |
echo $judul = $rst['title']; //get title | |
echo "<br><hr>"; | |
echo $urlvid = $hasil['url']; // get url | |
file_put_contents($judul."satu.3gp",fopen($urlvid,'r')); | |
echo "sukses"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment