~cadence/tube-devel

change CONSENT cookie value v1 APPLIED

bopol
bopol: 1
 change CONSENT cookie value

 2 files changed, 2 insertions(+), 2 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~cadence/tube-devel/patches/21762/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH] change CONSENT cookie value Export this patch

bopol
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)
-- 
2.30.2