Compare commits
5 Commits
master
...
better_ext
Author | SHA1 | Date | |
---|---|---|---|
64ea58e49c | |||
5063afc5df | |||
2be9bcaae6 | |||
cbd871084c | |||
d71bc476a8 |
@ -41,6 +41,7 @@ class NRKBaseIE(InfoExtractor):
|
||||
break
|
||||
|
||||
title = data.get('fullTitle') or data.get('mainTitle') or data['title']
|
||||
alt_title = data.get('mainTitle')
|
||||
video_id = data.get('id') or video_id
|
||||
|
||||
entries = []
|
||||
@ -62,6 +63,14 @@ class NRKBaseIE(InfoExtractor):
|
||||
if not asset_url:
|
||||
continue
|
||||
formats = self._extract_akamai_formats(asset_url, video_id)
|
||||
|
||||
playback_manifest = self._download_json(
|
||||
'http://%s/playback/manifest/program/%s' % (self._api_host, video_id),
|
||||
video_id, 'Downloading manifest JSON', fatal=False)
|
||||
streamurl = playback_manifest.get('statistics').get('conviva').get('streamUrl')
|
||||
formats.extend(self._extract_m3u8_formats(
|
||||
streamurl, video_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False,
|
||||
errnote='Alternate extractor failed'))
|
||||
if not formats:
|
||||
continue
|
||||
self._sort_formats(formats)
|
||||
@ -139,6 +148,13 @@ class NRKBaseIE(InfoExtractor):
|
||||
EPISODENUM_RE, _season_episode, 'episode number',
|
||||
default=None, group='episode'))
|
||||
|
||||
if not season_number or episode_number:
|
||||
programs = self._download_json(
|
||||
'http://%s/programs/%s' % (self._api_host, video_id),
|
||||
video_id, 'Downloading programs manifest JSON', fatal=False)
|
||||
season_number = int_or_none(programs.get('seasonNumber'))
|
||||
episode_number = int_or_none(programs.get('episodeNumber'))
|
||||
|
||||
thumbnails = None
|
||||
images = data.get('images')
|
||||
if images and isinstance(images, dict):
|
||||
@ -162,6 +178,7 @@ class NRKBaseIE(InfoExtractor):
|
||||
'categories': [category] if category else None,
|
||||
'age_limit': parse_age_limit(data.get('legalAge')),
|
||||
'thumbnails': thumbnails,
|
||||
'alt_title': alt_title,
|
||||
}
|
||||
|
||||
vcodec = 'none' if data.get('mediaType') == 'Audio' else None
|
||||
@ -349,7 +366,8 @@ class NRKTVIE(NRKBaseIE):
|
||||
'id': 'KMTE50001317AA',
|
||||
'ext': 'mp4',
|
||||
'title': 'Anno 13:30',
|
||||
'description': 'md5:11d9613661a8dbe6f9bef54e3a4cbbfa',
|
||||
'alt_title': 'Anno',
|
||||
'description': 'md5:13735a46076f1ed9310ed13dfd69789f',
|
||||
'duration': 2340,
|
||||
'series': 'Anno',
|
||||
'episode': '13:30',
|
||||
@ -390,6 +408,7 @@ class NRKTVEpisodeIE(InfoExtractor):
|
||||
'id': 'MUHH36005220BA',
|
||||
'ext': 'mp4',
|
||||
'title': 'Kro, krig og kjærlighet 2:6',
|
||||
'alt_title': 'Kro, krig og kjærlighet',
|
||||
'description': 'md5:b32a7dc0b1ed27c8064f58b97bda4350',
|
||||
'duration': 1563,
|
||||
'series': 'Hellums kro',
|
||||
@ -427,7 +446,8 @@ class NRKTVEpisodeIE(InfoExtractor):
|
||||
|
||||
nrk_id = self._parse_json(
|
||||
self._search_regex(JSON_LD_RE, webpage, 'JSON-LD', group='json_ld'),
|
||||
display_id)['@id']
|
||||
display_id).get('@id') or \
|
||||
self._html_search_meta('nrk:program-id', webpage)
|
||||
|
||||
assert re.match(NRKTVIE._EPISODE_RE, nrk_id)
|
||||
return self.url_result(
|
||||
|
Loading…
Reference in New Issue
Block a user