Fetch pages using en locale

This commit is contained in:
Cadence Ember 2020-10-25 18:02:05 +13:00
parent 861f441f9f
commit 87c7730fbc
No known key found for this signature in database
GPG Key ID: BC1C2C61CF521B17
2 changed files with 2 additions and 2 deletions

View File

@ -18,7 +18,7 @@ def extract_channel(ucid):
return channel_cache[ucid]
channel_type = "channel" if len(ucid) == 24 and ucid[:2] == "UC" else "user"
with requests.get("https://www.youtube.com/{}/{}/videos".format(channel_type, ucid)) as r:
with requests.get("https://www.youtube.com/{}/{}/videos?hl=en".format(channel_type, ucid)) as r:
r.raise_for_status()
yt_initial_data = extract_yt_initial_data(r.content.decode("utf8"))

View File

@ -17,7 +17,7 @@ ytdl = youtube_dl.YoutubeDL(ytdl_opts)
def extract_search(q):
try:
with requests.get("https://www.youtube.com/results", params={"q": q}) as r:
with requests.get("https://www.youtube.com/results", params={"q": q, "hl": "en"}) as r:
r.raise_for_status()
content = r.content.decode("utf8")
yt_initial_data = extract_yt_initial_data(content)