From 3897e6e36a926eebd46968b2fa3304d1068c1c6b Mon Sep 17 00:00:00 2001 From: daniel Date: Thu, 17 Oct 2019 14:48:51 -0300 Subject: [PATCH] https://github.com/YouPHPTube/YouPHPTube/issues/2114 Adding webp support Command line to get all videos webp images --- install/getAllWebp.php | 77 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 install/getAllWebp.php diff --git a/install/getAllWebp.php b/install/getAllWebp.php new file mode 100644 index 0000000000..2d907854a2 --- /dev/null +++ b/install/getAllWebp.php @@ -0,0 +1,77 @@ +getEncoderURL() . "getImageMP4/" . base64_encode($url) . "/webp/{$duration}"; + $image = url_get_contents($url); + file_put_contents($destination, $image); + } + }else{ + echo "\nVideo URL empty"; + } + + echo "\nGet done"; + }else{ + echo "\nFile exists: ".$value['title']; + } + + echo "\nFinish: ".$value['title']; + echo "\n******\n"; +} + +function getFirstVideoURL($videoFileName) { + $types = array('', '_Low', '_SD', '_HD'); + $videosList = getVideosURL($videoFileName); + if (!empty($videosList['m3u8']["url"])) { + return $videosList['m3u8']["url"]; + } + foreach ($types as $value) { + if (!empty($videosList['mp4' . $value]["url"])) { + return $videosList['mp4' . $value]["url"]; + } else if (!empty($videosList['webm' . $value]["url"])) { + return $videosList['webm' . $value]["url"]; + } + } + return false; +} + +function getFirstVideoPath($videoFileName) { + $types = array('', '_Low', '_SD', '_HD'); + $videosList = getVideosURL($videoFileName); + if (!empty($videosList['m3u8']["path"])) { + return $videosList['m3u8']["path"]; + } + foreach ($types as $value) { + if (!empty($videosList['mp4' . $value]["path"])) { + return $videosList['mp4' . $value]["path"]; + } else if (!empty($videosList['webm' . $value]["path"])) { + return $videosList['webm' . $value]["path"]; + } + } + return false; +}