2 from __future__ import unicode_literals
4 from .common import InfoExtractor
7 compat_urllib_parse_urlparse,
17 class ArnesIE(InfoExtractor):
18 IE_NAME = 'video.arnes.si'
19 IE_DESC = 'Arnes Video'
20 _VALID_URL = r'https?://video\.arnes\.si/(?:[a-z]{2}/)?(?:watch|embed|api/(?:asset|public/video))/(?P<id>[0-9a-zA-Z]{12})'
22 'url': 'https://video.arnes.si/watch/a1qrWTOQfVoU?t=10',
23 'md5': '4d0f4d0a03571b33e1efac25fd4a065d',
27 'title': 'Linearna neodvisnost, definicija',
28 'description': 'Linearna neodvisnost, definicija',
30 'creator': 'Polona Oblak',
31 'timestamp': 1585063725,
32 'upload_date': '20200324',
33 'channel': 'Polona Oblak',
34 'channel_id': 'q6pc04hw24cj',
35 'channel_url': 'https://video.arnes.si/?channel=q6pc04hw24cj',
38 'tags': ['linearna_algebra'],
42 'url': 'https://video.arnes.si/api/asset/s1YjnV7hadlC/play.mp4',
43 'only_matching': True,
45 'url': 'https://video.arnes.si/embed/s1YjnV7hadlC',
46 'only_matching': True,
48 'url': 'https://video.arnes.si/en/watch/s1YjnV7hadlC',
49 'only_matching': True,
51 'url': 'https://video.arnes.si/embed/s1YjnV7hadlC?t=123&hideRelated=1',
52 'only_matching': True,
54 'url': 'https://video.arnes.si/api/public/video/s1YjnV7hadlC',
55 'only_matching': True,
57 _BASE_URL = 'https://video.arnes.si'
59 def _real_extract(self, url):
60 video_id = self._match_id(url)
62 video = self._download_json(
63 self._BASE_URL + '/api/public/video/' + video_id, video_id)['data']
64 title = video['title']
67 for media in (video.get('media') or []):
68 media_url = media.get('url')
72 'url': self._BASE_URL + media_url,
73 'format_id': remove_start(media.get('format'), 'FORMAT_'),
74 'format_note': media.get('formatTranslation'),
75 'width': int_or_none(media.get('width')),
76 'height': int_or_none(media.get('height')),
78 self._sort_formats(formats)
80 channel = video.get('channel') or {}
81 channel_id = channel.get('url')
82 thumbnail = video.get('thumbnailUrl')
88 'thumbnail': self._BASE_URL + thumbnail,
89 'description': video.get('description'),
90 'license': video.get('license'),
91 'creator': video.get('author'),
92 'timestamp': parse_iso8601(video.get('creationTime')),
93 'channel': channel.get('name'),
94 'channel_id': channel_id,
95 'channel_url': self._BASE_URL + '/?channel=' + channel_id if channel_id else None,
96 'duration': float_or_none(video.get('duration'), 1000),
97 'view_count': int_or_none(video.get('views')),
98 'tags': video.get('hashtags'),
99 'start_time': int_or_none(compat_parse_qs(
100 compat_urllib_parse_urlparse(url).query).get('t', [None])[0]),