mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-25 08:41:28 +01:00
Compare commits
No commits in common. "4585602504167d6d6549090f5bf04d8b6d66c2e1" and "4e278657c73b67a3a7f6fd14b51e99abddcee09b" have entirely different histories.
4585602504
...
4e278657c7
|
@ -47,7 +47,7 @@ from .acast import (
|
|||
ACastChannelIE,
|
||||
)
|
||||
from .acfun import AcFunVideoIE, AcFunBangumiIE
|
||||
from .adn import ADNIE, ADNSeasonIE
|
||||
from .adn import ADNIE
|
||||
from .adobeconnect import AdobeConnectIE
|
||||
from .adobetv import (
|
||||
AdobeTVEmbedIE,
|
||||
|
|
|
@ -25,31 +25,8 @@ from ..utils import (
|
|||
)
|
||||
|
||||
|
||||
class ADNBaseIE(InfoExtractor):
|
||||
class ADNIE(InfoExtractor):
|
||||
IE_DESC = 'Animation Digital Network'
|
||||
_NETRC_MACHINE = 'animationdigitalnetwork'
|
||||
_BASE = 'animationdigitalnetwork.fr'
|
||||
_API_BASE_URL = 'https://gw.api.' + _BASE + '/'
|
||||
_PLAYER_BASE_URL = _API_BASE_URL + 'player/'
|
||||
_HEADERS = {}
|
||||
_LOGIN_ERR_MESSAGE = 'Unable to log in'
|
||||
_RSA_KEY = (0x9B42B08905199A5CCE2026274399CA560ECB209EE9878A708B1C0812E1BB8CB5D1FB7441861147C1A1F2F3A0476DD63A9CAC20D3E983613346850AA6CB38F16DC7D720FD7D86FC6E5B3D5BBC72E14CD0BF9E869F2CEA2CCAD648F1DCE38F1FF916CEFB2D339B64AA0264372344BC775E265E8A852F88144AB0BD9AA06C1A4ABB, 65537)
|
||||
_POS_ALIGN_MAP = {
|
||||
'start': 1,
|
||||
'end': 3,
|
||||
}
|
||||
_LINE_ALIGN_MAP = {
|
||||
'middle': 8,
|
||||
'end': 4,
|
||||
}
|
||||
|
||||
def _get_distribution_language(self, url):
|
||||
if 'network.de' in url:
|
||||
return 'de'
|
||||
return 'fr'
|
||||
|
||||
|
||||
class ADNIE(ADNBaseIE):
|
||||
_VALID_URL = r'https?://(?:www\.)?(?:animation|anime)digitalnetwork\.(fr|de)/video/[^/]+/(?P<id>\d+)'
|
||||
_TESTS = [{
|
||||
'url': 'https://animationdigitalnetwork.fr/video/fruits-basket/9841-episode-1-a-ce-soir',
|
||||
|
@ -70,7 +47,7 @@ class ADNIE(ADNBaseIE):
|
|||
'thumbnail': str,
|
||||
'season': 'Season 1',
|
||||
},
|
||||
'skip': 'Only available in French end German speaking Europe',
|
||||
'skip': 'Only available in region (FR, ...)',
|
||||
}, {
|
||||
'url': 'http://animedigitalnetwork.fr/video/blue-exorcist-kyoto-saga/7778-episode-1-debut-des-hostilites',
|
||||
'only_matching': True,
|
||||
|
@ -82,9 +59,25 @@ class ADNIE(ADNBaseIE):
|
|||
'episode_number': 1,
|
||||
'duration': 1429,
|
||||
},
|
||||
# 'skip': 'Only available in French end German speaking Europe',
|
||||
# 'skip': 'Only available in DE, AT, CH, LU, LI',
|
||||
}]
|
||||
|
||||
_NETRC_MACHINE = 'animationdigitalnetwork'
|
||||
_BASE = 'animationdigitalnetwork.fr'
|
||||
_API_BASE_URL = 'https://gw.api.' + _BASE + '/'
|
||||
_PLAYER_BASE_URL = _API_BASE_URL + 'player/'
|
||||
_HEADERS = {}
|
||||
_LOGIN_ERR_MESSAGE = 'Unable to log in'
|
||||
_RSA_KEY = (0x9B42B08905199A5CCE2026274399CA560ECB209EE9878A708B1C0812E1BB8CB5D1FB7441861147C1A1F2F3A0476DD63A9CAC20D3E983613346850AA6CB38F16DC7D720FD7D86FC6E5B3D5BBC72E14CD0BF9E869F2CEA2CCAD648F1DCE38F1FF916CEFB2D339B64AA0264372344BC775E265E8A852F88144AB0BD9AA06C1A4ABB, 65537)
|
||||
_POS_ALIGN_MAP = {
|
||||
'start': 1,
|
||||
'end': 3,
|
||||
}
|
||||
_LINE_ALIGN_MAP = {
|
||||
'middle': 8,
|
||||
'end': 4,
|
||||
}
|
||||
|
||||
def _get_subtitles(self, sub_url, video_id):
|
||||
if not sub_url:
|
||||
return None
|
||||
|
@ -183,6 +176,7 @@ Format: Marked,Start,End,Style,Name,MarginL,MarginR,MarginV,Effect,Text'''
|
|||
user.get('refreshTokenUrl') or (self._PLAYER_BASE_URL + 'refresh/token'),
|
||||
video_id, 'Downloading access token', headers={
|
||||
'X-Player-Refresh-Token': user['refreshToken'],
|
||||
'X-Target-Distribution': ('de' if 'network.de' in url else 'fr')
|
||||
}, data=b'')['token']
|
||||
|
||||
links_url = try_get(options, lambda x: x['video']['url']) or (video_base_url + 'link')
|
||||
|
@ -205,7 +199,7 @@ Format: Marked,Start,End,Style,Name,MarginL,MarginR,MarginV,Effect,Text'''
|
|||
links_data = self._download_json(
|
||||
links_url, video_id, 'Downloading links JSON metadata', headers={
|
||||
'X-Player-Token': authorization,
|
||||
'X-Target-Distribution': self._get_distribution_language(url),
|
||||
'X-Target-Distribution': ('de' if 'network.de' in url else 'fr')
|
||||
}, query={
|
||||
'freeWithAds': 'true',
|
||||
'adaptive': 'false',
|
||||
|
@ -279,42 +273,3 @@ Format: Marked,Start,End,Style,Name,MarginL,MarginR,MarginV,Effect,Text'''
|
|||
'average_rating': float_or_none(video.get('rating') or metas.get('rating')),
|
||||
'comment_count': int_or_none(video.get('commentsCount')),
|
||||
}
|
||||
|
||||
|
||||
class ADNSeasonIE(ADNIE):
|
||||
_VALID_URL = r'https?://(?:www\.)?(?:animation|anime)digitalnetwork\.(fr|de)/video/(?P<id>[^/]+)/?$'
|
||||
_TESTS = [{
|
||||
'url': 'https://animationdigitalnetwork.fr/video/tokyo-mew-mew-new',
|
||||
'playlist_count': 12,
|
||||
'info_dict': {
|
||||
'id': 911,
|
||||
'title': 'Tokyo Mew Mew New',
|
||||
},
|
||||
# 'skip': 'Only available in French end German speaking Europe',
|
||||
}]
|
||||
|
||||
def _real_extract(self, url):
|
||||
video_show_slug = self._match_id(url)
|
||||
video_base_url = self._API_BASE_URL + 'show/%s/' % video_show_slug
|
||||
show = self._download_json(
|
||||
video_base_url, video_show_slug,
|
||||
'Downloading show JSON metadata',
|
||||
headers=self._HEADERS)['show']
|
||||
show_id = show['id']
|
||||
lang = self._get_distribution_language(url)
|
||||
episodes = self._download_json(
|
||||
self._API_BASE_URL + 'video/show/%s' % show_id, video_show_slug,
|
||||
'Downloading episode list', headers={
|
||||
'X-Target-Distribution': lang,
|
||||
}, query={
|
||||
'order': 'asc',
|
||||
'limit': '-1',
|
||||
})
|
||||
entries = []
|
||||
for episode in episodes['videos']:
|
||||
entries.append(self.url_result(
|
||||
'https://animationdigitalnetwork.%s/video/%s/%s' % (lang, video_show_slug, episode['id']),
|
||||
ie=ADNIE.ie_key(),
|
||||
video_id=episode['id']
|
||||
))
|
||||
return self.playlist_result(entries, show_id, show['title'])
|
||||
|
|
Loading…
Reference in New Issue
Block a user