diff options
author | Minteck <contact@minteck.org> | 2021-12-05 16:38:49 +0100 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2021-12-05 16:38:49 +0100 |
commit | 879a6237b186768356f99caf992f0d25d5ec8612 (patch) | |
tree | 733aacd4845e918b484d8f46951d925f05f91b4c /yt.php | |
parent | 4bad8bcfb984cf017495b8fd31f174c32cebe805 (diff) | |
download | core-879a6237b186768356f99caf992f0d25d5ec8612.tar.gz core-879a6237b186768356f99caf992f0d25d5ec8612.tar.bz2 core-879a6237b186768356f99caf992f0d25d5ec8612.zip |
Commit
Diffstat (limited to 'yt.php')
-rw-r--r-- | yt.php | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -0,0 +1,27 @@ +<?php
+
+ini_set('max_execution_time', 300);
+ini_set('request_terminate_timeout', 300);
+require_once $_SERVER['DOCUMENT_ROOT'] . "/private/session.php";
+
+if (!isset($_GET['i'])) {
+ die();
+}
+
+if (strpos($_GET['i'], ".") !== false || strpos($_GET['i'], "/") !== false) {
+ die();
+}
+
+$film = $_GET['i'];
+$id = bin2hex(random_bytes(96));
+
+exec("bash -c \"rm -Rfvd /tmp/ytphp-*\"");
+mkdir("/tmp/ytphp-" . $id);
+exec("bash -c \"cd /tmp/ytphp-" . $id . " && yt-dlp -f 'bestaudio[ext=m4a]' -x -o 'audio.m4a' --audio-format m4a \\\"" . $film . "\\\"\"", $out);
+
+$fp = fopen("/tmp/ytphp-" . $id . "/audio.m4a", 'rb');
+header("Content-Type: " . mime_content_type("/tmp/ytphp-" . $id . "/audio.m4a"));
+header("Content-Length: " . filesize("/tmp/ytphp-" . $id . "/audio.m4a"));
+fpassthru($fp);
+exec("bash -c \"rm -Rfvd /tmp/ytphp-*\"");
+exit;
|