blob: ec5107e1ab363b9c07545681121e9ff29617a4f4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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;
|