From 4993026781f500e6f8c27ac08c2943a9f49bd111 Mon Sep 17 00:00:00 2001 From: Delirious Date: Sat, 24 Feb 2024 18:06:17 -0700 Subject: [PATCH 1/3] Update image_proxy.php --- image_proxy.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/image_proxy.php b/image_proxy.php index 7eb62466..22ca3d07 100644 --- a/image_proxy.php +++ b/image_proxy.php @@ -6,7 +6,7 @@ $url = $_REQUEST["url"]; $requested_root_domain = get_root_domain($url); - $allowed_domains = array("s2.qwant.com", "s1.qwant.com", "upload.wikimedia.org", get_root_domain($config->invidious_instance_for_video_results)); + $allowed_domains = array("i.ytimg.com", "s2.qwant.com", "s1.qwant.com", "upload.wikimedia.org", get_root_domain($config->invidious_instance_for_video_results)); if (in_array($requested_root_domain, $allowed_domains)) { From c24807eb367ee676cc02612c7f9b92950da4b70a Mon Sep 17 00:00:00 2001 From: Delirious Date: Sat, 24 Feb 2024 18:34:10 -0700 Subject: [PATCH 2/3] Update video.php --- engines/invidious/video.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/invidious/video.php b/engines/invidious/video.php index 762ba6ee..4b74ff0c 100644 --- a/engines/invidious/video.php +++ b/engines/invidious/video.php @@ -9,9 +9,9 @@ public function get_request_url() { public function parse_results($response) { $results = array(); - $json_response = json_decode($response, true) ?? []; + $json_response = json_decode($response, true); - foreach ($json_response as $response) { + foreach ($json_response ?: [] as $response) { if ($response["type"] == "video") { $title = $response["title"]; $url = "https://youtube.com/watch?v=" . $response["videoId"]; @@ -49,7 +49,7 @@ public static function print_results($results, $opts) { $uploader = $result["uploader"] ?? ''; $views = $result["views"] ?? ''; $date = $result["date"] ?? ''; - $thumbnail = $result["thumbnail"] ?? ''; + $thumbnail = preg_replace('/(?:https?:\/\/)?(?:www\.)?youtube\.com\/watch\?v=([^\s]+)/', 'https://i.ytimg.com/vi/$1/maxresdefault.jpg', $url) ?? ''; echo "