mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-01-07 17:16:08 +00:00
[nrk] Improve series metadata extraction (closes #27473)
This commit is contained in:
parent
1aaee908b9
commit
5c6e84c0ff
|
@ -238,16 +238,29 @@ class NRKIE(NRKBaseIE):
|
||||||
}
|
}
|
||||||
|
|
||||||
if is_series:
|
if is_series:
|
||||||
series = title
|
series = season_id = season_number = episode = episode_number = None
|
||||||
|
programs = self._call_api(
|
||||||
|
'programs/%s' % video_id, video_id, 'programs', fatal=False)
|
||||||
|
if programs and isinstance(programs, dict):
|
||||||
|
series = str_or_none(programs.get('seriesTitle'))
|
||||||
|
season_id = str_or_none(programs.get('seasonId'))
|
||||||
|
season_number = int_or_none(programs.get('seasonNumber'))
|
||||||
|
episode = str_or_none(programs.get('episodeTitle'))
|
||||||
|
episode_number = int_or_none(programs.get('episodeNumber'))
|
||||||
|
if not series:
|
||||||
|
series = title
|
||||||
if alt_title:
|
if alt_title:
|
||||||
title += ' - %s' % alt_title
|
title += ' - %s' % alt_title
|
||||||
season_number = int_or_none(self._search_regex(
|
if not season_number:
|
||||||
r'Sesong\s+(\d+)', description or '', 'season number',
|
season_number = int_or_none(self._search_regex(
|
||||||
default=None))
|
r'Sesong\s+(\d+)', description or '', 'season number',
|
||||||
episode = alt_title if is_series else None
|
default=None))
|
||||||
episode_number = int_or_none(self._search_regex(
|
if not episode:
|
||||||
r'^(\d+)\.', episode or '', 'episode number',
|
episode = alt_title if is_series else None
|
||||||
default=None))
|
if not episode_number:
|
||||||
|
episode_number = int_or_none(self._search_regex(
|
||||||
|
r'^(\d+)\.', episode or '', 'episode number',
|
||||||
|
default=None))
|
||||||
if not episode_number:
|
if not episode_number:
|
||||||
episode_number = int_or_none(self._search_regex(
|
episode_number = int_or_none(self._search_regex(
|
||||||
r'\((\d+)\s*:\s*\d+\)', description or '',
|
r'\((\d+)\s*:\s*\d+\)', description or '',
|
||||||
|
@ -255,6 +268,7 @@ class NRKIE(NRKBaseIE):
|
||||||
info.update({
|
info.update({
|
||||||
'title': title,
|
'title': title,
|
||||||
'series': series,
|
'series': series,
|
||||||
|
'season_id': season_id,
|
||||||
'season_number': season_number,
|
'season_number': season_number,
|
||||||
'episode': episode,
|
'episode': episode,
|
||||||
'episode_number': episode_number,
|
'episode_number': episode_number,
|
||||||
|
@ -388,7 +402,7 @@ class NRKTVEpisodeIE(InfoExtractor):
|
||||||
'description': 'md5:ad92ddffc04cea8ce14b415deef81787',
|
'description': 'md5:ad92ddffc04cea8ce14b415deef81787',
|
||||||
'duration': 1563.92,
|
'duration': 1563.92,
|
||||||
'series': 'Hellums kro',
|
'series': 'Hellums kro',
|
||||||
# 'season_number': 1,
|
'season_number': 1,
|
||||||
'episode_number': 2,
|
'episode_number': 2,
|
||||||
'episode': '2. Kro, krig og kjærlighet',
|
'episode': '2. Kro, krig og kjærlighet',
|
||||||
'age_limit': 6,
|
'age_limit': 6,
|
||||||
|
|
Loading…
Reference in a new issue