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