1
0
Fork 0
mirror of https://git.sr.ht/~cadence/NewLeaf synced 2026-03-05 12:01:38 +00:00

Change cookies to skip EU cookie consent page

See https://github.com/benbusby/whoogle-search/issues/311 for some
context.
We're now implementing
a726009987/youtube_dl/extractor/youtube.py (L263-L264)
This commit is contained in:
Lomanic 2021-05-14 18:49:25 +02:00 committed by Cadence Ember
parent 18f5ef4c62
commit 7d3b79b1cd
No known key found for this signature in database
GPG key ID: BC1C2C61CF521B17
3 changed files with 8 additions and 4 deletions

View file

@ -1,5 +1,6 @@
import re
import json
import random
r_yt_initial_data = re.compile(r"""(?:^\s*window\["ytInitialData"\]|var ytInitialData) = (\{.+?\});(?:\s*$|</script>)""", re.S + re.M)
r_yt_initial_player_response = re.compile(r"""(?:^\s*window\["ytInitialPlayerResponse"\]|var ytInitialPlayerResponse) = (\{.+?\});(?:\s*$|</script>|var )""", re.S + re.M)
@ -19,3 +20,6 @@ def extract_yt_initial_player_response(content):
return yt_initial_player_response
else:
raise Exception("Could not match ytInitialPlayerResponse in content")
def eu_consent_cookie():
return {"CONSENT": "YES+cb.20210509-17-p0.en+F+{}".format(random.randint(100, 999))}