4 from .common
import InfoExtractor
14 class HRFernsehenIE(InfoExtractor
):
15 IE_NAME
= 'hrfernsehen'
16 _VALID_URL
= r
'^https?://www\.(?:hr-fernsehen|hessenschau)\.de/.*,video-(?P<id>[0-9]{6})\.html'
18 'url': 'https://www.hessenschau.de/tv-sendung/hessenschau-vom-26082020,video-130546.html',
19 'md5': '5c4e0ba94677c516a2f65a84110fc536',
23 'description': 'Sturmtief Kirsten fegt über Hessen / Die Corona-Pandemie – eine Chronologie / '
24 'Sterbehilfe: Die Lage in Hessen / Miss Hessen leitet zwei eigene Unternehmen / '
25 'Pop-Up Museum zeigt Schwarze Unterhaltung und Black Music',
26 'subtitles': {'de': [{
27 'url': 'https://hr-a.akamaihd.net/video/as/hessenschau/2020_08/hrLogo_200826200407_L385592_512x288-25p-500kbit.vtt',
29 'timestamp': 1598400000,
30 'upload_date': '20200826',
31 'thumbnail': 'https://www.hessenschau.de/tv-sendung/hs_ganz-1554~_t-1598465545029_v-16to9.jpg',
32 'title': 'hessenschau vom 26.08.2020',
36 'url': 'https://www.hr-fernsehen.de/sendungen-a-z/mex/sendungen/fair-und-gut---was-hinter-aldis-eigenem-guetesiegel-steckt,video-130544.html',
37 'only_matching': True,
40 _GEO_COUNTRIES
= ['DE']
42 def extract_formats(self
, loader_data
):
44 data
= loader_data
['mediaCollection']['streams'][0]['media']
45 for inner
in data
[1:]:
47 'format_id': try_call(lambda: f
'{inner["maxHResolutionPx"]}p'),
48 'height': inner
.get('maxHResolutionPx'),
52 quality_information
= re
.search(r
'([0-9]{3,4})x([0-9]{3,4})-([0-9]{2})p-([0-9]{3,4})kbit',
54 if quality_information
:
55 stream_format
['width'] = int_or_none(quality_information
.group(1))
56 stream_format
['height'] = int_or_none(quality_information
.group(2))
57 stream_format
['fps'] = int_or_none(quality_information
.group(3))
58 stream_format
['tbr'] = int_or_none(quality_information
.group(4))
60 stream_formats
.append(stream_format
)
63 def _real_extract(self
, url
):
64 video_id
= self
._match
_id
(url
)
65 webpage
= self
._download
_webpage
(url
, video_id
)
67 title
= self
._html
_search
_meta
(
68 ['og:title', 'twitter:title', 'name'], webpage
)
69 description
= self
._html
_search
_meta
(
70 ['description'], webpage
)
72 loader_str
= unescapeHTML(self
._search
_regex
(r
"data-(?:new-)?hr-mediaplayer-loader='([^']*)'", webpage
, 'ardloader'))
73 loader_data
= json
.loads(loader_str
)
75 subtitle
= traverse_obj(loader_data
, ('mediaCollection', 'subTitles', 0, 'sources', 0, 'url'))
80 'description': description
,
81 'formats': self
.extract_formats(loader_data
),
82 'subtitles': {'de': [{'url': subtitle
}]},
83 'timestamp': unified_timestamp(self
._search
_regex
(
84 r
'<time\sdatetime="(\d{4}\W\d{1,2}\W\d{1,2})', webpage
, 'datetime', fatal
=False)),
85 'duration': int_or_none(traverse_obj(
86 loader_data
, ('playerConfig', 'pluginData', 'trackingAti@all', 'richMedia', 'duration'))),
87 'thumbnail': self
._search
_regex
(r
'thumbnailUrl\W*([^"]+)', webpage
, 'thumbnail', default
=None),