~cadence/tube-devel

NewLeaf: Fix ytInitialData extraction with new EU tracking consent cookie v2 APPLIED

~lomanic: 1
 Fix ytInitialData extraction with new EU tracking consent cookie

 1 files changed, 1 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/43986/mbox | git am -3
Learn more about email & git

[PATCH NewLeaf v2] Fix ytInitialData extraction with new EU tracking consent cookie Export this patch

From: Lomanic <lomanic@hotmail.fr>

Related yt-dlp fix: https://github.com/yt-dlp/yt-dlp/pull/7774
---
 tools/extractors.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/extractors.py b/tools/extractors.py
index fd518cb..d4b1ee5 100644
--- a/tools/extractors.py
+++ b/tools/extractors.py
@@ -1,6 +1,5 @@
import re
import json
import random
from functools import reduce

r_yt_initial_data = re.compile(r"""(?:^\s*window\["ytInitialData"\]|var ytInitialData) = (\{.+?\});(?:\s*$|</script>)""", re.S + re.M)
@@ -30,7 +29,7 @@ def extract_yt_cfg(content):
	raise Exception("Could not match ytcfg in content")

def eu_consent_cookie():
	return {"CONSENT": "YES+cb.20210509-17-p0.en+F+{}".format(random.randint(100, 999))}
	return {"SOCS": "CAI"}

def is_in(o, key):
	if isinstance(o, list):
-- 
2.38.5