Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ie/adn] require subscriptions in German #9068

Merged
merged 7 commits into from Jan 28, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 14 additions & 1 deletion yt_dlp/extractor/adn.py
Expand Up @@ -176,16 +176,29 @@ def _perform_login(self, username, password):

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
bashonly marked this conversation as resolved.
Show resolved Hide resolved
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)

user = options['user']
bashonly marked this conversation as resolved.
Show resolved Hide resolved
if not user.get('hasAccess'):
self.raise_login_required()
if username and password:
raise ExtractorError(subscription_msg, expected=True)

self.raise_login_required(method='password')
bashonly marked this conversation as resolved.
Show resolved Hide resolved

token = self._download_json(
user.get('refreshTokenUrl') or (self._PLAYER_BASE_URL + 'refresh/token'),
Expand Down