Skip to content

A feature-rich command-line audio/video downloader

[ie/adn] Add `profile_id` extractor-arg (#17522)

achee164eebe19a6
diff --git a/README.md b/README.md
index 989bdf0c75..d15d9a9682 100644
--- a/README.md
+++ b/README.md
@@ -1978,6 +1978,9 @@ The following extractors use this feature:
* `client`: Client to extract video data from. The currently available clients are `android` and `web`. Only one client can be used. The `web` client is used by default, and it only works with account cookies or login credentials. The `android` client only works with previously cached OAuth tokens
* `original_format_policy`: Policy for when to try extracting original formats. One of `always`, `never`, or `auto`. The default `auto` policy tries to avoid exceeding the web client's API rate-limit by only making an extra request when Vimeo publicizes the video's downloadability
+#### adn
+* `profile_id`: The numeric ID of the premium account profile that will be used to download videos (default: `1`)
+
#### zan
* `split_angles`: Split multi-angle streams into separate angle formats. Forces re-encoding of the video stream during download, and requires ffmpeg. Either `true` or `false` (default)
diff --git a/yt_dlp/extractor/adn.py b/yt_dlp/extractor/adn.py
index 7dff40556b..47b0a0b0f9 100644
--- a/yt_dlp/extractor/adn.py
+++ b/yt_dlp/extractor/adn.py
@@ -50,14 +50,13 @@ class ADNIE(ADNBaseIE):
_VALID_URL = r'https?://(?:www\.)?animationdigitalnetwork\.com/(?:(?P<lang>de)/)?video/[^/?#]+/(?P<id>\d+)'
_TESTS = [{
'url': 'https://animationdigitalnetwork.com/video/558-fruits-basket/9841-episode-1-a-ce-soir',
- 'md5': '1c9ef066ceb302c86f80c2b371615261',
+ 'md5': '3999b7b235ffb3591a385d1913cd3cd1',
'info_dict': {
'id': '9841',
'ext': 'mp4',
'title': 'Fruits Basket - Episode 1',
- 'description': 'md5:14be2f72c3c96809b0ca424b0097d336',
'series': 'Fruits Basket',
- 'duration': 1437,
+ 'duration': 1436,
'release_date': '20190405',
'comment_count': int,
'average_rating': float,
@@ -174,6 +173,8 @@ 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')
self._HEADERS['X-Target-Distribution'] = lang or 'fr'
+ if 'Authorization' in self._HEADERS:
+ self._HEADERS['X-Profile-ID'] = self._configuration_arg('profile_id', ['1'])[0]
video_base_url = self._PLAYER_BASE_URL + f'video/{video_id}/'
player = self._download_json(
video_base_url + 'configuration', video_id,