]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/orf.py
2 from __future__
import unicode_literals
6 from . common
import InfoExtractor
7 from .. compat
import compat_str
25 class ORFTVthekIE ( InfoExtractor
):
26 IE_NAME
= 'orf:tvthek'
27 IE_DESC
= 'ORF TVthek'
28 _VALID_URL
= r
'https?://tvthek\.orf\.at/(?:[^/]+/)+(?P<id>\d+)'
31 'url' : 'http://tvthek.orf.at/program/Aufgetischt/2745173/Aufgetischt-Mit-der-Steirischen-Tafelrunde/8891389' ,
33 'md5' : '2942210346ed779588f428a92db88712' ,
37 'title' : 'Aufgetischt: Mit der Steirischen Tafelrunde' ,
38 'description' : 'md5:c1272f0245537812d4e36419c207b67d' ,
40 'upload_date' : '20141208' ,
43 'skip' : 'Blocked outside of Austria / Germany' ,
45 'url' : 'http://tvthek.orf.at/topic/Im-Wandel-der-Zeit/8002126/Best-of-Ingrid-Thurnher/7982256' ,
49 'title' : 'Best of Ingrid Thurnher' ,
50 'upload_date' : '20140527' ,
51 '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".' ,
54 'skip_download' : True , # rtsp downloads
56 'skip' : 'Blocked outside of Austria / Germany' ,
58 'url' : 'http://tvthek.orf.at/topic/Fluechtlingskrise/10463081/Heimat-Fremde-Heimat/13879132/Senioren-betreuen-Migrantenkinder/13879141' ,
59 'only_matching' : True ,
61 'url' : 'http://tvthek.orf.at/profile/Universum/35429' ,
62 'only_matching' : True ,
65 def _real_extract ( self
, url
):
66 playlist_id
= self
._ match
_ id
( url
)
67 webpage
= self
._ download
_ webpage
( url
, playlist_id
)
69 data_jsb
= self
._ parse
_ json
(
71 r
'<div[^>]+class=(["\' ]).* ?VideoPlaylist
.* ?\
1 [ ^
>]+ data
- jsb
=([ " \' ])(?P<json>.+?)\2',
72 webpage, 'playlist', group='json'),
73 playlist_id, transform_source=unescapeHTML)['playlist']['videos']
77 video_id, title = sd.get('id'), sd.get('title')
78 if not video_id or not title:
80 video_id = compat_str(video_id)
82 for fd in sd['sources']:
83 src = url_or_none(fd.get('src'))
86 format_id = join_nonempty('delivery', 'quality', 'quality_string', from_dict=fd)
87 ext = determine_ext(src)
89 m3u8_formats = self._extract_m3u8_formats(
90 src, video_id, 'mp4', m3u8_id=format_id, fatal=False)
91 if any('/geoprotection' in f['url'] for f in m3u8_formats):
92 self.raise_geo_restricted()
93 formats.extend(m3u8_formats)
95 formats.extend(self._extract_f4m_formats(
96 src, video_id, f4m_id=format_id, fatal=False))
98 formats.extend(self._extract_mpd_formats(
99 src, video_id, mpd_id=format_id, fatal=False))
102 'format_id': format_id,
104 'protocol': fd.get('protocol'),
107 # Check for geoblocking.
108 # There is a property is_geoprotection, but that's always false
109 geo_str = sd.get('geoprotection_string')
115 if re.match(r'^https?://.*\.mp4$', f['url']))
116 except StopIteration:
119 req = HEADRequest(http_url)
120 self._request_webpage(
122 note='Testing for geoblocking',
124 'This video seems to be blocked outside of %s . '
125 'You may want to try the streaming-* formats.')
129 self._check_formats(formats, video_id)
130 self._sort_formats(formats)
133 for sub in sd.get('subtitles', []):
134 sub_src = sub.get('src')
137 subtitles.setdefault(sub.get('lang', 'de-AT'), []).append({
141 upload_date = unified_strdate(sd.get('created_date'))
144 preview = sd.get('preview_image_url')
151 image = sd.get('image_full_url')
152 if not image and len(data_jsb) == 1:
153 image = self._og_search_thumbnail(webpage)
166 'subtitles': subtitles,
167 'description': sd.get('description'),
168 'duration': int_or_none(sd.get('duration_in_seconds')),
169 'upload_date': upload_date,
170 'thumbnails': thumbnails,
180 class ORFRadioIE(InfoExtractor):
181 def _real_extract(self, url):
182 mobj = self._match_valid_url(url)
183 show_date = mobj.group('date')
184 show_id = mobj.group('show')
186 data = self._download_json(
187 'http://audioapi.orf.at/ %s /api/json/current/broadcast/ %s / %s '
188 % (self._API_STATION, show_id, show_date), show_id)
191 for info in data['streams']:
192 loop_stream_id = str_or_none(info.get('loopStreamId'))
193 if not loop_stream_id:
195 title = str_or_none(data.get('title'))
198 start = int_or_none(info.get('start'), scale=1000)
199 end = int_or_none(info.get('end'), scale=1000)
200 duration = end - start if end and start else None
202 'id': loop_stream_id.replace('.mp3', ''),
203 'url': 'https://loopstream01.apa.at/?channel= %s &id= %s ' % (self._LOOP_STATION, loop_stream_id),
205 'description': clean_html(data.get('subtitle')),
206 'duration': duration,
209 'series': data.get('programTitle'),
215 'title': data.get('title'),
216 'description': clean_html(data.get('subtitle')),
221 class ORFFM4IE(ORFRadioIE):
223 IE_DESC = 'radio FM4'
224 _VALID_URL = r'https?://(?P<station>fm4)\.orf\.at/player/(?P<date>[0-9]+)/(?P<show>4\w+)'
226 _LOOP_STATION = 'fm4'
229 'url': 'http://fm4.orf.at/player/20170107/4CC',
230 'md5': '2b0be47375432a7ef104453432a19212',
232 'id': '2017-01-07_2100_tl_54_7DaysSat18_31295',
234 'title': 'Solid Steel Radioshow',
235 'description': 'Die Mixshow von Coldcut und Ninja Tune.',
237 'timestamp': 1483819257,
238 'upload_date': '20170107',
240 'skip': 'Shows from ORF radios are only available for 7 days.',
241 'only_matching': True,
245 class ORFNOEIE(ORFRadioIE):
247 IE_DESC = 'Radio Niederösterreich'
248 _VALID_URL = r'https?://(?P<station>noe)\.orf\.at/player/(?P<date>[0-9]+)/(?P<show>\w+)'
250 _LOOP_STATION = 'oe2n'
253 'url': 'https://noe.orf.at/player/20200423/NGM',
254 'only_matching': True,
258 class ORFWIEIE(ORFRadioIE):
260 IE_DESC = 'Radio Wien'
261 _VALID_URL = r'https?://(?P<station>wien)\.orf\.at/player/(?P<date>[0-9]+)/(?P<show>\w+)'
263 _LOOP_STATION = 'oe2w'
266 'url': 'https://wien.orf.at/player/20200423/WGUM',
267 'only_matching': True,
271 class ORFBGLIE(ORFRadioIE):
272 IE_NAME = 'orf:burgenland'
273 IE_DESC = 'Radio Burgenland'
274 _VALID_URL = r'https?://(?P<station>burgenland)\.orf\.at/player/(?P<date>[0-9]+)/(?P<show>\w+)'
276 _LOOP_STATION = 'oe2b'
279 'url': 'https://burgenland.orf.at/player/20200423/BGM',
280 'only_matching': True,
284 class ORFOOEIE(ORFRadioIE):
285 IE_NAME = 'orf:oberoesterreich'
286 IE_DESC = 'Radio Oberösterreich'
287 _VALID_URL = r'https?://(?P<station>ooe)\.orf\.at/player/(?P<date>[0-9]+)/(?P<show>\w+)'
289 _LOOP_STATION = 'oe2o'
292 'url': 'https://ooe.orf.at/player/20200423/OGMO',
293 'only_matching': True,
297 class ORFSTMIE(ORFRadioIE):
298 IE_NAME = 'orf:steiermark'
299 IE_DESC = 'Radio Steiermark'
300 _VALID_URL = r'https?://(?P<station>steiermark)\.orf\.at/player/(?P<date>[0-9]+)/(?P<show>\w+)'
302 _LOOP_STATION = 'oe2st'
305 'url': 'https://steiermark.orf.at/player/20200423/STGMS',
306 'only_matching': True,
310 class ORFKTNIE(ORFRadioIE):
311 IE_NAME = 'orf:kaernten'
312 IE_DESC = 'Radio Kärnten'
313 _VALID_URL = r'https?://(?P<station>kaernten)\.orf\.at/player/(?P<date>[0-9]+)/(?P<show>\w+)'
315 _LOOP_STATION = 'oe2k'
318 'url': 'https://kaernten.orf.at/player/20200423/KGUMO',
319 'only_matching': True,
323 class ORFSBGIE(ORFRadioIE):
324 IE_NAME = 'orf:salzburg'
325 IE_DESC = 'Radio Salzburg'
326 _VALID_URL = r'https?://(?P<station>salzburg)\.orf\.at/player/(?P<date>[0-9]+)/(?P<show>\w+)'
328 _LOOP_STATION = 'oe2s'
331 'url': 'https://salzburg.orf.at/player/20200423/SGUM',
332 'only_matching': True,
336 class ORFTIRIE(ORFRadioIE):
337 IE_NAME = 'orf:tirol'
338 IE_DESC = 'Radio Tirol'
339 _VALID_URL = r'https?://(?P<station>tirol)\.orf\.at/player/(?P<date>[0-9]+)/(?P<show>\w+)'
341 _LOOP_STATION = 'oe2t'
344 'url': 'https://tirol.orf.at/player/20200423/TGUMO',
345 'only_matching': True,
349 class ORFVBGIE(ORFRadioIE):
350 IE_NAME = 'orf:vorarlberg'
351 IE_DESC = 'Radio Vorarlberg'
352 _VALID_URL = r'https?://(?P<station>vorarlberg)\.orf\.at/player/(?P<date>[0-9]+)/(?P<show>\w+)'
354 _LOOP_STATION = 'oe2v'
357 'url': 'https://vorarlberg.orf.at/player/20200423/VGUM',
358 'only_matching': True,
362 class ORFOE3IE(ORFRadioIE):
364 IE_DESC = 'Radio Österreich 3'
365 _VALID_URL = r'https?://(?P<station>oe3)\.orf\.at/player/(?P<date>[0-9]+)/(?P<show>\w+)'
367 _LOOP_STATION = 'oe3'
370 'url': 'https://oe3.orf.at/player/20200424/3WEK',
371 'only_matching': True,
375 class ORFOE1IE(ORFRadioIE):
377 IE_DESC = 'Radio Österreich 1'
378 _VALID_URL = r'https?://(?P<station>oe1)\.orf\.at/player/(?P<date>[0-9]+)/(?P<show>\w+)'
380 _LOOP_STATION = 'oe1'
383 'url': 'http://oe1.orf.at/player/20170108/456544',
384 'md5': '34d8a6e67ea888293741c86a099b745b',
386 'id': '2017-01-08_0759_tl_51_7DaysSun6_256141',
388 'title': 'Morgenjournal',
390 'timestamp': 1483858796,
391 'upload_date': '20170108',
393 'skip': 'Shows from ORF radios are only available for 7 days.'
397 class ORFIPTVIE(InfoExtractor):
399 IE_DESC = 'iptv.ORF.at'
400 _VALID_URL = r'https?://iptv\.orf\.at/(?:#/)?stories/(?P<id>\d+)'
403 'url': 'http://iptv.orf.at/stories/2275236/',
404 'md5': 'c8b22af4718a4b4af58342529453e3e5',
408 'title': 'Weitere Evakuierungen um Vulkan Calbuco',
409 'description': 'md5:d689c959bdbcf04efeddedbf2299d633',
411 'thumbnail': r're:^https?://.*\.jpg$',
412 'upload_date': '20150425',
416 def _real_extract(self, url):
417 story_id = self._match_id(url)
419 webpage = self._download_webpage(
420 'http://iptv.orf.at/stories/ %s ' % story_id, story_id)
422 video_id = self._search_regex(
423 r'data-video(?:id)?=" ( \d
+) "', webpage, 'video id')
425 data = self._download_json(
426 'http://bits.orf.at/filehandler/static-api/json/current/data.json?file= %s ' % video_id,
429 duration = float_or_none(data['duration'], 1000)
431 video = data['sources']['default']
432 load_balancer_url = video['loadBalancerUrl']
433 abr = int_or_none(video.get('audioBitrate'))
434 vbr = int_or_none(video.get('bitrate'))
435 fps = int_or_none(video.get('videoFps'))
436 width = int_or_none(video.get('videoWidth'))
437 height = int_or_none(video.get('videoHeight'))
438 thumbnail = video.get('preview')
440 rendition = self._download_json(
441 load_balancer_url, video_id, transform_source=strip_jsonp)
452 for format_id, format_url in rendition['redirect'].items():
453 if format_id == 'rtmp':
457 'format_id': format_id,
460 elif determine_ext(format_url) == 'f4m':
461 formats.extend(self._extract_f4m_formats(
462 format_url, video_id, f4m_id=format_id))
463 elif determine_ext(format_url) == 'm3u8':
464 formats.extend(self._extract_m3u8_formats(
465 format_url, video_id, 'mp4', m3u8_id=format_id))
468 self._sort_formats(formats)
470 title = remove_end(self._og_search_title(webpage), ' - iptv.ORF.at')
471 description = self._og_search_description(webpage)
472 upload_date = unified_strdate(self._html_search_meta(
473 'dc.date', webpage, 'upload date'))
478 'description': description,
479 'duration': duration,
480 'thumbnail': thumbnail,
481 'upload_date': upload_date,
486 class ORFFM4StoryIE(InfoExtractor):
487 IE_NAME = 'orf:fm4:story'
488 IE_DESC = 'fm4.orf.at stories'
489 _VALID_URL = r'https?://fm4\.orf\.at/stories/(?P<id>\d+)'
492 'url': 'http://fm4.orf.at/stories/2865738/',
494 'md5': 'e1c2c706c45c7b34cf478bbf409907ca',
498 'title': 'Manu Delago und Inner Tongue live',
499 '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.',
501 'thumbnail': r're:^https?://.*\.jpg$',
502 'upload_date': '20170913',
505 'md5': 'c6dd2179731f86f4f55a7b49899d515f',
509 'title': 'Manu Delago und Inner Tongue live (2)',
511 'thumbnail': r're:^https?://.*\.jpg$',
512 'upload_date': '20170913',
513 '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.',
518 def _real_extract(self, url):
519 story_id = self._match_id(url)
520 webpage = self._download_webpage(url, story_id)
523 all_ids = orderedSet(re.findall(r'data-video(?:id)?=" ( \d
+) "', webpage))
524 for idx, video_id in enumerate(all_ids):
525 data = self._download_json(
526 'http://bits.orf.at/filehandler/static-api/json/current/data.json?file= %s ' % video_id,
529 duration = float_or_none(data['duration'], 1000)
531 video = data['sources']['q8c']
532 load_balancer_url = video['loadBalancerUrl']
533 abr = int_or_none(video.get('audioBitrate'))
534 vbr = int_or_none(video.get('bitrate'))
535 fps = int_or_none(video.get('videoFps'))
536 width = int_or_none(video.get('videoWidth'))
537 height = int_or_none(video.get('videoHeight'))
538 thumbnail = video.get('preview')
540 rendition = self._download_json(
541 load_balancer_url, video_id, transform_source=strip_jsonp)
552 for format_id, format_url in rendition['redirect'].items():
553 if format_id == 'rtmp':
557 'format_id': format_id,
560 elif determine_ext(format_url) == 'f4m':
561 formats.extend(self._extract_f4m_formats(
562 format_url, video_id, f4m_id=format_id))
563 elif determine_ext(format_url) == 'm3u8':
564 formats.extend(self._extract_m3u8_formats(
565 format_url, video_id, 'mp4', m3u8_id=format_id))
568 self._sort_formats(formats)
570 title = remove_end(self._og_search_title(webpage), ' - fm4.ORF.at')
572 # Titles are duplicates, make them unique
573 title += ' (' + str(idx + 1) + ')'
574 description = self._og_search_description(webpage)
575 upload_date = unified_strdate(self._html_search_meta(
576 'dc.date', webpage, 'upload date'))
581 'description': description,
582 'duration': duration,
583 'thumbnail': thumbnail,
584 'upload_date': upload_date,
588 return self.playlist_result(entries)