mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-13 19:01:24 +01:00
Compare commits
3 Commits
4d35d50fab
...
02ef914317
Author | SHA1 | Date | |
---|---|---|---|
|
02ef914317 | ||
|
1876abf98a | ||
|
5042a7412a |
|
@ -176,29 +176,21 @@ Format: Marked,Start,End,Style,Name,MarginL,MarginR,MarginV,Effect,Text'''
|
|||
|
||||
def _real_extract(self, url):
|
||||
lang, video_id = self._match_valid_url(url).group('lang', 'id')
|
||||
username, password = self._get_login_info()
|
||||
# ADN requires login for German site (at least for now)
|
||||
if lang == 'de' and (not username or not password):
|
||||
self.raise_login_required(method='password')
|
||||
|
||||
video_base_url = self._PLAYER_BASE_URL + 'video/%s/' % video_id
|
||||
player = self._download_json(
|
||||
video_base_url + 'configuration', video_id,
|
||||
'Downloading player config JSON metadata',
|
||||
headers=self._HEADERS)['player']
|
||||
options = player['options']
|
||||
|
||||
subscription_msg = 'This video requires a subscription'
|
||||
# Ad supported videos are not yet available in German
|
||||
if lang == 'de' and 'ads' in options:
|
||||
raise ExtractorError(subscription_msg, expected=True)
|
||||
video = options['video']
|
||||
startDate = video.get('startDate')
|
||||
currentDate = video.get('currentDate')
|
||||
if startDate and currentDate and startDate > currentDate:
|
||||
raise ExtractorError(f'This video is not available yet. Release date: {startDate}', expected=True)
|
||||
|
||||
user = options['user']
|
||||
if not user.get('hasAccess'):
|
||||
if username and password:
|
||||
raise ExtractorError(subscription_msg, expected=True)
|
||||
|
||||
self.raise_login_required(method='password')
|
||||
self.raise_login_required('This video requires a subscription', method='password')
|
||||
|
||||
token = self._download_json(
|
||||
user.get('refreshTokenUrl') or (self._PLAYER_BASE_URL + 'refresh/token'),
|
||||
|
@ -280,6 +272,9 @@ Format: Marked,Start,End,Style,Name,MarginL,MarginR,MarginV,Effect,Text'''
|
|||
f['language'] = 'de'
|
||||
formats.extend(m3u8_formats)
|
||||
|
||||
if not formats:
|
||||
self.raise_login_required('This video requires a subscription', method='password')
|
||||
|
||||
video = (self._download_json(
|
||||
self._API_BASE_URL + 'video/%s' % video_id, video_id,
|
||||
'Downloading additional video metadata', fatal=False) or {}).get('video') or {}
|
||||
|
|
Loading…
Reference in New Issue
Block a user