2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
7 compat_urllib_parse_urlparse
,
18 class ArnesIE(InfoExtractor
):
19 IE_NAME
= 'video.arnes.si'
20 IE_DESC
= 'Arnes Video'
21 _VALID_URL
= r
'https?://video\.arnes\.si/(?:[a-z]{2}/)?(?:watch|embed|api/(?:asset|public/video))/(?P<id>[0-9a-zA-Z]{12})'
23 'url': 'https://video.arnes.si/watch/a1qrWTOQfVoU?t=10',
24 'md5': '4d0f4d0a03571b33e1efac25fd4a065d',
28 'title': 'Linearna neodvisnost, definicija',
29 'description': 'Linearna neodvisnost, definicija',
31 'creator': 'Polona Oblak',
32 'timestamp': 1585063725,
33 'upload_date': '20200324',
34 'channel': 'Polona Oblak',
35 'channel_id': 'q6pc04hw24cj',
36 'channel_url': 'https://video.arnes.si/?channel=q6pc04hw24cj',
39 'tags': ['linearna_algebra'],
43 'url': 'https://video.arnes.si/api/asset/s1YjnV7hadlC/play.mp4',
44 'only_matching': True,
46 'url': 'https://video.arnes.si/embed/s1YjnV7hadlC',
47 'only_matching': True,
49 'url': 'https://video.arnes.si/en/watch/s1YjnV7hadlC',
50 'only_matching': True,
52 'url': 'https://video.arnes.si/embed/s1YjnV7hadlC?t=123&hideRelated=1',
53 'only_matching': True,
55 'url': 'https://video.arnes.si/api/public/video/s1YjnV7hadlC',
56 'only_matching': True,
58 _BASE_URL
= 'https://video.arnes.si'
60 def _real_extract(self
, url
):
61 video_id
= self
._match
_id
(url
)
63 video
= self
._download
_json
(
64 self
._BASE
_URL
+ '/api/public/video/' + video_id
, video_id
)['data']
65 title
= video
['title']
68 for media
in (video
.get('media') or []):
69 media_url
= media
.get('url')
73 'url': self
._BASE
_URL
+ media_url
,
74 'format_id': remove_start(media
.get('format'), 'FORMAT_'),
75 'format_note': media
.get('formatTranslation'),
76 'width': int_or_none(media
.get('width')),
77 'height': int_or_none(media
.get('height')),
79 self
._sort
_formats
(formats
)
81 channel
= video
.get('channel') or {}
82 channel_id
= channel
.get('url')
83 thumbnail
= video
.get('thumbnailUrl')
89 'thumbnail': self
._BASE
_URL
+ thumbnail
,
90 'description': video
.get('description'),
91 'license': video
.get('license'),
92 'creator': video
.get('author'),
93 'timestamp': parse_iso8601(video
.get('creationTime')),
94 'channel': channel
.get('name'),
95 'channel_id': channel_id
,
96 'channel_url': format_field(channel_id
, template
=f
'{self._BASE_URL}/?channel=%s'),
97 'duration': float_or_none(video
.get('duration'), 1000),
98 'view_count': int_or_none(video
.get('views')),
99 'tags': video
.get('hashtags'),
100 'start_time': int_or_none(compat_parse_qs(
101 compat_urllib_parse_urlparse(url
).query
).get('t', [None])[0]),