mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-24 19:17:34 -05:00
86e5f3ed2e
Using https://github.com/asottile/pyupgrade 1. `__future__` imports and `coding: utf-8` were removed 2. Files were rewritten with `pyupgrade --py36-plus --keep-percent-format` 3. f-strings were cherry-picked from `pyupgrade --py36-plus` Extractors are left untouched (except removing header) to avoid unnecessary merge conflicts
40 lines
1.3 KiB
Python
40 lines
1.3 KiB
Python
from .common import InfoExtractor
|
|
from ..utils import js_to_json
|
|
|
|
|
|
class HelsinkiIE(InfoExtractor):
|
|
IE_DESC = 'helsinki.fi'
|
|
_VALID_URL = r'https?://video\.helsinki\.fi/Arkisto/flash\.php\?id=(?P<id>\d+)'
|
|
_TEST = {
|
|
'url': 'http://video.helsinki.fi/Arkisto/flash.php?id=20258',
|
|
'info_dict': {
|
|
'id': '20258',
|
|
'ext': 'mp4',
|
|
'title': 'Tietotekniikkafoorumi-iltapäivä',
|
|
'description': 'md5:f5c904224d43c133225130fe156a5ee0',
|
|
},
|
|
'params': {
|
|
'skip_download': True, # RTMP
|
|
}
|
|
}
|
|
|
|
def _real_extract(self, url):
|
|
video_id = self._match_id(url)
|
|
webpage = self._download_webpage(url, video_id)
|
|
|
|
params = self._parse_json(self._html_search_regex(
|
|
r'(?s)jwplayer\("player"\).setup\((\{.*?\})\);',
|
|
webpage, 'player code'), video_id, transform_source=js_to_json)
|
|
formats = [{
|
|
'url': s['file'],
|
|
'ext': 'mp4',
|
|
} for s in params['sources']]
|
|
self._sort_formats(formats)
|
|
|
|
return {
|
|
'id': video_id,
|
|
'title': self._og_search_title(webpage).replace('Video: ', ''),
|
|
'description': self._og_search_description(webpage),
|
|
'formats': formats,
|
|
}
|