]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/nowtv.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
7 from ..compat
import compat_str
17 class NowTVIE(InfoExtractor
):
18 _VALID_URL
= r
'https?://(?:www\.)?nowtv\.de/(?P<station>rtl|rtl2|rtlnitro|superrtl|ntv|vox)/(?P<id>.+?)/player'
22 'url': 'http://www.nowtv.de/rtl/bauer-sucht-frau/die-neuen-bauern-und-eine-hochzeit/player',
25 'display_id': 'bauer-sucht-frau/die-neuen-bauern-und-eine-hochzeit',
27 'title': 'Die neuen Bauern und eine Hochzeit',
28 'description': 'md5:e234e1ed6d63cf06be5c070442612e7e',
29 'thumbnail': 're:^https?://.*\.jpg$',
30 'timestamp': 1432580700,
31 'upload_date': '20150525',
36 'skip_download': True,
40 'url': 'http://www.nowtv.de/rtl2/berlin-tag-nacht/berlin-tag-nacht-folge-934/player',
43 'display_id': 'berlin-tag-nacht/berlin-tag-nacht-folge-934',
45 'title': 'Berlin - Tag & Nacht (Folge 934)',
46 'description': 'md5:c85e88c2e36c552dfe63433bc9506dd0',
47 'thumbnail': 're:^https?://.*\.jpg$',
48 'timestamp': 1432666800,
49 'upload_date': '20150526',
54 'skip_download': True,
58 'url': 'http://www.nowtv.de/rtlnitro/alarm-fuer-cobra-11-die-autobahnpolizei/hals-und-beinbruch-2014-08-23-21-10-00/player',
61 'display_id': 'alarm-fuer-cobra-11-die-autobahnpolizei/hals-und-beinbruch-2014-08-23-21-10-00',
63 'title': 'Hals- und Beinbruch',
64 'description': 'md5:b50d248efffe244e6f56737f0911ca57',
65 'thumbnail': 're:^https?://.*\.jpg$',
66 'timestamp': 1432415400,
67 'upload_date': '20150523',
72 'skip_download': True,
76 'url': 'http://www.nowtv.de/superrtl/medicopter-117/angst/player',
79 'display_id': 'medicopter-117/angst',
82 'description': 'md5:30cbc4c0b73ec98bcd73c9f2a8c17c4e',
83 'thumbnail': 're:^https?://.*\.jpg$',
84 'timestamp': 1222632900,
85 'upload_date': '20080928',
90 'skip_download': True,
94 'url': 'http://www.nowtv.de/ntv/ratgeber-geld/thema-ua-der-erste-blick-die-apple-watch/player',
97 'display_id': 'ratgeber-geld/thema-ua-der-erste-blick-die-apple-watch',
99 'title': 'Thema u.a.: Der erste Blick: Die Apple Watch',
100 'description': 'md5:4312b6c9d839ffe7d8caf03865a531af',
101 'thumbnail': 're:^https?://.*\.jpg$',
102 'timestamp': 1432751700,
103 'upload_date': '20150527',
108 'skip_download': True,
112 'url': 'http://www.nowtv.de/vox/der-hundeprofi/buero-fall-chihuahua-joel/player',
115 'display_id': 'der-hundeprofi/buero-fall-chihuahua-joel',
117 'title': "Büro-Fall / Chihuahua 'Joel'",
118 'description': 'md5:e62cb6bf7c3cc669179d4f1eb279ad8d',
119 'thumbnail': 're:^https?://.*\.jpg$',
120 'timestamp': 1432408200,
121 'upload_date': '20150523',
126 'skip_download': True,
130 def _real_extract(self
, url
):
131 mobj
= re
.match(self
._VALID
_URL
, url
)
132 display_id
= mobj
.group('id')
133 station
= mobj
.group('station')
135 info
= self
._download
_json
(
136 'https://api.nowtv.de/v3/movies/%s?fields=*,format,files' % display_id
,
139 video_id
= compat_str(info
['id'])
141 files
= info
['files']
143 if info
.get('geoblocked', False):
144 raise ExtractorError(
145 'Video %s is not available from your location due to geo restriction' % video_id
,
147 if not info
.get('free', True):
148 raise ExtractorError(
149 'Video %s is not available for free' % video_id
, expected
=True)
151 f
= info
.get('format', {})
152 station
= f
.get('station') or station
158 'nitro': 'rtlnitronow',
160 'superrtl': 'superrtlnow'
164 for item
in files
['items']:
165 item_path
= remove_start(item
['path'], '/')
166 tbr
= int_or_none(item
['bitrate'])
167 m3u8_url
= 'http://hls.fra.%s.de/hls-vod-enc/%s.m3u8' % (STATIONS
[station
], item_path
)
168 m3u8_url
= m3u8_url
.replace('now/', 'now/videos/')
171 'format_id': '%s-%sk' % (item
['id'], tbr
),
175 self
._sort
_formats
(formats
)
177 title
= info
['title']
178 description
= info
.get('articleLong') or info
.get('articleShort')
179 timestamp
= parse_iso8601(info
.get('broadcastStartDate'), ' ')
180 duration
= parse_duration(info
.get('duration'))
181 thumbnail
= f
.get('defaultImage169Format') or f
.get('defaultImage169Logo')
185 'display_id': display_id
,
187 'description': description
,
188 'thumbnail': thumbnail
,
189 'timestamp': timestamp
,
190 'duration': duration
,