[tvnow] Extract series metadata (closes #15774)

This commit is contained in:
Sergey M․ 2018-03-06 22:50:35 +07:00
parent 2e25f80d5d
commit 574e9db2b0
No known key found for this signature in database
GPG Key ID: 2C393E0F18A9236D

View File

@ -7,6 +7,7 @@ from .common import InfoExtractor
from ..compat import compat_str from ..compat import compat_str
from ..utils import ( from ..utils import (
ExtractorError, ExtractorError,
int_or_none,
parse_iso8601, parse_iso8601,
parse_duration, parse_duration,
update_url_query, update_url_query,
@ -16,8 +17,9 @@ from ..utils import (
class TVNowBaseIE(InfoExtractor): class TVNowBaseIE(InfoExtractor):
_VIDEO_FIELDS = ( _VIDEO_FIELDS = (
'id', 'title', 'free', 'geoblocked', 'articleLong', 'articleShort', 'id', 'title', 'free', 'geoblocked', 'articleLong', 'articleShort',
'broadcastStartDate', 'isDrm', 'duration', 'manifest.dashclear', 'broadcastStartDate', 'isDrm', 'duration', 'season', 'episode',
'format.defaultImage169Format', 'format.defaultImage169Logo') 'manifest.dashclear', 'format.title', 'format.defaultImage169Format',
'format.defaultImage169Logo')
def _call_api(self, path, video_id, query): def _call_api(self, path, video_id, query):
return self._download_json( return self._download_json(
@ -66,6 +68,10 @@ class TVNowBaseIE(InfoExtractor):
'thumbnail': thumbnail, 'thumbnail': thumbnail,
'timestamp': timestamp, 'timestamp': timestamp,
'duration': duration, 'duration': duration,
'series': f.get('title'),
'season_number': int_or_none(info.get('season')),
'episode_number': int_or_none(info.get('episode')),
'episode': title,
'formats': formats, 'formats': formats,
} }
@ -74,18 +80,21 @@ class TVNowIE(TVNowBaseIE):
_VALID_URL = r'https?://(?:www\.)?tvnow\.(?:de|at|ch)/(?:rtl(?:2|plus)?|nitro|superrtl|ntv|vox)/(?P<show_id>[^/]+)/(?:(?:list/[^/]+|jahr/\d{4}/\d{1,2})/)?(?P<id>[^/]+)/(?:player|preview)' _VALID_URL = r'https?://(?:www\.)?tvnow\.(?:de|at|ch)/(?:rtl(?:2|plus)?|nitro|superrtl|ntv|vox)/(?P<show_id>[^/]+)/(?:(?:list/[^/]+|jahr/\d{4}/\d{1,2})/)?(?P<id>[^/]+)/(?:player|preview)'
_TESTS = [{ _TESTS = [{
# rtl 'url': 'https://www.tvnow.de/rtl2/grip-das-motormagazin/der-neue-porsche-911-gt-3/player',
'url': 'https://www.tvnow.de/rtl/alarm-fuer-cobra-11/freier-fall/player?return=/rtl',
'info_dict': { 'info_dict': {
'id': '385314', 'id': '331082',
'display_id': 'alarm-fuer-cobra-11/freier-fall', 'display_id': 'grip-das-motormagazin/der-neue-porsche-911-gt-3',
'ext': 'mp4', 'ext': 'mp4',
'title': 'Freier Fall', 'title': 'Der neue Porsche 911 GT 3',
'description': 'md5:8c2d8f727261adf7e0dc18366124ca02', 'description': 'md5:6143220c661f9b0aae73b245e5d898bb',
'thumbnail': r're:^https?://.*\.jpg$', 'thumbnail': r're:^https?://.*\.jpg$',
'timestamp': 1512677700, 'timestamp': 1495994400,
'upload_date': '20171207', 'upload_date': '20170528',
'duration': 2862.0, 'duration': 5283,
'series': 'GRIP - Das Motormagazin',
'season_number': 14,
'episode_number': 405,
'episode': 'Der neue Porsche 911 GT 3',
}, },
}, { }, {
# rtl2 # rtl2