From f7045b862a5b7c3de8ee2ea3da67616b38a667cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Eduardo?= Date: Sun, 6 Aug 2017 20:43:24 -0500 Subject: first commit --- processor.php | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 processor.php (limited to 'processor.php') diff --git a/processor.php b/processor.php new file mode 100644 index 0000000..a8ac45e --- /dev/null +++ b/processor.php @@ -0,0 +1,55 @@ +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); + -- cgit v1.2.3