]>
Commit | Line | Data |
---|---|---|
66c43a53 | 1 | from .common import InfoExtractor |
0d2fb1d1 | 2 | from ..utils import js_to_json |
66c43a53 NL |
3 | |
4 | ||
5 | class 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']] | |
960f3171 | 32 | self._sort_formats(formats) |
66c43a53 NL |
33 | |
34 | return { | |
960f3171 | 35 | 'id': video_id, |
66c43a53 NL |
36 | 'title': self._og_search_title(webpage).replace('Video: ', ''), |
37 | 'description': self._og_search_description(webpage), | |
960f3171 | 38 | 'formats': formats, |
66c43a53 | 39 | } |