]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/helsinki.py
[ie/box] Fix formats extraction (#8649)
[yt-dlp.git] / yt_dlp / extractor / helsinki.py
CommitLineData
66c43a53 1from .common import InfoExtractor
0d2fb1d1 2from ..utils import js_to_json
66c43a53
NL
3
4
5class HelsinkiIE(InfoExtractor):
960f3171 6 IE_DESC = 'helsinki.fi'
66c43a53
NL
7 _VALID_URL = r'https?://video\.helsinki\.fi/Arkisto/flash\.php\?id=(?P<id>\d+)'
8 _TEST = {
9 'url': 'http://video.helsinki.fi/Arkisto/flash.php?id=20258',
66c43a53
NL
10 'info_dict': {
11 'id': '20258',
12 'ext': 'mp4',
13 'title': 'Tietotekniikkafoorumi-iltapäivä',
960f3171
PH
14 'description': 'md5:f5c904224d43c133225130fe156a5ee0',
15 },
16 'params': {
17 'skip_download': True, # RTMP
66c43a53
NL
18 }
19 }
20
21 def _real_extract(self, url):
0d2fb1d1 22 video_id = self._match_id(url)
960f3171 23 webpage = self._download_webpage(url, video_id)
960f3171 24
0d2fb1d1
PH
25 params = self._parse_json(self._html_search_regex(
26 r'(?s)jwplayer\("player"\).setup\((\{.*?\})\);',
27 webpage, 'player code'), video_id, transform_source=js_to_json)
28 formats = [{
29 'url': s['file'],
30 'ext': 'mp4',
31 } for s in params['sources']]
66c43a53
NL
32
33 return {
960f3171 34 'id': video_id,
66c43a53
NL
35 'title': self._og_search_title(webpage).replace('Video: ', ''),
36 'description': self._og_search_description(webpage),
960f3171 37 'formats': formats,
66c43a53 38 }