2 from __future__ import unicode_literals
4 from .common import InfoExtractor
5 from ..compat import compat_str
16 class NowTVIE(InfoExtractor):
17 _VALID_URL = r'https?://(?:www\.)?nowtv\.(?:de|at|ch)/(?:rtl|rtl2|rtlnitro|superrtl|ntv|vox)/(?P<id>.+?)/(?:player|preview)'
21 'url': 'http://www.nowtv.de/rtl/bauer-sucht-frau/die-neuen-bauern-und-eine-hochzeit/player',
24 'display_id': 'bauer-sucht-frau/die-neuen-bauern-und-eine-hochzeit',
26 'title': 'Die neuen Bauern und eine Hochzeit',
27 'description': 'md5:e234e1ed6d63cf06be5c070442612e7e',
28 'thumbnail': 're:^https?://.*\.jpg$',
29 'timestamp': 1432580700,
30 'upload_date': '20150525',
35 'skip_download': True,
39 'url': 'http://www.nowtv.de/rtl2/berlin-tag-nacht/berlin-tag-nacht-folge-934/player',
42 'display_id': 'berlin-tag-nacht/berlin-tag-nacht-folge-934',
44 'title': 'Berlin - Tag & Nacht (Folge 934)',
45 'description': 'md5:c85e88c2e36c552dfe63433bc9506dd0',
46 'thumbnail': 're:^https?://.*\.jpg$',
47 'timestamp': 1432666800,
48 'upload_date': '20150526',
53 'skip_download': True,
57 'url': 'http://www.nowtv.de/rtlnitro/alarm-fuer-cobra-11-die-autobahnpolizei/hals-und-beinbruch-2014-08-23-21-10-00/player',
60 'display_id': 'alarm-fuer-cobra-11-die-autobahnpolizei/hals-und-beinbruch-2014-08-23-21-10-00',
62 'title': 'Hals- und Beinbruch',
63 'description': 'md5:b50d248efffe244e6f56737f0911ca57',
64 'thumbnail': 're:^https?://.*\.jpg$',
65 'timestamp': 1432415400,
66 'upload_date': '20150523',
71 'skip_download': True,
75 'url': 'http://www.nowtv.de/superrtl/medicopter-117/angst/player',
78 'display_id': 'medicopter-117/angst',
81 'description': 'md5:30cbc4c0b73ec98bcd73c9f2a8c17c4e',
82 'thumbnail': 're:^https?://.*\.jpg$',
83 'timestamp': 1222632900,
84 'upload_date': '20080928',
89 'skip_download': True,
93 'url': 'http://www.nowtv.de/ntv/ratgeber-geld/thema-ua-der-erste-blick-die-apple-watch/player',
96 'display_id': 'ratgeber-geld/thema-ua-der-erste-blick-die-apple-watch',
98 'title': 'Thema u.a.: Der erste Blick: Die Apple Watch',
99 'description': 'md5:4312b6c9d839ffe7d8caf03865a531af',
100 'thumbnail': 're:^https?://.*\.jpg$',
101 'timestamp': 1432751700,
102 'upload_date': '20150527',
107 'skip_download': True,
111 'url': 'http://www.nowtv.de/vox/der-hundeprofi/buero-fall-chihuahua-joel/player',
114 'display_id': 'der-hundeprofi/buero-fall-chihuahua-joel',
116 'title': "Büro-Fall / Chihuahua 'Joel'",
117 'description': 'md5:e62cb6bf7c3cc669179d4f1eb279ad8d',
118 'thumbnail': 're:^https?://.*\.jpg$',
119 'timestamp': 1432408200,
120 'upload_date': '20150523',
125 'skip_download': True,
128 'url': 'http://www.nowtv.de/rtl/bauer-sucht-frau/die-neuen-bauern-und-eine-hochzeit/preview',
129 'only_matching': True,
131 'url': 'http://www.nowtv.at/rtl/bauer-sucht-frau/die-neuen-bauern-und-eine-hochzeit/preview?return=/rtl/bauer-sucht-frau/die-neuen-bauern-und-eine-hochzeit',
132 'only_matching': True,
134 'url': 'http://www.nowtv.de/rtl2/echtzeit/list/aktuell/schnelles-geld-am-ende-der-welt/player',
135 'only_matching': True,
138 def _real_extract(self, url):
139 display_id = self._match_id(url)
140 display_id_split = display_id.split('/')
141 if len(display_id) > 2:
142 display_id = '/'.join((display_id_split[0], display_id_split[-1]))
144 info = self._download_json(
145 'https://api.nowtv.de/v3/movies/%s?fields=id,title,free,geoblocked,articleLong,articleShort,broadcastStartDate,seoUrl,duration,format,files' % display_id,
148 video_id = compat_str(info['id'])
150 files = info['files']
152 if info.get('geoblocked', False):
153 raise ExtractorError(
154 'Video %s is not available from your location due to geo restriction' % video_id,
156 if not info.get('free', True):
157 raise ExtractorError(
158 'Video %s is not available for free' % video_id, expected=True)
161 for item in files['items']:
162 if determine_ext(item['path']) != 'f4v':
164 app, play_path = remove_start(item['path'], '/').split('/', 1)
166 'url': 'rtmpe://fms.rtl.de',
168 'play_path': 'mp4:%s' % play_path,
170 'page_url': 'http://rtlnow.rtl.de',
171 'player_url': 'http://cdn.static-fra.de/now/vodplayer.swf',
172 'tbr': int_or_none(item.get('bitrate')),
174 self._sort_formats(formats)
176 title = info['title']
177 description = info.get('articleLong') or info.get('articleShort')
178 timestamp = parse_iso8601(info.get('broadcastStartDate'), ' ')
179 duration = parse_duration(info.get('duration'))
181 f = info.get('format', {})
182 thumbnail = f.get('defaultImage169Format') or f.get('defaultImage169Logo')
186 'display_id': display_id,
188 'description': description,
189 'thumbnail': thumbnail,
190 'timestamp': timestamp,
191 'duration': duration,