NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

<?php
error_reporting(E_ERROR | E_PARSE);
include_once 'BS_Token.php';
function readString($string, $findStart, $findEnd)
{
$start = stripos($string, $findStart);
if ($start === false)
return false;
$length = strlen($findStart);
$end = stripos(substr($string, $start + $length), $findEnd);
if ($end !== false) {
$rs = substr($string, $start + $length, $end);
} else {
$rs = substr($string, $start + $length);
}
if ($rs) {
$rs = trim($rs);
return $rs;
} else {
return false;
}
}
function itagMap($itag)
{
$itag = (int)$itag;
switch ($itag) {
case 17:
$quality = 360;
$type = "3gpp";
break;
case 36:
$quality = 480;
$type = "3gpp";
break;
case 5:
$quality = 240;
$type = "flv";
break;
case 34:
$quality = 360;
$type = "flv";
break;
case 35:
$quality = 480;
$type = "flv";
break;
case 18:
$quality = 360;
$type = "mp4";
break;
case 59:
$quality = 480;
$type = "mp4";
break;
case 22:
$quality = 720;
$type = "mp4";
break;
case 37:
$quality = 1080; //1920 x 1080
$type = "mp4";
break;
case 38:
$quality = 1080; //2048 x 1080
$type = "mp4";
break;
case 43:
$quality = 360;
$type = "webm";
break;
case 44:
$quality = 480;
$type = "webm";
break;
case 45:
$quality = 720;
$type = "webm";
break;
case 46:
$quality = 1080;
$type = "webm";
break;
default:
$quality = 0;
$type = "";
break;
}

return array("quality" => $quality, "type" => $type);
}
class BS_Getlink extends BS_Token
{
public function picasaweb_google_com($link, $sub='', $title='') {

preg_match('/https://picasaweb.google.com/(.*)/(.*)#(.+?)/U', $link, $id);
if($id) {

$s = explode('?', $id[2]);
if($s[1])
$albumUrl = 'https://picasaweb.google.com/data/entry/tiny/user/'.$id[1].'/photoid/'.$id[3].'?'.$s[1];
else
$albumUrl = 'https://picasaweb.google.com/data/entry/tiny/user/'.$id[1].'/photoid/'.$id[3];

if(isset($_SESSION['gg_token']) && $_SESSION['gg_token'])
$get = $this->curl($albumUrl, $_SESSION['gg_token']);
else
$get = $this->curl($albumUrl, '');


$mimes = array('image/jpeg', 'image/png', 'image/gif');
preg_match_all("/<media:content url='(.*)' height='(.*)' width='(.*)' type='(.*)'/>/U", $get, $data);

$sources = array();
foreach($data[2] as $i => $quality)
{
if((strpos($data[1][$i], 'm18') || strpos($data[1][$i], 'redirector') and !in_array($data[1][$i], $mimes)))
$sources[] = array('file' => $data[1][$i], 'type' => 'mp4', 'label' => '360p', 'default' => true);
if((strpos($data[1][$i], 'm22') || strpos($data[1][$i], 'redirector')) and !in_array($data[1][$i], $mimes))
$sources[] = array('file' => $data[1][$i], 'type' => 'mp4', 'label' => '720p');
if((strpos($data[1][$i], 'm32') || strpos($data[1][$i], 'm37') || strpos($data[1][$i], 'redirector')) and !in_array($data[1][$i], $mimes))
$sources[] = array('file' => $data[1][$i], 'type' => 'mp4', 'label' => '1080p');
}

if($sources)
return json_encode(array('playlist' => array('0' => array("sources" => $sources, 'title' => $title, 'image' => $data[1][0], "tracks" => $sub))));
return $this->youtube_com('https://www.youtube.com/watch?v=tpV5O5D0rl8', $sub, $title);

} else {

$url = urldecode($link);
if(stristr($url, '#')) list($url, $id) = explode('#', $url);

if(isset($_SESSION['gg_token']) && $_SESSION['gg_token'])
$get = $this->curl($url, $_SESSION['gg_token']);
else
$get = $this->curl($url, '');

if($id) $gach = explode($id, $get);
$gach = explode('{"url":"', ($id)?$gach[7]:$get);
$thumb = explode('"', $gach[1]);

$sources = array();
for($i=2; $i<5; $i++) {

$data = urldecode(reset(explode('"', $gach[$i])));
if(strpos($data, '=m18'))
$sources[] = array('file' => $data, 'type' => 'mp4', 'label' => '360p', 'default' => true);
if(strpos($data, '=m22'))
$sources[] = array('file' => $data, 'type' => 'mp4', 'label' => '720p');
if(strpos($data, '=m32') || strpos($data, '=m37'))
$sources[] = array('file' => $data, 'type' => 'mp4', 'label' => '1080p');
}

if($sources)
return json_encode(array('playlist' => array('0' => array("sources" => $sources, 'title' => $title, 'image' => $thumb, "tracks" => $sub))));
return $this->youtube_com('https://www.youtube.com/watch?v=tpV5O5D0rl8', $sub, $title);
}
}

public function drive_google_com($link, $sub='', $title='') {

preg_match('#https://drive.google.com/file/d/(.*)/(.+?)#', $link, $id);

$link = 'https://api.blogit.vn/getlink.php?link='.$link.$id;

if(isset($_SESSION['gg_token']) && $_SESSION['gg_token'])
$get = $this->curl($link, $_SESSION['gg_token']);
else
$get = $this->curl($link, '');

/*$url_encoded_fmt_stream_map = $itag = $url = '';

parse_str($get);

$data = explode(',',$url_encoded_fmt_stream_map);

$sources = array();
foreach($data as $i => $format) {

parse_str($format);
$linkMp4 = preg_replace("//[^/]+.googlevideo.com/", "/redirector.googlevideo.com", urldecode($url));
if($itag == '18')
$sources[] = array('file' => $linkMp4, 'type' => 'mp4', 'label' => '360p', 'default' => true);
if($itag == '59')
$sources[] = array('file' => $linkMp4, 'type' => 'mp4', 'label' => '480p');
if($itag == '22')
$sources[] = array('file' => $linkMp4, 'type' => 'mp4', 'label' => '720p');
if($itag == '37')
$sources[] = array('file' => $linkMp4, 'type' => 'mp4', 'label' => '1080p');

$i++;
}*/

$fmt_stream_map = readString($get, 'fmt_stream_map=', '&');
$title = readString($get, 'title=', '&');
$urls = explode(',', urldecode($fmt_stream_map));
foreach ($urls as $i => $u) {
list($itag, $link) = explode('|', $u);
$infoItag = itagMap($itag);
$var[$i]['label'] = $infoItag['quality'];
$var[$i]['type'] = $infoItag['type'];
$var[$i]['file'] = urldecode(preg_replace(["/[^/]+.googlevideo.com/", "/ipbits=d{2}/"], ["https://redirector.googlevideo.com", 'ipbits=0'], $link));
}

if($var)
return json_encode(array('playlist' => array('0' => array("sources" => $var, 'title' => $title, 'image' => '', "tracks" => $sub))));
return $this->youtube_com('https://www.youtube.com/watch?v=tpV5O5D0rl8', $sub, $title);

}

public function photos_google_com($link, $sub='', $title='') {

$get = $this->curl($link, '');

$data = explode('","url', $get);
$data = explode(']', $data[1]);
$data = urldecode($data[0]);

$data = str_replace(array('u003d', 'u0026'), array('=', '&'), 'url'.$data);

preg_match_all('/url=(.*)&itag=/U', $data, $datas);

$sources = array();
foreach($datas[1] as $i => $link) {

if(strpos($link, '=m18'))
$sources[] = array('file' => $link, 'type' => 'mp4', 'label' => '360p', 'default' => true);
if(strpos($link, '=m22'))
$sources[] = array('file' => $link, 'type' => 'mp4', 'label' => '720p');
if(strpos($link, '=m32') || strpos($link, '=m37'))
$sources[] = array('file' => $link, 'type' => 'mp4', 'label' => '1080p');
}

$thumb = explode('=', $datas[1][0]);

if($sources)
return json_encode(array('playlist' => array('0' => array("sources" => $sources, 'title' => $title, 'image' => $thumb[0], "tracks" => $sub))));
return $this->youtube_com('https://www.youtube.com/watch?v=tpV5O5D0rl8', $sub, $title);
}

public function youtube_com($link, $sub='', $title='') {

$id = explode('?v=', $link);

$links = 'http://www.youtube.com/get_video_info?&video_id='.$id[1];

if(isset($_SESSION['gg_token']) && $_SESSION['gg_token'])
$get = $this->curl($links, $_SESSION['gg_token']);
else
$get = $this->curl($links, '');

$url_encoded_fmt_stream_map = $itag = $url = '';

parse_str($get);

$data = explode(',',$url_encoded_fmt_stream_map);

krsort($data);

$sources = array();
foreach($data as $i => $format) {

parse_str($format);
$linkMp4 = preg_replace(array("//[^/]+.googlevideo.com/", "//[^/]+.youtube.com/"), "/redirector.googlevideo.com", urldecode($url));
if($itag == '18')
$sources[] = array('file' => $linkMp4, 'type' => 'mp4', 'label' => '360p', 'default' => true);
if($itag == '59')
$sources[] = array('file' => $linkMp4, 'type' => 'mp4', 'label' => '480p');
if($itag == '22')
$sources[] = array('file' => $linkMp4, 'type' => 'mp4', 'label' => '720p');
if($itag == '37')
$sources[] = array('file' => $linkMp4, 'type' => 'mp4', 'label' => '1080p');

$i++;
}

if($sources)
return json_encode(array('playlist' => array('0' => array("sources" => $sources, 'title' => $title, 'image' => '', "tracks" => $sub))));
return $this->youtube_com('https://www.youtube.com/watch?v=tpV5O5D0rl8', $sub, $title);
}

public function lh3_googleusercontent_com($link, $sub='', $title='') {

$thumb = explode('=m', $link);

return json_encode(array('playlist' => array('0' => array("sources" => array('file' => $link, 'type' => 'mp4'), 'title' => $title, 'image' => $thumb[0], "tracks" => $sub))));
}

private function curl($url, $key='') {

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if($key) curl_setopt($ch, CURLOPT_HEADER, true);
if($key) curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Bearer '.$key));
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.