1
0
Fork 0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-11-16 21:15:40 +00:00

Added funimation show playlist extractor

This commit is contained in:
Nasir 2021-05-03 00:04:43 -07:00
parent a0df8a0617
commit b91377b6d7
2 changed files with 54 additions and 2 deletions

View file

@ -418,7 +418,10 @@ from .frontendmasters import (
FrontendMastersCourseIE
)
from .fujitv import FujiTVFODPlus7IE
from .funimation import FunimationIE
from .funimation import (
FunimationIE,
FunimationShowPlaylistIE
)
from .funk import FunkIE
from .fusion import FusionIE
from .gaia import GaiaIE

View file

@ -11,7 +11,8 @@ from ..utils import (
int_or_none,
js_to_json,
ExtractorError,
urlencode_postdata
urlencode_postdata,
urljoin
)
@ -152,3 +153,51 @@ class FunimationIE(InfoExtractor):
'season_id': title_data.get('seriesId'),
'formats': formats,
}
class FunimationShowPlaylistIE(FunimationIE):
IE_NAME = 'funimation:playlist'
_VALID_URL = r'https?://(?:www\.)?funimation(?:\.com|now\.uk)/[a-z]{2}/shows/(?P<id>[^/?#&]+)'
_TESTS = [{
'url': 'https://www.funimation.com/en/shows/hacksign/',
'info_dict': {
'id': 90646,
'title': '.hack//SIGN'
},
'playlist_count': 28,
'params': {
'skip_download': True,
},
}]
def _real_extract(self, url):
display_id = self._match_id(url)
webpage = self._download_webpage(url, display_id)
title_data = self._parse_json(self._search_regex(
r'TITLE_DATA\s*=\s*({[^}]+})',
webpage, 'title data', default=''),
display_id, js_to_json, fatal=False) or {}
items = self._download_json(
'https://prod-api-funimationnow.dadcdigital.com/api/funimation/episodes/?limit=99999&title_id=%s'
% title_data.get('id'), display_id).get('items')
vod_items = list(map(lambda k:
(k.get('mostRecentSvod') or k.get('mostRecentAvod'))
.get('item'), items))
vod_items = sorted(vod_items, key=lambda k: k.get('episodeOrder'))
entries = []
for vod_item in vod_items:
entries.append(
self.url_result(urljoin(url, vod_item.get('episodeSlug')),
'Funimation', vod_item.get('episodeId'),
vod_item.get('episodeSlug')))
return {
'_type': 'playlist',
'id': title_data.get('id'),
'title': title_data.get('title'),
'entries': entries,
}