Update nowtv.py
Now you can download a season or the full serie! example: http://www.nowtv.at/rtl/das-supertalent/list/free-staffel-8 http://www.nowtv.at/rtl/das-supertalent both works now and download the season 8 (url1) or the whole serie (url2)
This commit is contained in:
parent
aa5239328e
commit
1f11ae4411
@ -12,10 +12,8 @@ from ..utils import (
|
|||||||
remove_start,
|
remove_start,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class NowTVIE(InfoExtractor):
|
class NowTVIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?nowtv\.(?:de|at|ch)/(?:rtl|rtl2|rtlnitro|superrtl|ntv|vox)/(?P<id>.+?)/(?:player|preview)'
|
_VALID_URL = r'https?://(?:www\.)?nowtv\.(?:de|at|ch)/(?:rtl|rtl2|rtlnitro|superrtl|ntv|vox)/(?P<id>.+?)$'
|
||||||
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
# rtl
|
# rtl
|
||||||
'url': 'http://www.nowtv.de/rtl/bauer-sucht-frau/die-neuen-bauern-und-eine-hochzeit/player',
|
'url': 'http://www.nowtv.de/rtl/bauer-sucht-frau/die-neuen-bauern-und-eine-hochzeit/player',
|
||||||
@ -34,6 +32,18 @@ class NowTVIE(InfoExtractor):
|
|||||||
# rtmp download
|
# rtmp download
|
||||||
'skip_download': True,
|
'skip_download': True,
|
||||||
},
|
},
|
||||||
|
# rtl
|
||||||
|
'url': 'http://www.nowtv.at/rtl/stern-tv/list/aktuell',
|
||||||
|
'info_dict': {
|
||||||
|
'title': 'stern TV',
|
||||||
|
'id': '2385',
|
||||||
|
},
|
||||||
|
# rtl
|
||||||
|
'url': 'http://www.nowtv.at/rtl/das-supertalent/list/free-staffel-8',
|
||||||
|
'info_dict': {
|
||||||
|
'title': 'Das Supertalent',
|
||||||
|
'id': '46',
|
||||||
|
},
|
||||||
}, {
|
}, {
|
||||||
# rtl2
|
# rtl2
|
||||||
'url': 'http://www.nowtv.de/rtl2/berlin-tag-nacht/berlin-tag-nacht-folge-934/player',
|
'url': 'http://www.nowtv.de/rtl2/berlin-tag-nacht/berlin-tag-nacht-folge-934/player',
|
||||||
@ -138,13 +148,77 @@ class NowTVIE(InfoExtractor):
|
|||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
display_id = self._match_id(url)
|
display_id = self._match_id(url)
|
||||||
display_id_split = display_id.split('/')
|
display_id_split = display_id.split('/')
|
||||||
|
if url.endswith('/player') or url.endswith('/preview'):
|
||||||
if len(display_id) > 2:
|
if len(display_id) > 2:
|
||||||
display_id = '/'.join((display_id_split[0], display_id_split[-1]))
|
display_id = '/'.join((display_id_split[0], display_id_split[-2]))
|
||||||
|
|
||||||
info = self._download_json(
|
info = self._download_json(
|
||||||
'https://api.nowtv.de/v3/movies/%s?fields=id,title,free,geoblocked,articleLong,articleShort,broadcastStartDate,seoUrl,duration,format,files' % display_id,
|
'https://api.nowtv.de/v3/movies/%s?fields=id,title,free,geoblocked,articleLong,articleShort,broadcastStartDate,seoUrl,duration,format,files' % display_id,
|
||||||
display_id)
|
display_id)
|
||||||
|
|
||||||
|
video_id, title, description, timestamp, duration, formats = self.episode_details(info)
|
||||||
|
|
||||||
|
f = info.get('format', {})
|
||||||
|
thumbnail = f.get('defaultImage169Format') or f.get('defaultImage169Logo')
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'display_id': display_id,
|
||||||
|
'title': title,
|
||||||
|
'description': description,
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
'timestamp': timestamp,
|
||||||
|
'duration': duration,
|
||||||
|
'formats': formats,
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
if len(display_id_split) > 1:
|
||||||
|
display_id = display_id_split[0]
|
||||||
|
season = display_id_split[2]
|
||||||
|
|
||||||
|
info = self._download_json(
|
||||||
|
'https://api.nowtv.de/v3/formats/seo?fields=id,title,defaultImage169Format,defaultImage169Logo,formatTabs.*,formatTabs.formatTabPages.container.movies.*,formatTabs.formatTabPages.container.movies.files&name=%s.php' % display_id,
|
||||||
|
display_id)
|
||||||
|
|
||||||
|
playlist_id = info['id']
|
||||||
|
playlist_title = info['title']
|
||||||
|
thumbnail = info.get('defaultImage169Format') or info.get('defaultImage169Logo')
|
||||||
|
|
||||||
|
files = info['formatTabs']
|
||||||
|
|
||||||
|
videos = []
|
||||||
|
playlists = []
|
||||||
|
|
||||||
|
for season_item in files['items']:
|
||||||
|
try:
|
||||||
|
if season != season_item['seoheadline']:
|
||||||
|
continue
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
for items in season_item['formatTabPages']['items']:
|
||||||
|
try:
|
||||||
|
for episode in items['container']['movies']['items']:
|
||||||
|
|
||||||
|
video_id, title, description, timestamp, duration, formats = self.episode_details(episode)
|
||||||
|
|
||||||
|
videos.append({
|
||||||
|
'id': video_id,
|
||||||
|
'display_id': display_id,
|
||||||
|
'title': "%s - %s" % (playlist_title, title),
|
||||||
|
'description': description,
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
'timestamp': timestamp,
|
||||||
|
'duration': duration,
|
||||||
|
'formats': formats,
|
||||||
|
})
|
||||||
|
except:
|
||||||
|
continue
|
||||||
|
|
||||||
|
return self.playlist_result(videos, playlist_id, playlist_title)
|
||||||
|
|
||||||
|
def episode_details(self, info):
|
||||||
|
|
||||||
video_id = compat_str(info['id'])
|
video_id = compat_str(info['id'])
|
||||||
|
|
||||||
files = info['files']
|
files = info['files']
|
||||||
@ -173,21 +247,9 @@ class NowTVIE(InfoExtractor):
|
|||||||
})
|
})
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
title = info['title']
|
|
||||||
description = info.get('articleLong') or info.get('articleShort')
|
description = info.get('articleLong') or info.get('articleShort')
|
||||||
timestamp = parse_iso8601(info.get('broadcastStartDate'), ' ')
|
timestamp = parse_iso8601(info.get('broadcastStartDate'), ' ')
|
||||||
duration = parse_duration(info.get('duration'))
|
duration = parse_duration(info.get('duration'))
|
||||||
|
title = info['title']
|
||||||
f = info.get('format', {})
|
# title = "S%dE%d - %s" % (episode['season'], episode['episode'], episode['title'])
|
||||||
thumbnail = f.get('defaultImage169Format') or f.get('defaultImage169Logo')
|
return video_id, title, description, timestamp, duration, formats
|
||||||
|
|
||||||
return {
|
|
||||||
'id': video_id,
|
|
||||||
'display_id': display_id,
|
|
||||||
'title': title,
|
|
||||||
'description': description,
|
|
||||||
'thumbnail': thumbnail,
|
|
||||||
'timestamp': timestamp,
|
|
||||||
'duration': duration,
|
|
||||||
'formats': formats,
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user