Skip to content

Instantly share code, notes, and snippets.

@Domin8-IPTV
Last active September 28, 2020 01:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Domin8-IPTV/a8bbb7a277599b20c0fb61931434a7cc to your computer and use it in GitHub Desktop.
Save Domin8-IPTV/a8bbb7a277599b20c0fb61931434a7cc to your computer and use it in GitHub Desktop.
GET LIVE SOURCE FEED FROM YOUTUBE AND FACEBOOK LIVE STREAMS
<?PHP
/*
YOUTUBE AND FACEBOOK LIVE STREAM SNATCHING
MADE BY M4UNDY
*/
$channelid = $_GET["watch?v"];
ini_set("user_agent","facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)");
function get_data($url) {
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_USERAGENT, "facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)");
curl_setopt($ch, CURLOPT_REFERER, "http://facebook.com");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
$string = get_data('https://www.youtube.com/watch?v=' . $channelid);
preg_match_all('/(hlsvp.*m3u8)/',$string,$matches, PREG_PATTERN_ORDER);
$var1=$matches[1][0];
$var1 = substr($var1, 8);
$var1=str_replace("\/", "/", $var1);
$man = get_data($var1);
preg_match_all('/(https:\/.*\/95\/.*index.m3u8)/U',$man,$matches, PREG_PATTERN_ORDER);
$var2=$matches[1][0];
header("Content-type: application/vnd.apple.mpegurl");
header("Location: $var2");
?>
@Domin8-IPTV
Copy link
Author

Place script in public directory on machine add as follows:

YOUTUBE LIVE STREAM:
Sky News Live: https://www.youtube.com/watch?v=y60wDzZt8yg

ADD TO YOUR PANEL LIKE THIS
http://127.0.0.1/youtube.php?watch?v=y60wDzZt8yg

SO YOU ARE CALLING THE SCRIPT + THE WATCH ID FROM THE FEED
http://127.0.0.1/youtube.php? + watch?v=y60wDzZt8yg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment