[ 1, 24], 2 => [ 25, 48], 3 => [ 49, 72], 4 => [ 73, 96], 5 => [ 97, 120], 6 => [121, 144], 7 => [145, 161], 8 => [162, 175], 9 => [176, 191], 10 => [192, 210], 11 => [211, 227], 12 => [228, 245], 13 => [246, 263], 14 => [264, 281], 15 => [282, 300], ]; header("Server: Harold"); header("X-Server: Harold"); header("X-Powered-By: Duct Tape"); if ($_SERVER["REQUEST_URI"] === "/movie") { header("Cache-Control: no-transform, public, max-age=86400, must-revalidate"); header("Location: https://www.amazon.com/gp/product/B00008R9KR/"); exit(); } $episode_num = 0; $matches = []; preg_match("/^\\/(([0-9]+)|[sS]?([0-9]+)[^0-9a-zA-Z]?[eE]?([0-9]+))([\\/?]([^?&]*))?([?&](.*))?$/", $_SERVER["REQUEST_URI"], $matches); if (count($matches)) { header("Cache-Control: no-transform, public, max-age=86400, must-revalidate"); header("Access-Control-Allow-Origin: *"); } if (count($matches) > 4 && !empty($matches[3])) { $season_num = (int) $matches[3]; if ($season_num >= 1 && $season_num <= 15) { $season_episode = (int) $matches[4]; $episode_num_test = $season_episode + SEASON_RANGES[$season_num][0] - 1; if ($season_episode >= 1 && $episode_num_test <= SEASON_RANGES[$season_num][1]) { $episode_num = $episode_num_test; } } } else if (count($matches) > 2 && !empty($matches[2])) { $episode_num = (int) $matches[2]; } if ($episode_num >= 1 && $episode_num <= 300) { if (($f = fopen("episodes.txt", "rb")) !== false) { fgetcsv($f, 0, "|"); // column headings while (($episode_data = fgetcsv($f, 0, "|")) !== false) { $episode_num_test = (int) $episode_data[0]; if ($episode_num_test === $episode_num) { $season_num = (int) $episode_data[1]; $season_episode = (int) $episode_data[2]; $youtube_uri = $episode_data[3]; $name = $episode_data[4]; $summary = str_replace("\\n", " ", $episode_data[5]); break; } } fclose($f); $mode = (count($matches) > 6) ? $matches[6] : ""; if (empty($mode) || $mode === "json") { if ($mode !== "json") { header("Location: $youtube_uri"); header_remove("Access-Control-Allow-Origin"); } header("Content-Type: application/json; charset=utf-8"); echo json_encode([ "episode" => $episode_num, "season-number" => $season_num, "season-episode" => $season_episode, "youtube-uri" => $youtube_uri, "name" => $name, "summary" => $summary, ], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE)."\n"; exit(); } } } $is_404 = $_SERVER["REQUEST_URI"] !== "/"; $is_hep = $_SERVER["REQUEST_URI"] === "/hep"; $title = "Red"; $title .= " Green"; $title .= " Episode Redirector"; if ($is_404) { http_response_code(404); if ($is_hep) { $title = "It's not a silent L."; //} else { // $title = "404 Not Found"; } } ob_start(); ?> <?= strip_tags($title) ?>

Hep! Hep! I'm covered in sahlder! ... Eh, nobody comes.

—Red Green, https:///102#t=387s

Usage:

Examples:

Source code:

(https:\/\/[^<]+){$matches[1]}<"; } else { return $matches[0]; } }, $help_html);