From 7c25c6a4703a31b320d6cfa69dfa7e1be5b9fdad Mon Sep 17 00:00:00 2001
From: Kelvin <kelvin@futo.org>
Date: Fri, 10 Nov 2023 20:22:00 +0100
Subject: [PATCH] Possible language fix

---
 YoutubeConfig.json | 2 +-
 YoutubeScript.js   | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/YoutubeConfig.json b/YoutubeConfig.json
index fc09719..fa3ac84 100644
--- a/YoutubeConfig.json
+++ b/YoutubeConfig.json
@@ -7,7 +7,7 @@
 	"sourceUrl": "https://plugins.grayjay.app/Youtube/YoutubeConfig.json",
 	"repositoryUrl": "https://futo.org",
 	"scriptUrl": "./YoutubeScript.js",
-	"version": 147,
+	"version": 148,
 	"iconUrl": "./youtube.png",
 	"id": "35ae969a-a7db-11ed-afa1-0242ac120002",
 
diff --git a/YoutubeScript.js b/YoutubeScript.js
index 7cc6557..e8b944a 100644
--- a/YoutubeScript.js
+++ b/YoutubeScript.js
@@ -323,6 +323,7 @@ source.getContentDetails = (url, useAuth) => {
 
 	const headersUsed = (useLogin) ? getAuthContextHeaders(false) : {};
 	headersUsed["Accept-Language"] = "en-US";
+	headersUsed["Cookie"] = "PREF=hl=en&gl=US"
 
 	const batch = http.batch().GET(url, headersUsed, useLogin);
 		
@@ -1747,10 +1748,11 @@ function requestPage(url, headers, useAuth = false) {
 	else throw new ScriptException("Failed to request page [" + resp.code + "]");
 }
 function requestInitialData(url, useMobile = false, useAuth = false) {
-	let headers = {"Accept-Language": "en-US" };
+	let headers = {"Accept-Language": "en-US", "Cookie": "PREF=hl=en&gl=US" };
 	if(useMobile)
 		headers["User-Agent"] = USER_AGENT_TABLET;
 
+
 	const resp = http.GET(url, headers, useAuth);
 	throwIfCaptcha(resp);
 	if(resp.isOk) {
-- 
GitLab