5 from .common
import InfoExtractor
21 from ..utils
.traversal
import traverse_obj
24 class ORFRadioIE(InfoExtractor
):
28 'fm4': ('fm4', 'fm4', 'orffm4'),
29 'noe': ('noe', 'oe2n', 'orfnoe'),
30 'wien': ('wie', 'oe2w', 'orfwie'),
31 'burgenland': ('bgl', 'oe2b', 'orfbgl'),
32 'ooe': ('ooe', 'oe2o', 'orfooe'),
33 'steiermark': ('stm', 'oe2st', 'orfstm'),
34 'kaernten': ('ktn', 'oe2k', 'orfktn'),
35 'salzburg': ('sbg', 'oe2s', 'orfsbg'),
36 'tirol': ('tir', 'oe2t', 'orftir'),
37 'vorarlberg': ('vbg', 'oe2v', 'orfvbg'),
38 'oe3': ('oe3', 'oe3', 'orfoe3'),
39 'oe1': ('oe1', 'oe1', 'orfoe1'),
41 _STATION_RE
= '|'.join(map(re
.escape
, STATION_INFO
.keys()))
43 _VALID_URL
= rf
'''(?x)
45 (?P<station>{_STATION_RE})\.orf\.at/player|
46 radiothek\.orf\.at/(?P<station2>{_STATION_RE})
47 )/(?P<date>[0-9]+)/(?P<show>\w+)'''
50 'url': 'https://radiothek.orf.at/ooe/20220801/OGMO',
53 'title': 'Guten Morgen OÖ',
54 'description': 'md5:a3f6083399ef92b8cbe2d421b180835a',
57 'md5': 'f33147d954a326e338ea52572c2810e8',
59 'id': '2022-08-01_0459_tl_66_7DaysMon1_319062',
61 'title': 'Guten Morgen OÖ',
62 'upload_date': '20220801',
64 'timestamp': 1659322789,
65 'description': 'md5:a3f6083399ef92b8cbe2d421b180835a',
69 'url': 'https://ooe.orf.at/player/20220801/OGMO',
72 'title': 'Guten Morgen OÖ',
73 'description': 'md5:a3f6083399ef92b8cbe2d421b180835a',
76 'md5': 'f33147d954a326e338ea52572c2810e8',
78 'id': '2022-08-01_0459_tl_66_7DaysMon1_319062',
80 'title': 'Guten Morgen OÖ',
81 'upload_date': '20220801',
83 'timestamp': 1659322789,
84 'description': 'md5:a3f6083399ef92b8cbe2d421b180835a',
88 'url': 'http://fm4.orf.at/player/20170107/4CC',
89 'only_matching': True,
91 'url': 'https://noe.orf.at/player/20200423/NGM',
92 'only_matching': True,
94 'url': 'https://wien.orf.at/player/20200423/WGUM',
95 'only_matching': True,
97 'url': 'https://burgenland.orf.at/player/20200423/BGM',
98 'only_matching': True,
100 'url': 'https://steiermark.orf.at/player/20200423/STGMS',
101 'only_matching': True,
103 'url': 'https://kaernten.orf.at/player/20200423/KGUMO',
104 'only_matching': True,
106 'url': 'https://salzburg.orf.at/player/20200423/SGUM',
107 'only_matching': True,
109 'url': 'https://tirol.orf.at/player/20200423/TGUMO',
110 'only_matching': True,
112 'url': 'https://vorarlberg.orf.at/player/20200423/VGUM',
113 'only_matching': True,
115 'url': 'https://oe3.orf.at/player/20200424/3WEK',
116 'only_matching': True,
118 'url': 'http://oe1.orf.at/player/20170108/456544',
119 'md5': '34d8a6e67ea888293741c86a099b745b',
121 'id': '2017-01-08_0759_tl_51_7DaysSun6_256141',
123 'title': 'Morgenjournal',
125 'timestamp': 1483858796,
126 'upload_date': '20170108',
128 'skip': 'Shows from ORF radios are only available for 7 days.'
131 def _entries(self
, data
, station
):
132 _
, loop_station
, old_ie
= self
.STATION_INFO
[station
]
133 for info
in data
['streams']:
134 item_id
= info
.get('loopStreamId')
137 video_id
= item_id
.replace('.mp3', '')
141 'url': f
'https://loopstream01.apa.at/?channel={loop_station}&id={item_id}',
142 '_old_archive_ids': [make_archive_id(old_ie
, video_id
)],
143 'title': data
.get('title'),
144 'description': clean_html(data
.get('subtitle')),
145 'duration': try_call(lambda: (info
['end'] - info
['start']) / 1000),
146 'timestamp': int_or_none(info
.get('start'), scale
=1000),
147 'series': data
.get('programTitle'),
150 def _real_extract(self
, url
):
151 station
, station2
, show_date
, show_id
= self
._match
_valid
_url
(url
).group('station', 'station2', 'date', 'show')
152 api_station
, _
, _
= self
.STATION_INFO
[station
or station2
]
153 data
= self
._download
_json
(
154 f
'http://audioapi.orf.at/{api_station}/api/json/current/broadcast/{show_id}/{show_date}', show_id
)
156 return self
.playlist_result(
157 self
._entries
(data
, station
or station2
), show_id
, data
.get('title'), clean_html(data
.get('subtitle')))
160 class ORFPodcastIE(InfoExtractor
):
161 IE_NAME
= 'orf:podcast'
162 _STATION_RE
= '|'.join(map(re
.escape
, (
163 'bgl', 'fm4', 'ktn', 'noe', 'oe1', 'oe3',
164 'ooe', 'sbg', 'stm', 'tir', 'tv', 'vbg', 'wie')))
165 _VALID_URL
= rf
'https?://sound\.orf\.at/podcast/(?P<station>{_STATION_RE})/(?P<show>[\w-]+)/(?P<id>[\w-]+)'
167 'url': 'https://sound.orf.at/podcast/oe3/fruehstueck-bei-mir/nicolas-stockhammer-15102023',
168 'md5': '526a5700e03d271a1505386a8721ab9b',
170 'id': 'nicolas-stockhammer-15102023',
172 'title': 'Nicolas Stockhammer (15.10.2023)',
174 'series': 'Frühstück bei mir',
176 'skip': 'ORF podcasts are only available for a limited time'
179 def _real_extract(self
, url
):
180 station
, show
, show_id
= self
._match
_valid
_url
(url
).group('station', 'show', 'id')
181 data
= self
._download
_json
(
182 f
'https://audioapi.orf.at/radiothek/api/2.0/podcast/{station}/{show}/{show_id}', show_id
)
188 **traverse_obj(data
, ('payload', {
189 'url': ('enclosures', 0, 'url'),
190 'ext': ('enclosures', 0, 'type', {mimetype2ext}
),
192 'description': ('description', {clean_html}
),
193 'duration': ('duration', {functools.partial(float_or_none, scale=1000)}
),
194 'series': ('podcast', 'title'),
199 class ORFIPTVIE(InfoExtractor
):
201 IE_DESC
= 'iptv.ORF.at'
202 _VALID_URL
= r
'https?://iptv\.orf\.at/(?:#/)?stories/(?P<id>\d+)'
205 'url': 'http://iptv.orf.at/stories/2275236/',
206 'md5': 'c8b22af4718a4b4af58342529453e3e5',
210 'title': 'Weitere Evakuierungen um Vulkan Calbuco',
211 'description': 'md5:d689c959bdbcf04efeddedbf2299d633',
213 'thumbnail': r
're:^https?://.*\.jpg$',
214 'upload_date': '20150425',
218 def _real_extract(self
, url
):
219 story_id
= self
._match
_id
(url
)
221 webpage
= self
._download
_webpage
(
222 'http://iptv.orf.at/stories/%s' % story_id
, story_id
)
224 video_id
= self
._search
_regex
(
225 r
'data-video(?:id)?="(\d+)"', webpage
, 'video id')
227 data
= self
._download
_json
(
228 'http://bits.orf.at/filehandler/static-api/json/current/data.json?file=%s' % video_id
,
231 duration
= float_or_none(data
['duration'], 1000)
233 video
= data
['sources']['default']
234 load_balancer_url
= video
['loadBalancerUrl']
235 abr
= int_or_none(video
.get('audioBitrate'))
236 vbr
= int_or_none(video
.get('bitrate'))
237 fps
= int_or_none(video
.get('videoFps'))
238 width
= int_or_none(video
.get('videoWidth'))
239 height
= int_or_none(video
.get('videoHeight'))
240 thumbnail
= video
.get('preview')
242 rendition
= self
._download
_json
(
243 load_balancer_url
, video_id
, transform_source
=strip_jsonp
)
254 for format_id
, format_url
in rendition
['redirect'].items():
255 if format_id
== 'rtmp':
259 'format_id': format_id
,
262 elif determine_ext(format_url
) == 'f4m':
263 formats
.extend(self
._extract
_f
4m
_formats
(
264 format_url
, video_id
, f4m_id
=format_id
))
265 elif determine_ext(format_url
) == 'm3u8':
266 formats
.extend(self
._extract
_m
3u8_formats
(
267 format_url
, video_id
, 'mp4', m3u8_id
=format_id
))
271 title
= remove_end(self
._og
_search
_title
(webpage
), ' - iptv.ORF.at')
272 description
= self
._og
_search
_description
(webpage
)
273 upload_date
= unified_strdate(self
._html
_search
_meta
(
274 'dc.date', webpage
, 'upload date'))
279 'description': description
,
280 'duration': duration
,
281 'thumbnail': thumbnail
,
282 'upload_date': upload_date
,
287 class ORFFM4StoryIE(InfoExtractor
):
288 IE_NAME
= 'orf:fm4:story'
289 IE_DESC
= 'fm4.orf.at stories'
290 _VALID_URL
= r
'https?://fm4\.orf\.at/stories/(?P<id>\d+)'
293 'url': 'http://fm4.orf.at/stories/2865738/',
295 'md5': 'e1c2c706c45c7b34cf478bbf409907ca',
299 'title': 'Manu Delago und Inner Tongue live',
300 '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.',
302 'thumbnail': r
're:^https?://.*\.jpg$',
303 'upload_date': '20170913',
306 'md5': 'c6dd2179731f86f4f55a7b49899d515f',
310 'title': 'Manu Delago und Inner Tongue live (2)',
312 'thumbnail': r
're:^https?://.*\.jpg$',
313 'upload_date': '20170913',
314 '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.',
319 def _real_extract(self
, url
):
320 story_id
= self
._match
_id
(url
)
321 webpage
= self
._download
_webpage
(url
, story_id
)
324 all_ids
= orderedSet(re
.findall(r
'data-video(?:id)?="(\d+)"', webpage
))
325 for idx
, video_id
in enumerate(all_ids
):
326 data
= self
._download
_json
(
327 'http://bits.orf.at/filehandler/static-api/json/current/data.json?file=%s' % video_id
,
330 duration
= float_or_none(data
['duration'], 1000)
332 video
= data
['sources']['q8c']
333 load_balancer_url
= video
['loadBalancerUrl']
334 abr
= int_or_none(video
.get('audioBitrate'))
335 vbr
= int_or_none(video
.get('bitrate'))
336 fps
= int_or_none(video
.get('videoFps'))
337 width
= int_or_none(video
.get('videoWidth'))
338 height
= int_or_none(video
.get('videoHeight'))
339 thumbnail
= video
.get('preview')
341 rendition
= self
._download
_json
(
342 load_balancer_url
, video_id
, transform_source
=strip_jsonp
)
353 for format_id
, format_url
in rendition
['redirect'].items():
354 if format_id
== 'rtmp':
358 'format_id': format_id
,
361 elif determine_ext(format_url
) == 'f4m':
362 formats
.extend(self
._extract
_f
4m
_formats
(
363 format_url
, video_id
, f4m_id
=format_id
))
364 elif determine_ext(format_url
) == 'm3u8':
365 formats
.extend(self
._extract
_m
3u8_formats
(
366 format_url
, video_id
, 'mp4', m3u8_id
=format_id
))
370 title
= remove_end(self
._og
_search
_title
(webpage
), ' - fm4.ORF.at')
372 # Titles are duplicates, make them unique
373 title
+= ' (' + str(idx
+ 1) + ')'
374 description
= self
._og
_search
_description
(webpage
)
375 upload_date
= unified_strdate(self
._html
_search
_meta
(
376 'dc.date', webpage
, 'upload date'))
381 'description': description
,
382 'duration': duration
,
383 'thumbnail': thumbnail
,
384 'upload_date': upload_date
,
388 return self
.playlist_result(entries
)
391 class ORFONIE(InfoExtractor
):
393 _VALID_URL
= r
'https?://on\.orf\.at/video/(?P<id>\d+)'
395 'url': 'https://on.orf.at/video/14210000/school-of-champions-48',
400 'thumbnail': 'https://api-tvthek.orf.at/assets/segments/0167/98/thumb_16697671_segments_highlight_teaser.jpeg',
401 'title': 'School of Champions (4/8)',
402 'description': 'md5:d09ad279fc2e8502611e7648484b6afd',
403 'media_type': 'episode',
404 'timestamp': 1706472362,
405 'upload_date': '20240128',
406 '_old_archive_ids': ['orftvthek 14210000'],
409 'url': 'https://on.orf.at/video/3220355',
410 'md5': 'f94d98e667cf9a3851317efb4e136662',
415 'thumbnail': 'https://api-tvthek.orf.at/assets/segments/0002/60/thumb_159573_segments_highlight_teaser.png',
416 'title': '50 Jahre Burgenland: Der Festumzug',
417 'description': 'md5:1560bf855119544ee8c4fa5376a2a6b0',
418 'media_type': 'episode',
419 'timestamp': 52916400,
420 'upload_date': '19710905',
421 '_old_archive_ids': ['orftvthek 3220355'],
425 def _extract_video(self
, video_id
):
426 encrypted_id
= base64
.b64encode(f
'3dSlfek03nsLKdj4Jsd{video_id}'.encode()).decode()
427 api_json
= self
._download
_json
(
428 f
'https://api-tvthek.orf.at/api/v4.3/public/episode/encrypted/{encrypted_id}', video_id
)
430 if traverse_obj(api_json
, 'is_drm_protected'):
431 self
.report_drm(video_id
)
433 formats
, subtitles
= [], {}
434 for manifest_type
in traverse_obj(api_json
, ('sources', {dict.keys}
, ...)):
435 for manifest_url
in traverse_obj(api_json
, ('sources', manifest_type
, ..., 'src', {url_or_none}
)):
436 if manifest_type
== 'hls':
437 fmts
, subs
= self
._extract
_m
3u8_formats
_and
_subtitles
(
438 manifest_url
, video_id
, fatal
=False, m3u8_id
='hls')
439 elif manifest_type
== 'dash':
440 fmts
, subs
= self
._extract
_mpd
_formats
_and
_subtitles
(
441 manifest_url
, video_id
, fatal
=False, mpd_id
='dash')
445 self
._merge
_subtitles
(subs
, target
=subtitles
)
447 for sub_url
in traverse_obj(api_json
, (
448 '_embedded', 'subtitle',
449 ('xml_url', 'sami_url', 'stl_url', 'ttml_url', 'srt_url', 'vtt_url'), {url_or_none}
)):
450 self
._merge
_subtitles
({'de': [{'url': sub_url}
]}, target
=subtitles
)
455 'subtitles': subtitles
,
456 '_old_archive_ids': [make_archive_id('ORFTVthek', video_id
)],
457 **traverse_obj(api_json
, {
458 'age_limit': ('age_classification', {parse_age_limit}
),
459 'duration': ('duration_second', {float_or_none}
),
460 'title': (('title', 'headline'), {str}
),
461 'description': (('description', 'teaser_text'), {str}
),
462 'media_type': ('video_type', {str}
),
466 def _real_extract(self
, url
):
467 video_id
= self
._match
_id
(url
)
468 webpage
= self
._download
_webpage
(url
, video_id
)
472 'title': self
._html
_search
_meta
(['og:title', 'twitter:title'], webpage
, default
=None),
473 'description': self
._html
_search
_meta
(
474 ['description', 'og:description', 'twitter:description'], webpage
, default
=None),
475 **self
._search
_json
_ld
(webpage
, video_id
, fatal
=False),
476 **self
._extract
_video
(video_id
),