Compare commits

..

No commits in common. "5f58b86d1289f3f106057af0df126a836742c6d9" and "224ded476176c4b9c652f4dc6baa7bf9f207625f" have entirely different histories.

View File

@ -239,7 +239,6 @@ class ARDBetaMediathekIE(InfoExtractor):
(?P<id>[a-zA-Z0-9]+)
/?(?:[?#]|$)'''
_GEO_COUNTRIES = ['DE']
_TOKEN_URL = 'https://sso.ardmediathek.de/sso/token'
_TESTS = [{
'url': 'https://www.ardmediathek.de/video/filme-im-mdr/liebe-auf-vier-pfoten/mdr-fernsehen/Y3JpZDovL21kci5kZS9zZW5kdW5nLzI4MjA0MC80MjIwOTEtNDAyNTM0',
@ -368,23 +367,21 @@ class ARDBetaMediathekIE(InfoExtractor):
}
headers = {}
if self._get_cookies(self._TOKEN_URL).get('ams'):
token = self._download_json(
self._TOKEN_URL, display_id, 'Fetching token for age verification',
'Unable to fetch age verification token', fatal=False)
id_token = traverse_obj(token, ('idToken', {str}))
user_id = traverse_obj(id_token, ({jwt_decode_hs256}, ('user_id', 'sub'), {str}), get_all=False)
if not id_token or not user_id:
self.report_warning('Unable to extract token, continuing without authentication')
ams_cookie = self._get_cookies("https://sso.ardmediathek.de/sso/token").get("ams")
if ams_cookie:
token = self._download_json('https://sso.ardmediathek.de/sso/token', display_id,
fatal=False, note='Getting token for age verification')
id_token = traverse_obj(token, 'idToken')
if not id_token:
self.report_warning('Unable to find id token, continuing without authentication')
else:
jwt_token_decoded = jwt_decode_hs256(id_token)
user_id = traverse_obj(jwt_token_decoded, 'user_id', 'sub')
headers['x-authorization'] = f'Bearer {id_token}'
query['userId'] = user_id
age_rating = traverse_obj(id_token, ({jwt_decode_hs256}, 'age_rating'), get_all=False)
if age_rating != 18:
self.report_warning(f'Authenticated age_rating is not 18, but "{age_rating}", '
'video might still be blocked')
page_data = self._download_json(
f'https://api.ardmediathek.de/page-gateway/pages/ard/item/{display_id}',
display_id, query=query, headers=headers)
@ -406,9 +403,9 @@ class ARDBetaMediathekIE(InfoExtractor):
media_data = traverse_obj(player_data, ('mediaCollection', 'embedded', {dict}))
if player_data.get('blockedByFsk'):
self.raise_login_required(
self.raise_no_formats(
'This video is only available after 22:00, '
'try passing cookies a verified account session to enable age verification ')
'try passing cookies to enable age verification ', expected=True)
formats = []
subtitles = {}