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