1 from .common
import InfoExtractor
2 from ..utils
import float_or_none
, mimetype2ext
, traverse_obj
5 class BerufeTVIE(InfoExtractor
):
6 _VALID_URL
= r
'https?://(?:www\.)?web\.arbeitsagentur\.de/berufetv/[^?#]+/film;filmId=(?P<id>[\w-]+)'
8 'url': 'https://web.arbeitsagentur.de/berufetv/studienberufe/wirtschaftswissenschaften/wirtschaftswissenschaften-volkswirtschaft/film;filmId=DvKC3DUpMKvUZ_6fEnfg3u',
9 'md5': '041b6432ec8e6838f84a5c30f31cc795',
11 'id': 'DvKC3DUpMKvUZ_6fEnfg3u',
13 'title': 'Volkswirtschaftslehre',
14 'description': 'md5:6bd87d0c63163480a6489a37526ee1c1',
15 'categories': ['Studien­beruf'],
16 'tags': ['Studienfilm'],
18 'thumbnail': r
're:^https://asset-out-cdn\.video-cdn\.net/private/videos/DvKC3DUpMKvUZ_6fEnfg3u/thumbnails/793063\?quality=thumbnail&__token__=[^\s]+$',
22 def _real_extract(self
, url
):
23 video_id
= self
._match
_id
(url
)
25 movie_metadata
= self
._download
_json
(
26 'https://rest.arbeitsagentur.de/infosysbub/berufetv/pc/v1/film-metadata',
27 video_id
, 'Downloading JSON metadata',
28 headers
={'X-API-Key': '79089773-4892-4386-86e6-e8503669f426'}, fatal
=False)
31 movie_metadata
, ('metadaten', lambda _
, i
: video_id
== i
['miId']),
32 get_all
=False, default
={})
34 video
= self
._download
_json
(
35 f
'https://d.video-cdn.net/play/player/8YRzUk6pTzmBdrsLe9Y88W/video/{video_id}',
36 video_id
, 'Downloading video JSON')
38 formats
, subtitles
= [], {}
39 for key
, source
in video
['videoSources']['html'].items():
41 fmts
, subs
= self
._extract
_m
3u8_formats
_and
_subtitles
(source
[0]['source'], video_id
)
46 'url': source
[0]['source'],
47 'ext': mimetype2ext(source
[0]['mimeType']),
51 for track
in video
.get('videoTracks') or []:
52 if track
.get('type') != 'SUBTITLES':
54 subtitles
.setdefault(track
['language'], []).append({
55 'url': track
['source'],
56 'name': track
.get('label'),
62 'title': meta
.get('titel') or traverse_obj(video
, ('videoMetaData', 'title')),
63 'description': meta
.get('beschreibung'),
64 'thumbnail': meta
.get('thumbnail') or f
'https://asset-out-cdn.video-cdn.net/private/videos/{video_id}/thumbnails/active',
65 'duration': float_or_none(video
.get('duration'), scale
=1000),
66 'categories': [meta
['kategorie']] if meta
.get('kategorie') else None,
67 'tags': meta
.get('themengebiete'),
68 'subtitles': subtitles
,