Compare commits

...

3 Commits

Author SHA1 Message Date
bashonly
02ef914317
minutia 2024-01-28 00:53:35 +00:00
Christopher Schreiner
1876abf98a
fix: handle missing format more generally
remove hardcoded special cases
2024-01-28 00:57:57 +01:00
Christopher Schreiner
5042a7412a
feat: check for future release date 2024-01-28 00:35:46 +01:00

View File

@ -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 {}