mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-13 18:51:03 +01:00
[youtube] Don't confirm age when initializing
It seems that all the videos with age restriction use now the age gate method, which doesn't require any confirmation.
This commit is contained in:
parent
8c810a7db3
commit
37ea8164d3
@ -39,7 +39,6 @@ class YoutubeBaseInfoExtractor(InfoExtractor):
|
|||||||
_LOGIN_URL = 'https://accounts.google.com/ServiceLogin'
|
_LOGIN_URL = 'https://accounts.google.com/ServiceLogin'
|
||||||
_TWOFACTOR_URL = 'https://accounts.google.com/SecondFactor'
|
_TWOFACTOR_URL = 'https://accounts.google.com/SecondFactor'
|
||||||
_LANG_URL = r'https://www.youtube.com/?hl=en&persist_hl=1&gl=US&persist_gl=1&opt_out_ackd=1'
|
_LANG_URL = r'https://www.youtube.com/?hl=en&persist_hl=1&gl=US&persist_gl=1&opt_out_ackd=1'
|
||||||
_AGE_URL = 'https://www.youtube.com/verify_age?next_url=/&gl=US&hl=en'
|
|
||||||
_NETRC_MACHINE = 'youtube'
|
_NETRC_MACHINE = 'youtube'
|
||||||
# If True it will raise an error if no login info is provided
|
# If True it will raise an error if no login info is provided
|
||||||
_LOGIN_REQUIRED = False
|
_LOGIN_REQUIRED = False
|
||||||
@ -176,21 +175,6 @@ def _login(self):
|
|||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _confirm_age(self):
|
|
||||||
age_form = {
|
|
||||||
'next_url': '/',
|
|
||||||
'action_confirm': 'Confirm',
|
|
||||||
}
|
|
||||||
req = compat_urllib_request.Request(
|
|
||||||
self._AGE_URL,
|
|
||||||
compat_urllib_parse.urlencode(age_form).encode('ascii')
|
|
||||||
)
|
|
||||||
|
|
||||||
self._download_webpage(
|
|
||||||
req, None,
|
|
||||||
note='Confirming age', errnote='Unable to confirm age',
|
|
||||||
fatal=False)
|
|
||||||
|
|
||||||
def _real_initialize(self):
|
def _real_initialize(self):
|
||||||
if self._downloader is None:
|
if self._downloader is None:
|
||||||
return
|
return
|
||||||
@ -199,7 +183,6 @@ def _real_initialize(self):
|
|||||||
return
|
return
|
||||||
if not self._login():
|
if not self._login():
|
||||||
return
|
return
|
||||||
self._confirm_age()
|
|
||||||
|
|
||||||
|
|
||||||
class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
|
class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
|
||||||
|
Loading…
Reference in New Issue
Block a user