Skip to content

Instantly share code, notes, and snippets.

@malikkurosaki
Created March 11, 2018 03:06
Show Gist options
  • Save malikkurosaki/56861c964d9616375f1980e7dfceeb0e to your computer and use it in GitHub Desktop.
Save malikkurosaki/56861c964d9616375f1980e7dfceeb0e to your computer and use it in GitHub Desktop.
get video id and search video id to get video source link of youtube video
<?php
/*
name : download youtube video
author : malik kurosaki
contact : wa 081338929722
description : after get id (video from yotube url) direct to get link of video source than save it to serveer
use file_put_contents
*/
if(isset($_GET['dl'])){
$id = $_GET['dl'];
$title = str_replace("/"," ",$_GET['t']);
$info = file_get_contents("https://www.youtube.com/get_video_info?video_id=".$id."&cpn=CouQulsSRICzWn5E&eurl&el=adunit");
parse_str($info,$sp);
$rr = explode(",",$sp['url_encoded_fmt_stream_map']);
parse_str($rr[0],$ss);
if(file_put_contents("source/video.mp4",fopen($ss['url'],'r'))){
echo 1;
}else{
echo 0;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment