4 from .common
import InfoExtractor
25 class ORFTVthekIE(InfoExtractor
):
26 IE_NAME
= 'orf:tvthek'
27 IE_DESC
= 'ORF TVthek'
28 _VALID_URL
= r
'(?P<url>https?://tvthek\.orf\.at/(?:(?:[^/]+/){2}){1,2}(?P<id>\d+))(/[^/]+/(?P<vid>\d+))?(?:$|[?#])'
31 'url': 'https://tvthek.orf.at/profile/ZIB-2/1211/ZIB-2/14121079',
36 'params': {'noplaylist': True}
38 'url': 'https://tvthek.orf.at/profile/ZIB-2/1211/ZIB-2/14121079/Umfrage-Welches-Tier-ist-Sebastian-Kurz/15083150',
43 'params': {'playlist_items': '5'}
45 'url': 'https://tvthek.orf.at/profile/ZIB-2/1211/ZIB-2/14121079/Umfrage-Welches-Tier-ist-Sebastian-Kurz/15083150',
54 'description': 'md5:7be1c485425f5f255a5e4e4815e77d04',
55 'thumbnail': 'https://api-tvthek.orf.at/uploads/media/segments/0130/59/824271ea35cd8931a0fb08ab316a5b0a1562342c.jpeg',
56 'title': 'Umfrage: Welches Tier ist Sebastian Kurz?',
60 'params': {'noplaylist': True, 'skip_download': 'm3u8'}
62 'url': 'http://tvthek.orf.at/program/Aufgetischt/2745173/Aufgetischt-Mit-der-Steirischen-Tafelrunde/8891389',
64 'md5': '2942210346ed779588f428a92db88712',
68 'title': 'Aufgetischt: Mit der Steirischen Tafelrunde',
69 'description': 'md5:c1272f0245537812d4e36419c207b67d',
71 'upload_date': '20141208',
74 'skip': 'Blocked outside of Austria / Germany',
76 'url': 'http://tvthek.orf.at/topic/Im-Wandel-der-Zeit/8002126/Best-of-Ingrid-Thurnher/7982256',
80 'title': 'Best of Ingrid Thurnher',
81 'upload_date': '20140527',
82 'description': 'Viele Jahre war Ingrid Thurnher das "Gesicht" der ZIB 2. Vor ihrem Wechsel zur ZIB 2 im Jahr 1995 moderierte sie unter anderem "Land und Leute", "Österreich-Bild" und "Niederösterreich heute".',
85 'skip_download': True, # rtsp downloads
87 'skip': 'Blocked outside of Austria / Germany',
89 'url': 'http://tvthek.orf.at/topic/Fluechtlingskrise/10463081/Heimat-Fremde-Heimat/13879132/Senioren-betreuen-Migrantenkinder/13879141',
90 'only_matching': True,
92 'url': 'http://tvthek.orf.at/profile/Universum/35429',
93 'only_matching': True,
96 def _pagefunc(self
, url
, data_jsb
, n
, *, image
=None):
98 video_id
, title
= str(sd
['id']), sd
['title']
100 for fd
in sd
['sources']:
101 src
= url_or_none(fd
.get('src'))
104 format_id
= join_nonempty('delivery', 'quality', 'quality_string', from_dict
=fd
)
105 ext
= determine_ext(src
)
107 m3u8_formats
= self
._extract
_m
3u8_formats
(
108 src
, video_id
, 'mp4', m3u8_id
=format_id
, fatal
=False, note
=f
'Downloading {format_id} m3u8 manifest')
109 if any('/geoprotection' in f
['url'] for f
in m3u8_formats
):
110 self
.raise_geo_restricted()
111 formats
.extend(m3u8_formats
)
113 formats
.extend(self
._extract
_f
4m
_formats
(
114 src
, video_id
, f4m_id
=format_id
, fatal
=False))
116 formats
.extend(self
._extract
_mpd
_formats
(
117 src
, video_id
, mpd_id
=format_id
, fatal
=False, note
=f
'Downloading {format_id} mpd manifest'))
120 'format_id': format_id
,
122 'protocol': fd
.get('protocol'),
125 # Check for geoblocking.
126 # There is a property is_geoprotection, but that's always false
127 geo_str
= sd
.get('geoprotection_string')
129 (f
['url'] for f
in formats
if re
.match(r
'^https?://.*\.mp4$', f
['url'])),
130 None) if geo_str
else None
132 self
._request
_webpage
(
133 HEADRequest(http_url
), video_id
, fatal
=False, note
='Testing for geoblocking',
134 errnote
=f
'This video seems to be blocked outside of {geo_str}. You may want to try the streaming-* formats')
136 self
._sort
_formats
(formats
)
139 for sub
in sd
.get('subtitles', []):
140 sub_src
= sub
.get('src')
143 subtitles
.setdefault(sub
.get('lang', 'de-AT'), []).append({
147 upload_date
= unified_strdate(sd
.get('created_date'))
150 preview
= sd
.get('preview_image_url')
157 image
= sd
.get('image_full_url') or image
168 'webpage_url': smuggle_url(f
'{url}/part/{video_id}', {'force_noplaylist': True}
),
170 'subtitles': subtitles
,
171 'description': sd
.get('description'),
172 'duration': int_or_none(sd
.get('duration_in_seconds')),
173 'upload_date': upload_date
,
174 'thumbnails': thumbnails
,
177 def _real_extract(self
, url
):
178 url
, smuggled_data
= unsmuggle_url(url
)
179 playlist_id
, video_id
, base_url
= self
._match
_valid
_url
(url
).group('id', 'vid', 'url')
180 webpage
= self
._download
_webpage
(url
, playlist_id
)
182 data_jsb
= self
._parse
_json
(
184 r
'<div[^>]+class=(["\']).*?VideoPlaylist
.*?\
1[^
>]+data
-jsb
=(["\'])(?P<json>.+?)\2',
185 webpage, 'playlist', group='json'),
186 playlist_id, transform_source=unescapeHTML)['playlist']['videos']
188 if not self._yes_playlist(playlist_id, video_id, smuggled_data):
189 data_jsb = [sd for sd in data_jsb if str(sd.get('id')) == video_id]
191 playlist_count = len(data_jsb)
192 image = self._og_search_thumbnail(webpage) if playlist_count == 1 else None
194 page_func = functools.partial(self._pagefunc, base_url, data_jsb, image=image)
197 'entries': InAdvancePagedList(page_func, playlist_count, 1),
202 class ORFRadioIE(InfoExtractor):
203 def _real_extract(self, url):
204 mobj = self._match_valid_url(url)
205 show_date = mobj.group('date')
206 show_id = mobj.group('show')
208 data = self._download_json(
209 'http://audioapi.orf.at/%s/api/json/current/broadcast/%s/%s'
210 % (self._API_STATION, show_id, show_date), show_id)
213 for info in data['streams']:
214 loop_stream_id = str_or_none(info.get('loopStreamId'))
215 if not loop_stream_id:
217 title = str_or_none(data.get('title'))
220 start = int_or_none(info.get('start'), scale=1000)
221 end = int_or_none(info.get('end'), scale=1000)
222 duration = end - start if end and start else None
224 'id': loop_stream_id.replace('.mp3', ''),
225 'url': 'https://loopstream01.apa.at/?channel=%s&id=%s' % (self._LOOP_STATION, loop_stream_id),
227 'description': clean_html(data.get('subtitle')),
228 'duration': duration,
231 'series': data.get('programTitle'),
237 'title': data.get('title'),
238 'description': clean_html(data.get('subtitle')),
243 class ORFFM4IE(ORFRadioIE):
245 IE_DESC = 'radio FM4'
246 _VALID_URL = r'https?://(?P<station>fm4)\.orf\.at/player/(?P<date>[0-9]+)/(?P<show>4\w+)'
248 _LOOP_STATION = 'fm4'
251 'url': 'http://fm4.orf.at/player/20170107/4CC',
252 'md5': '2b0be47375432a7ef104453432a19212',
254 'id': '2017-01-07_2100_tl_54_7DaysSat18_31295',
256 'title': 'Solid Steel Radioshow',
257 'description': 'Die Mixshow von Coldcut und Ninja Tune.',
259 'timestamp': 1483819257,
260 'upload_date': '20170107',
262 'skip': 'Shows from ORF radios are only available for 7 days.',
263 'only_matching': True,
267 class ORFNOEIE(ORFRadioIE):
269 IE_DESC = 'Radio Niederösterreich'
270 _VALID_URL = r'https?://(?P<station>noe)\.orf\.at/player/(?P<date>[0-9]+)/(?P<show>\w+)'
272 _LOOP_STATION = 'oe2n'
275 'url': 'https://noe.orf.at/player/20200423/NGM',
276 'only_matching': True,
280 class ORFWIEIE(ORFRadioIE):
282 IE_DESC = 'Radio Wien'
283 _VALID_URL = r'https?://(?P<station>wien)\.orf\.at/player/(?P<date>[0-9]+)/(?P<show>\w+)'
285 _LOOP_STATION = 'oe2w'
288 'url': 'https://wien.orf.at/player/20200423/WGUM',
289 'only_matching': True,
293 class ORFBGLIE(ORFRadioIE):
294 IE_NAME = 'orf:burgenland'
295 IE_DESC = 'Radio Burgenland'
296 _VALID_URL = r'https?://(?P<station>burgenland)\.orf\.at/player/(?P<date>[0-9]+)/(?P<show>\w+)'
298 _LOOP_STATION = 'oe2b'
301 'url': 'https://burgenland.orf.at/player/20200423/BGM',
302 'only_matching': True,
306 class ORFOOEIE(ORFRadioIE):
307 IE_NAME = 'orf:oberoesterreich'
308 IE_DESC = 'Radio Oberösterreich'
309 _VALID_URL = r'https?://(?P<station>ooe)\.orf\.at/player/(?P<date>[0-9]+)/(?P<show>\w+)'
311 _LOOP_STATION = 'oe2o'
314 'url': 'https://ooe.orf.at/player/20200423/OGMO',
315 'only_matching': True,
319 class ORFSTMIE(ORFRadioIE):
320 IE_NAME = 'orf:steiermark'
321 IE_DESC = 'Radio Steiermark'
322 _VALID_URL = r'https?://(?P<station>steiermark)\.orf\.at/player/(?P<date>[0-9]+)/(?P<show>\w+)'
324 _LOOP_STATION = 'oe2st'
327 'url': 'https://steiermark.orf.at/player/20200423/STGMS',
328 'only_matching': True,
332 class ORFKTNIE(ORFRadioIE):
333 IE_NAME = 'orf:kaernten'
334 IE_DESC = 'Radio Kärnten'
335 _VALID_URL = r'https?://(?P<station>kaernten)\.orf\.at/player/(?P<date>[0-9]+)/(?P<show>\w+)'
337 _LOOP_STATION = 'oe2k'
340 'url': 'https://kaernten.orf.at/player/20200423/KGUMO',
341 'only_matching': True,
345 class ORFSBGIE(ORFRadioIE):
346 IE_NAME = 'orf:salzburg'
347 IE_DESC = 'Radio Salzburg'
348 _VALID_URL = r'https?://(?P<station>salzburg)\.orf\.at/player/(?P<date>[0-9]+)/(?P<show>\w+)'
350 _LOOP_STATION = 'oe2s'
353 'url': 'https://salzburg.orf.at/player/20200423/SGUM',
354 'only_matching': True,
358 class ORFTIRIE(ORFRadioIE):
359 IE_NAME = 'orf:tirol'
360 IE_DESC = 'Radio Tirol'
361 _VALID_URL = r'https?://(?P<station>tirol)\.orf\.at/player/(?P<date>[0-9]+)/(?P<show>\w+)'
363 _LOOP_STATION = 'oe2t'
366 'url': 'https://tirol.orf.at/player/20200423/TGUMO',
367 'only_matching': True,
371 class ORFVBGIE(ORFRadioIE):
372 IE_NAME = 'orf:vorarlberg'
373 IE_DESC = 'Radio Vorarlberg'
374 _VALID_URL = r'https?://(?P<station>vorarlberg)\.orf\.at/player/(?P<date>[0-9]+)/(?P<show>\w+)'
376 _LOOP_STATION = 'oe2v'
379 'url': 'https://vorarlberg.orf.at/player/20200423/VGUM',
380 'only_matching': True,
384 class ORFOE3IE(ORFRadioIE):
386 IE_DESC = 'Radio Österreich 3'
387 _VALID_URL = r'https?://(?P<station>oe3)\.orf\.at/player/(?P<date>[0-9]+)/(?P<show>\w+)'
389 _LOOP_STATION = 'oe3'
392 'url': 'https://oe3.orf.at/player/20200424/3WEK',
393 'only_matching': True,
397 class ORFOE1IE(ORFRadioIE):
399 IE_DESC = 'Radio Österreich 1'
400 _VALID_URL = r'https?://(?P<station>oe1)\.orf\.at/player/(?P<date>[0-9]+)/(?P<show>\w+)'
402 _LOOP_STATION = 'oe1'
405 'url': 'http://oe1.orf.at/player/20170108/456544',
406 'md5': '34d8a6e67ea888293741c86a099b745b',
408 'id': '2017-01-08_0759_tl_51_7DaysSun6_256141',
410 'title': 'Morgenjournal',
412 'timestamp': 1483858796,
413 'upload_date': '20170108',
415 'skip': 'Shows from ORF radios are only available for 7 days.'
419 class ORFIPTVIE(InfoExtractor):
421 IE_DESC = 'iptv.ORF.at'
422 _VALID_URL = r'https?://iptv\.orf\.at/(?:#/)?stories/(?P<id>\d+)'
425 'url': 'http://iptv.orf.at/stories/2275236/',
426 'md5': 'c8b22af4718a4b4af58342529453e3e5',
430 'title': 'Weitere Evakuierungen um Vulkan Calbuco',
431 'description': 'md5:d689c959bdbcf04efeddedbf2299d633',
433 'thumbnail': r're:^https?://.*\.jpg$',
434 'upload_date': '20150425',
438 def _real_extract(self, url):
439 story_id = self._match_id(url)
441 webpage = self._download_webpage(
442 'http://iptv.orf.at/stories/%s' % story_id, story_id)
444 video_id = self._search_regex(
445 r'data-video(?:id)?="(\d
+)"', webpage, 'video id')
447 data = self._download_json(
448 'http://bits.orf.at/filehandler/static-api/json/current/data.json?file=%s' % video_id,
451 duration = float_or_none(data['duration'], 1000)
453 video = data['sources']['default']
454 load_balancer_url = video['loadBalancerUrl']
455 abr = int_or_none(video.get('audioBitrate'))
456 vbr = int_or_none(video.get('bitrate'))
457 fps = int_or_none(video.get('videoFps'))
458 width = int_or_none(video.get('videoWidth'))
459 height = int_or_none(video.get('videoHeight'))
460 thumbnail = video.get('preview')
462 rendition = self._download_json(
463 load_balancer_url, video_id, transform_source=strip_jsonp)
474 for format_id, format_url in rendition['redirect'].items():
475 if format_id == 'rtmp':
479 'format_id': format_id,
482 elif determine_ext(format_url) == 'f4m':
483 formats.extend(self._extract_f4m_formats(
484 format_url, video_id, f4m_id=format_id))
485 elif determine_ext(format_url) == 'm3u8':
486 formats.extend(self._extract_m3u8_formats(
487 format_url, video_id, 'mp4', m3u8_id=format_id))
490 self._sort_formats(formats)
492 title = remove_end(self._og_search_title(webpage), ' - iptv.ORF.at')
493 description = self._og_search_description(webpage)
494 upload_date = unified_strdate(self._html_search_meta(
495 'dc.date', webpage, 'upload date'))
500 'description': description,
501 'duration': duration,
502 'thumbnail': thumbnail,
503 'upload_date': upload_date,
508 class ORFFM4StoryIE(InfoExtractor):
509 IE_NAME = 'orf:fm4:story'
510 IE_DESC = 'fm4.orf.at stories'
511 _VALID_URL = r'https?://fm4\.orf\.at/stories/(?P<id>\d+)'
514 'url': 'http://fm4.orf.at/stories/2865738/',
516 'md5': 'e1c2c706c45c7b34cf478bbf409907ca',
520 'title': 'Manu Delago und Inner Tongue live',
521 'description': 'Manu Delago und Inner Tongue haben bei der FM4 Soundpark Session live alles gegeben. Hier gibt es Fotos und die gesamte Session als Video.',
523 'thumbnail': r're:^https?://.*\.jpg$',
524 'upload_date': '20170913',
527 'md5': 'c6dd2179731f86f4f55a7b49899d515f',
531 'title': 'Manu Delago und Inner Tongue live (2)',
533 'thumbnail': r're:^https?://.*\.jpg$',
534 'upload_date': '20170913',
535 'description': 'Manu Delago und Inner Tongue haben bei der FM4 Soundpark Session live alles gegeben. Hier gibt es Fotos und die gesamte Session als Video.',
540 def _real_extract(self, url):
541 story_id = self._match_id(url)
542 webpage = self._download_webpage(url, story_id)
545 all_ids = orderedSet(re.findall(r'data-video(?:id)?="(\d
+)"', webpage))
546 for idx, video_id in enumerate(all_ids):
547 data = self._download_json(
548 'http://bits.orf.at/filehandler/static-api/json/current/data.json?file=%s' % video_id,
551 duration = float_or_none(data['duration'], 1000)
553 video = data['sources']['q8c']
554 load_balancer_url = video['loadBalancerUrl']
555 abr = int_or_none(video.get('audioBitrate'))
556 vbr = int_or_none(video.get('bitrate'))
557 fps = int_or_none(video.get('videoFps'))
558 width = int_or_none(video.get('videoWidth'))
559 height = int_or_none(video.get('videoHeight'))
560 thumbnail = video.get('preview')
562 rendition = self._download_json(
563 load_balancer_url, video_id, transform_source=strip_jsonp)
574 for format_id, format_url in rendition['redirect'].items():
575 if format_id == 'rtmp':
579 'format_id': format_id,
582 elif determine_ext(format_url) == 'f4m':
583 formats.extend(self._extract_f4m_formats(
584 format_url, video_id, f4m_id=format_id))
585 elif determine_ext(format_url) == 'm3u8':
586 formats.extend(self._extract_m3u8_formats(
587 format_url, video_id, 'mp4', m3u8_id=format_id))
590 self._sort_formats(formats)
592 title = remove_end(self._og_search_title(webpage), ' - fm4.ORF.at')
594 # Titles are duplicates, make them unique
595 title += ' (' + str(idx + 1) + ')'
596 description = self._og_search_description(webpage)
597 upload_date = unified_strdate(self._html_search_meta(
598 'dc.date', webpage, 'upload date'))
603 'description': description,
604 'duration': duration,
605 'thumbnail': thumbnail,
606 'upload_date': upload_date,
610 return self.playlist_result(entries)