mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-23 13:16:51 +01:00
parent
b43bd86485
commit
cc88a54bb1
@ -49,9 +49,9 @@ class ADNBaseIE(InfoExtractor):
|
|||||||
|
|
||||||
|
|
||||||
class ADNIE(ADNBaseIE):
|
class ADNIE(ADNBaseIE):
|
||||||
_VALID_URL = r'https?://(?:www\.)?(?:animation|anime)digitalnetwork\.com/(?:(?P<lang>de)/)?video/[^/?#]+/(?P<id>\d+)'
|
_VALID_URL = r'https?://(?:www\.)?animationdigitalnetwork\.com/(?:(?P<lang>de)/)?video/[^/?#]+/(?P<id>\d+)'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://animationdigitalnetwork.com/video/fruits-basket/9841-episode-1-a-ce-soir',
|
'url': 'https://animationdigitalnetwork.com/video/558-fruits-basket/9841-episode-1-a-ce-soir',
|
||||||
'md5': '1c9ef066ceb302c86f80c2b371615261',
|
'md5': '1c9ef066ceb302c86f80c2b371615261',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '9841',
|
'id': '9841',
|
||||||
@ -71,10 +71,7 @@ class ADNIE(ADNBaseIE):
|
|||||||
},
|
},
|
||||||
'skip': 'Only available in French and German speaking Europe',
|
'skip': 'Only available in French and German speaking Europe',
|
||||||
}, {
|
}, {
|
||||||
'url': 'http://animedigitalnetwork.com/video/blue-exorcist-kyoto-saga/7778-episode-1-debut-des-hostilites',
|
'url': 'https://animationdigitalnetwork.com/de/video/973-the-eminence-in-shadow/23550-folge-1',
|
||||||
'only_matching': True,
|
|
||||||
}, {
|
|
||||||
'url': 'https://animationdigitalnetwork.com/de/video/the-eminence-in-shadow/23550-folge-1',
|
|
||||||
'md5': '5c5651bf5791fa6fcd7906012b9d94e8',
|
'md5': '5c5651bf5791fa6fcd7906012b9d94e8',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '23550',
|
'id': '23550',
|
||||||
@ -167,7 +164,7 @@ def _perform_login(self, username, password):
|
|||||||
'username': username,
|
'username': username,
|
||||||
})) or {}).get('accessToken')
|
})) or {}).get('accessToken')
|
||||||
if access_token:
|
if access_token:
|
||||||
self._HEADERS = {'authorization': 'Bearer ' + access_token}
|
self._HEADERS['Authorization'] = f'Bearer {access_token}'
|
||||||
except ExtractorError as e:
|
except ExtractorError as e:
|
||||||
message = None
|
message = None
|
||||||
if isinstance(e.cause, HTTPError) and e.cause.status == 401:
|
if isinstance(e.cause, HTTPError) and e.cause.status == 401:
|
||||||
@ -178,6 +175,7 @@ def _perform_login(self, username, password):
|
|||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
lang, video_id = self._match_valid_url(url).group('lang', 'id')
|
lang, video_id = self._match_valid_url(url).group('lang', 'id')
|
||||||
|
self._HEADERS['X-Target-Distribution'] = lang or 'fr'
|
||||||
video_base_url = self._PLAYER_BASE_URL + f'video/{video_id}/'
|
video_base_url = self._PLAYER_BASE_URL + f'video/{video_id}/'
|
||||||
player = self._download_json(
|
player = self._download_json(
|
||||||
video_base_url + 'configuration', video_id,
|
video_base_url + 'configuration', video_id,
|
||||||
@ -218,7 +216,6 @@ def _real_extract(self, url):
|
|||||||
links_data = self._download_json(
|
links_data = self._download_json(
|
||||||
links_url, video_id, 'Downloading links JSON metadata', headers={
|
links_url, video_id, 'Downloading links JSON metadata', headers={
|
||||||
'X-Player-Token': authorization,
|
'X-Player-Token': authorization,
|
||||||
'X-Target-Distribution': lang or 'fr',
|
|
||||||
**self._HEADERS,
|
**self._HEADERS,
|
||||||
}, query={
|
}, query={
|
||||||
'freeWithAds': 'true',
|
'freeWithAds': 'true',
|
||||||
@ -257,6 +254,7 @@ def _real_extract(self, url):
|
|||||||
load_balancer_data = self._download_json(
|
load_balancer_data = self._download_json(
|
||||||
load_balancer_url, video_id,
|
load_balancer_url, video_id,
|
||||||
f'Downloading {format_id} {quality} JSON metadata',
|
f'Downloading {format_id} {quality} JSON metadata',
|
||||||
|
headers=self._HEADERS,
|
||||||
fatal=False) or {}
|
fatal=False) or {}
|
||||||
m3u8_url = load_balancer_data.get('location')
|
m3u8_url = load_balancer_data.get('location')
|
||||||
if not m3u8_url:
|
if not m3u8_url:
|
||||||
@ -277,7 +275,7 @@ def _real_extract(self, url):
|
|||||||
|
|
||||||
video = (self._download_json(
|
video = (self._download_json(
|
||||||
self._API_BASE_URL + f'video/{video_id}', video_id,
|
self._API_BASE_URL + f'video/{video_id}', video_id,
|
||||||
'Downloading additional video metadata', fatal=False) or {}).get('video') or {}
|
'Downloading additional video metadata', fatal=False, headers=self._HEADERS) or {}).get('video') or {}
|
||||||
show = video.get('show') or {}
|
show = video.get('show') or {}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -299,9 +297,9 @@ def _real_extract(self, url):
|
|||||||
|
|
||||||
|
|
||||||
class ADNSeasonIE(ADNBaseIE):
|
class ADNSeasonIE(ADNBaseIE):
|
||||||
_VALID_URL = r'https?://(?:www\.)?(?:animation|anime)digitalnetwork\.com/(?:(?P<lang>de)/)?video/(?P<id>[^/?#]+)/?(?:$|[#?])'
|
_VALID_URL = r'https?://(?:www\.)?animationdigitalnetwork\.com/(?:(?P<lang>de)/)?video/(?P<id>\d+)[^/?#]*/?(?:$|[#?])'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://animationdigitalnetwork.com/video/tokyo-mew-mew-new',
|
'url': 'https://animationdigitalnetwork.com/video/911-tokyo-mew-mew-new',
|
||||||
'playlist_count': 12,
|
'playlist_count': 12,
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '911',
|
'id': '911',
|
||||||
@ -312,16 +310,14 @@ class ADNSeasonIE(ADNBaseIE):
|
|||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
lang, video_show_slug = self._match_valid_url(url).group('lang', 'id')
|
lang, video_show_slug = self._match_valid_url(url).group('lang', 'id')
|
||||||
|
self._HEADERS['X-Target-Distribution'] = lang or 'fr'
|
||||||
show = self._download_json(
|
show = self._download_json(
|
||||||
f'{self._API_BASE_URL}show/{video_show_slug}/', video_show_slug,
|
f'{self._API_BASE_URL}show/{video_show_slug}/', video_show_slug,
|
||||||
'Downloading show JSON metadata', headers=self._HEADERS)['show']
|
'Downloading show JSON metadata', headers=self._HEADERS)['show']
|
||||||
show_id = str(show['id'])
|
show_id = str(show['id'])
|
||||||
episodes = self._download_json(
|
episodes = self._download_json(
|
||||||
f'{self._API_BASE_URL}video/show/{show_id}', video_show_slug,
|
f'{self._API_BASE_URL}video/show/{show_id}', video_show_slug,
|
||||||
'Downloading episode list', headers={
|
'Downloading episode list', headers=self._HEADERS, query={
|
||||||
'X-Target-Distribution': lang or 'fr',
|
|
||||||
**self._HEADERS,
|
|
||||||
}, query={
|
|
||||||
'order': 'asc',
|
'order': 'asc',
|
||||||
'limit': '-1',
|
'limit': '-1',
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user