Add channels.php
adding support for (file in) zip download
This commit is contained in:
parent
fda8fc728e
commit
b4cb072770
25
website/channels.php
Normal file
25
website/channels.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
function stripFirstLine($text)
|
||||
{
|
||||
return substr($text, strpos($text, "\n") + 1);
|
||||
}
|
||||
|
||||
if (!function_exists('str_contains')) {
|
||||
function str_contains($haystack, $needle)
|
||||
{
|
||||
return strpos($haystack, $needle) !== false;
|
||||
}
|
||||
}
|
||||
|
||||
$uri = $_SERVER['REQUEST_URI'];
|
||||
$uri = str_replace('/channels/', '', $uri);
|
||||
$uri = "/mnt/HDD0/YouTube_captions_search_engine/channels/$uri";
|
||||
if (str_contains('/', $uri)) {
|
||||
$uri = str_replace('/', '#', $uri);
|
||||
header('Content-Type: application/json; charset=UTF-8');
|
||||
echo file_get_contents("zip://$uri");
|
||||
} else {
|
||||
header("Content-Type: application/zip");
|
||||
echo readfile($uri);
|
||||
}
|
Loading…
Reference in New Issue
Block a user