From d713053baee597d2f40d61a46c581233d79109e1 Mon Sep 17 00:00:00 2001 From: Martin Puppe Date: Tue, 30 Jan 2024 14:35:21 +0100 Subject: [PATCH] Fix metadata fetching for YouTube URLs YouTube responds with a redirect if it thinks that the user agent is too old. This commit changes the user agent string to that of a current version of Firefox. See also https://github.com/shaarli/Shaarli/issues/531#issuecomment-1902784175. --- application/http/HttpUtils.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/http/HttpUtils.php b/application/http/HttpUtils.php index a63b1fb45..c6904f492 100644 --- a/application/http/HttpUtils.php +++ b/application/http/HttpUtils.php @@ -52,8 +52,8 @@ function get_http_response( } $userAgent = - 'Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:45.0)' - . ' Gecko/20100101 Firefox/45.0'; + 'Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:115.0)' + . ' Gecko/20100101 Firefox/115.0'; $acceptLanguage = substr(get_locale(LC_COLLATE), 0, 2) . ',en-US;q=0.7,en;q=0.3'; $maxRedirs = 3;