aboutsummaryrefslogtreecommitdiffstats
path: root/hypervideo_dl/extractor/fczenit.py
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2021-06-09 17:54:27 -0500
committerJesús <heckyel@hyperbola.info>2021-06-09 17:54:27 -0500
commit27fe903c511691c078942bef5ee9a05a43b15c8f (patch)
tree50f30ab2ec749b965869518c0a28651f8677f0d3 /hypervideo_dl/extractor/fczenit.py
downloadhypervideo-27fe903c511691c078942bef5ee9a05a43b15c8f.tar.lz
hypervideo-27fe903c511691c078942bef5ee9a05a43b15c8f.tar.xz
hypervideo-27fe903c511691c078942bef5ee9a05a43b15c8f.zip
initial
Diffstat (limited to 'hypervideo_dl/extractor/fczenit.py')
-rw-r--r--hypervideo_dl/extractor/fczenit.py56
1 files changed, 56 insertions, 0 deletions
diff --git a/hypervideo_dl/extractor/fczenit.py b/hypervideo_dl/extractor/fczenit.py
new file mode 100644
index 0000000..8db7c59
--- /dev/null
+++ b/hypervideo_dl/extractor/fczenit.py
@@ -0,0 +1,56 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ float_or_none,
+)
+
+
+class FczenitIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?fc-zenit\.ru/video/(?P<id>[0-9]+)'
+ _TEST = {
+ 'url': 'http://fc-zenit.ru/video/41044/',
+ 'md5': '0e3fab421b455e970fa1aa3891e57df0',
+ 'info_dict': {
+ 'id': '41044',
+ 'ext': 'mp4',
+ 'title': 'Так пишется история: казанский разгром ЦСКА на «Зенит-ТВ»',
+ 'timestamp': 1462283735,
+ 'upload_date': '20160503',
+ },
+ }
+
+ def _real_extract(self, url):
+ video_id = self._match_id(url)
+ webpage = self._download_webpage(url, video_id)
+
+ msi_id = self._search_regex(
+ r"(?s)config\s*=\s*{.+?video_id\s*:\s*'([^']+)'", webpage, 'msi id')
+
+ msi_data = self._download_json(
+ 'http://player.fc-zenit.ru/msi/video', msi_id, query={
+ 'video': msi_id,
+ })['data']
+ title = msi_data['name']
+
+ formats = [{
+ 'format_id': q.get('label'),
+ 'url': q['url'],
+ 'height': int_or_none(q.get('label')),
+ } for q in msi_data['qualities'] if q.get('url')]
+
+ self._sort_formats(formats)
+
+ tags = [tag['label'] for tag in msi_data.get('tags', []) if tag.get('label')]
+
+ return {
+ 'id': video_id,
+ 'title': title,
+ 'thumbnail': msi_data.get('preview'),
+ 'formats': formats,
+ 'duration': float_or_none(msi_data.get('duration')),
+ 'timestamp': int_or_none(msi_data.get('date')),
+ 'tags': tags,
+ }