From aaf7d65b32ed60f9a16d60d04aed1c89ccdce39b Mon Sep 17 00:00:00 2001 From: bopol Date: Sat, 3 Apr 2021 06:37:51 +0200 Subject: [PATCH] change CONSENT cookie value FX is accept all tracking, PENDING should imply no tracking --- extractors/channel.py | 2 +- extractors/search.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/extractors/channel.py b/extractors/channel.py index 0270631..151d211 100644 --- a/extractors/channel.py +++ b/extractors/channel.py @@ -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?hl=en".format(channel_type, ucid), cookies={"CONSENT": "YES+cb.20210328-17-p0.en+FX+101"}) as r: + with requests.get("https://www.youtube.com/{}/{}/videos?hl=en".format(channel_type, ucid), cookies={"CONSENT": "PENDING+999"}) as r: r.raise_for_status() yt_initial_data = extract_yt_initial_data(r.content.decode("utf8")) diff --git a/extractors/search.py b/extractors/search.py index 64cf21c..aeb891c 100644 --- a/extractors/search.py +++ b/extractors/search.py @@ -17,7 +17,7 @@ ytdl = yt_dlp.YoutubeDL(ytdl_opts) def extract_search(q): try: - with requests.get("https://www.youtube.com/results", params={"q": q, "hl": "en"}, cookies={"CONSENT": "YES+cb.20210328-17-p0.en+FX+101"}) as r: + with requests.get("https://www.youtube.com/results", params={"q": q, "hl": "en"}, cookies={"CONSENT": "PENDING+999"}) as r: r.raise_for_status() content = r.content.decode("utf8") yt_initial_data = extract_yt_initial_data(content)