diff options
author | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-10-17 17:34:03 +0530 |
---|---|---|
committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-10-17 17:39:23 +0530 |
commit | ec3f6640c1a5391380ff7d47769fb710cf817638 (patch) | |
tree | b41fb7a9dd03daa0422d875600e6efffe7585efd /yt_dlp/extractor/crunchyroll.py | |
parent | dd078970ba1739cfd4fcc798a4b5026cb11c427a (diff) | |
download | hypervideo-pre-ec3f6640c1a5391380ff7d47769fb710cf817638.tar.lz hypervideo-pre-ec3f6640c1a5391380ff7d47769fb710cf817638.tar.xz hypervideo-pre-ec3f6640c1a5391380ff7d47769fb710cf817638.zip |
[crunchyroll] Add season to flat-playlist
Closes #1319
Diffstat (limited to 'yt_dlp/extractor/crunchyroll.py')
-rw-r--r-- | yt_dlp/extractor/crunchyroll.py | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/yt_dlp/extractor/crunchyroll.py b/yt_dlp/extractor/crunchyroll.py index fb05415fc..511ac1b2c 100644 --- a/yt_dlp/extractor/crunchyroll.py +++ b/yt_dlp/extractor/crunchyroll.py @@ -686,20 +686,23 @@ class CrunchyrollShowPlaylistIE(CrunchyrollBaseIE): headers=self.geo_verification_headers()) title = self._html_search_meta('name', webpage, default=None) - episode_paths = re.findall( - r'(?s)<li id="showview_videos_media_(\d+)"[^>]+>.*?<a href="([^"]+)"', - webpage) - entries = [ - self.url_result('http://www.crunchyroll.com' + ep, 'Crunchyroll', ep_id) - for ep_id, ep in episode_paths - ] - entries.reverse() + episode_re = r'<li id="showview_videos_media_(\d+)"[^>]+>.*?<a href="([^"]+)"' + season_re = r'<a [^>]+season-dropdown[^>]+>([^<]+)' + paths = re.findall(f'(?s){episode_re}|{season_re}', webpage) + + entries, current_season = [], None + for ep_id, ep, season in paths: + if season: + current_season = season + continue + entries.append(self.url_result( + f'http://www.crunchyroll.com{ep}', CrunchyrollIE.ie_key(), ep_id, season=current_season)) return { '_type': 'playlist', 'id': show_id, 'title': title, - 'entries': entries, + 'entries': reversed(entries), } |