mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-17 21:59:17 +00:00
[ie/crunchyroll:show] Implement language filter extractor arg
This commit is contained in:
parent
8b46ad4d8b
commit
2e962821ae
|
@ -1791,6 +1791,9 @@ #### funimation
|
|||
#### crunchyrollbeta (Crunchyroll)
|
||||
* `hardsub`: One or more hardsub versions to extract (in order of preference), or `all` (default: `None` = no hardsubs will be extracted), e.g. `crunchyrollbeta:hardsub=en-US,de-DE`
|
||||
|
||||
#### crunchyrollbetashow (Crunchyroll)
|
||||
* `language`: The language variants to extract, or `all` (default: `all`)
|
||||
|
||||
#### vikichannel
|
||||
* `video_types`: Types of videos to download - one or more of `episodes`, `movies`, `clips`, `trailers`
|
||||
|
||||
|
|
|
@ -514,10 +514,17 @@ class CrunchyrollBetaShowIE(CrunchyrollCmsBaseIE):
|
|||
|
||||
def _real_extract(self, url):
|
||||
lang, internal_id = self._match_valid_url(url).group('lang', 'id')
|
||||
requested_languages = set(self._configuration_arg('language'))
|
||||
if 'all' in requested_languages:
|
||||
requested_languages = set()
|
||||
|
||||
def entries():
|
||||
seasons_response = self._call_cms_api_signed(f'seasons?series_id={internal_id}', internal_id, lang, 'seasons')
|
||||
for season in traverse_obj(seasons_response, ('items', ..., {dict})):
|
||||
if requested_languages:
|
||||
season_languages = traverse_obj(season, ((('audio_locales', ...), 'audio_locale'), {str.lower}))
|
||||
if season_languages and not requested_languages.intersection(season_languages):
|
||||
continue
|
||||
episodes_response = self._call_cms_api_signed(
|
||||
f'episodes?season_id={season["id"]}', season["id"], lang, 'episode list')
|
||||
for episode_response in traverse_obj(episodes_response, ('items', ..., {dict})):
|
||||
|
|
Loading…
Reference in a new issue