parent
dd078970ba
commit
ec3f6640c1
2 changed files with 14 additions and 10 deletions
|
@ -1087,12 +1087,13 @@ class InfoExtractor(object):
|
||||||
|
|
||||||
# Methods for following #608
|
# Methods for following #608
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def url_result(url, ie=None, video_id=None, video_title=None):
|
def url_result(url, ie=None, video_id=None, video_title=None, **kwargs):
|
||||||
"""Returns a URL that points to a page that should be processed"""
|
"""Returns a URL that points to a page that should be processed"""
|
||||||
# TODO: ie should be the class used for getting the info
|
# TODO: ie should be the class used for getting the info
|
||||||
video_info = {'_type': 'url',
|
video_info = {'_type': 'url',
|
||||||
'url': url,
|
'url': url,
|
||||||
'ie_key': ie}
|
'ie_key': ie}
|
||||||
|
video_info.update(kwargs)
|
||||||
if video_id is not None:
|
if video_id is not None:
|
||||||
video_info['id'] = video_id
|
video_info['id'] = video_id
|
||||||
if video_title is not None:
|
if video_title is not None:
|
||||||
|
|
|
@ -686,20 +686,23 @@ class CrunchyrollShowPlaylistIE(CrunchyrollBaseIE):
|
||||||
headers=self.geo_verification_headers())
|
headers=self.geo_verification_headers())
|
||||||
title = self._html_search_meta('name', webpage, default=None)
|
title = self._html_search_meta('name', webpage, default=None)
|
||||||
|
|
||||||
episode_paths = re.findall(
|
episode_re = r'<li id="showview_videos_media_(\d+)"[^>]+>.*?<a href="([^"]+)"'
|
||||||
r'(?s)<li id="showview_videos_media_(\d+)"[^>]+>.*?<a href="([^"]+)"',
|
season_re = r'<a [^>]+season-dropdown[^>]+>([^<]+)'
|
||||||
webpage)
|
paths = re.findall(f'(?s){episode_re}|{season_re}', webpage)
|
||||||
entries = [
|
|
||||||
self.url_result('http://www.crunchyroll.com' + ep, 'Crunchyroll', ep_id)
|
entries, current_season = [], None
|
||||||
for ep_id, ep in episode_paths
|
for ep_id, ep, season in paths:
|
||||||
]
|
if season:
|
||||||
entries.reverse()
|
current_season = season
|
||||||
|
continue
|
||||||
|
entries.append(self.url_result(
|
||||||
|
f'http://www.crunchyroll.com{ep}', CrunchyrollIE.ie_key(), ep_id, season=current_season))
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'_type': 'playlist',
|
'_type': 'playlist',
|
||||||
'id': show_id,
|
'id': show_id,
|
||||||
'title': title,
|
'title': title,
|
||||||
'entries': entries,
|
'entries': reversed(entries),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue