mirror of
https://git.sr.ht/~cadence/NewLeaf
synced 2024-11-21 23:27:29 +00:00
Fetch pages using en locale
This commit is contained in:
parent
861f441f9f
commit
87c7730fbc
@ -18,7 +18,7 @@ def extract_channel(ucid):
|
|||||||
return channel_cache[ucid]
|
return channel_cache[ucid]
|
||||||
|
|
||||||
channel_type = "channel" if len(ucid) == 24 and ucid[:2] == "UC" else "user"
|
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()
|
r.raise_for_status()
|
||||||
yt_initial_data = extract_yt_initial_data(r.content.decode("utf8"))
|
yt_initial_data = extract_yt_initial_data(r.content.decode("utf8"))
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ ytdl = youtube_dl.YoutubeDL(ytdl_opts)
|
|||||||
|
|
||||||
def extract_search(q):
|
def extract_search(q):
|
||||||
try:
|
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()
|
r.raise_for_status()
|
||||||
content = r.content.decode("utf8")
|
content = r.content.decode("utf8")
|
||||||
yt_initial_data = extract_yt_initial_data(content)
|
yt_initial_data = extract_yt_initial_data(content)
|
||||||
|
Loading…
Reference in New Issue
Block a user