diff options
author | Jesús Eduardo <heckyel@hyperbola.info> | 2017-12-25 16:58:41 -0500 |
---|---|---|
committer | Jesús Eduardo <heckyel@hyperbola.info> | 2017-12-25 16:58:41 -0500 |
commit | 49d54c0c3199fb8e380ce68f8fb08a308ddf56a7 (patch) | |
tree | 87e9be319452d75241476853a3b240aabdcbd7e2 /processor.php | |
parent | 6a844225b3b63b89926e136cf65c140df01a4677 (diff) | |
download | ytlibre-49d54c0c3199fb8e380ce68f8fb08a308ddf56a7.tar.lz ytlibre-49d54c0c3199fb8e380ce68f8fb08a308ddf56a7.tar.xz ytlibre-49d54c0c3199fb8e380ce68f8fb08a308ddf56a7.zip |
migración mayor a smarty PHP
Diffstat (limited to 'processor.php')
-rw-r--r-- | processor.php | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/processor.php b/processor.php deleted file mode 100644 index 66b0c96..0000000 --- a/processor.php +++ /dev/null @@ -1,54 +0,0 @@ -<?php -require_once "init.php"; - -if (empty($_GET['link'])){ - header('Location: index.html'); -} - -$baselink = htmlspecialchars($_GET['link']); - -$yturl = 'youtu.be/'; - -if (strpos($baselink,$yturl) !== false){ - $link = preg_replace('~^https?://youtu\.be/([a-z\d]+)$~i', 'https://www.youtube.com/watch?v=$1', $baselink); -} else { - $link = $baselink; -} - -parse_str($link, $urlData); -$my_id = array_values($urlData)[0]; - -$videoFetchURL = "https://www.youtube.com/get_video_info?&video_id=" . $my_id . "&asv=3&el=detailpage&hl=en_US"; -$videoData = get($videoFetchURL); - -parse_str($videoData, $video_info); - -$video_info = json_decode(json_encode($video_info)); -if (!$video_info->status === "ok") { - die("error in fetching youtube video data"); -} -$videoTitle = $video_info->title; -$videoAuthor = $video_info->author; -$videoDurationSecs = $video_info->length_seconds; -$videoDuration = secToDuration($videoDurationSecs); -$videoViews = $video_info->view_count; - -//change hqdefault.jpg to default.jpg for downgrading the thumbnail quality -$videoThumbURL = "https://i1.ytimg.com/vi/{$my_id}/hqdefault.jpg"; -$librethumb = "https://i1.ytimg.com/vi/{$my_id}/maxresdefault.jpg"; - -if (!isset($video_info->url_encoded_fmt_stream_map)) { - die('No data found'); -} - -$streamFormats = explode(",", $video_info->url_encoded_fmt_stream_map); - -if (isset($video_info->adaptive_fmts)) { - $streamSFormats = explode(",", $video_info->adaptive_fmts); - $pStreams = parseStream($streamSFormats); -} - -$cStreams = parseStream($streamFormats); - -// Aquí selecciona solo 2 vídeos principales. -$videosStream = array_slice($cStreams, 0, 2); |