mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2026-06-30 06:34:27 +00:00
Compare commits
No commits in common. "21f0e600bfbe6fd63dd8add0ef6d08b865235d04" and "0d9d0e1d424325e628c1798afcdbc834591d2bc5" have entirely different histories.
21f0e600bf
...
0d9d0e1d42
@ -455,13 +455,15 @@ class YoutubeBaseInfoExtractor(InfoExtractor):
|
||||
def _initialize_consent(self):
|
||||
if self._has_auth_cookies:
|
||||
return
|
||||
socs = self._youtube_cookies.get('SOCS')
|
||||
cookies = self._youtube_cookies
|
||||
socs = cookies.get('SOCS')
|
||||
if socs and not socs.value.startswith('CAA'): # not consented
|
||||
return
|
||||
self._set_cookie('.youtube.com', 'SOCS', 'CAI', secure=True) # accept all (required for mixes)
|
||||
|
||||
def _initialize_pref(self):
|
||||
pref_cookie = self._youtube_cookies.get('PREF')
|
||||
cookies = self._youtube_cookies
|
||||
pref_cookie = cookies.get('PREF')
|
||||
pref = {}
|
||||
if pref_cookie:
|
||||
try:
|
||||
@ -472,9 +474,9 @@ class YoutubeBaseInfoExtractor(InfoExtractor):
|
||||
self._set_cookie('.youtube.com', name='PREF', value=urllib.parse.urlencode(pref))
|
||||
|
||||
def _initialize_cookie_auth(self):
|
||||
self._passed_auth_cookies = False
|
||||
self._had_cookie_auth = False
|
||||
if self._has_auth_cookies:
|
||||
self._passed_auth_cookies = True
|
||||
self._had_cookie_auth = True
|
||||
self.write_debug('Found YouTube account cookies')
|
||||
|
||||
def _real_initialize(self):
|
||||
@ -615,7 +617,7 @@ class YoutubeBaseInfoExtractor(InfoExtractor):
|
||||
response = super()._request_webpage(*args, **kwargs)
|
||||
|
||||
# Check that we are still logged-in and cookies have not rotated after every request
|
||||
if getattr(self, '_passed_auth_cookies', None) and not self._has_auth_cookies:
|
||||
if self._had_cookie_auth and not self._has_auth_cookies:
|
||||
self.report_warning(
|
||||
'The provided YouTube account cookies are no longer valid. '
|
||||
'They have likely been rotated in the browser as a security measure. '
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user