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:
parent
18f5ef4c62
commit
7d3b79b1cd
3 changed files with 8 additions and 4 deletions
|
|
@ -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))}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue