diff options
author | Minteck <contact@minteck.org> | 2023-02-23 19:34:56 +0100 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2023-02-23 19:34:56 +0100 |
commit | 3d1cd02f27518f1a04374c7c8320cd5d82ede6e9 (patch) | |
tree | 75be5fba4368472fb11c8015aee026b2b9a71888 /api/video.php | |
parent | 8cc1f13c17fa2fb5a4410542d39e650e02945634 (diff) | |
download | pluralconnect-3d1cd02f27518f1a04374c7c8320cd5d82ede6e9.tar.gz pluralconnect-3d1cd02f27518f1a04374c7c8320cd5d82ede6e9.tar.bz2 pluralconnect-3d1cd02f27518f1a04374c7c8320cd5d82ede6e9.zip |
Updated 40 files, added 37 files, deleted 1103 files and renamed 3905 files (automated)
Diffstat (limited to 'api/video.php')
-rw-r--r-- | api/video.php | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/api/video.php b/api/video.php deleted file mode 100644 index 21af642..0000000 --- a/api/video.php +++ /dev/null @@ -1,34 +0,0 @@ -<?php - -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn; -if (!$isLoggedIn) header("Location: /-/login") and die(); - -if (isset($_GET['id'])) { - header("Content-Type: application/json"); - $data = json_decode(exec("yt-dlp -q -x --no-playlist --skip-download --dump-json \"https://www.youtube.com/watch?v=" . str_replace('"', '\'', $_GET['id']) . "\""), true); - $qualities = array_values(array_filter(array_map(function ($i) { - return [ - "quality" => $i["height"], - "id" => $i['format_id'] - ]; - }, $data["formats"]), function ($i) { - return !is_null($i["quality"]); - })); - $hd = array_values(array_filter($qualities, function ($i) { - return $i["quality"] >= 720; - })); - $selected = count($hd) > 0 ? $hd[0] : $qualities[count($qualities) - 1]; - $stream = array_values(array_filter($data["formats"], function ($i) use ($selected) { - return $i["height"] === $selected["quality"] && $i["acodec"] !== null && $i["acodec"] !== "none"; - }))[0]; - - echo(json_encode([ - "title" => $data["fulltitle"], - "author" => $data["channel"], - "duration" => $data["duration"], - "stream" => $selected, - "url" => $stream["url"], - "duration_pretty" => $data["duration_string"], - "poster" => $data["thumbnail"], - ], JSON_PRETTY_PRINT)); -}
\ No newline at end of file |