1 from .common
import InfoExtractor
3 compat_urllib_parse_urlencode
,
6 from ..utils
import qualities
9 class IvideonIE(InfoExtractor
):
11 IE_DESC
= 'Ivideon TV'
12 _VALID_URL
= r
'https?://(?:www\.)?ivideon\.com/tv/(?:[^/]+/)*camera/(?P<id>\d+-[\da-f]+)/(?P<camera_id>\d+)'
14 'url': 'https://www.ivideon.com/tv/camera/100-916ca13b5c4ad9f564266424a026386d/0/',
16 'id': '100-916ca13b5c4ad9f564266424a026386d',
18 'title': 're:^Касса [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$',
19 'description': 'Основное предназначение - запись действий кассиров. Плюс общий вид.',
23 'skip_download': True,
26 'url': 'https://www.ivideon.com/tv/camera/100-c4ee4cb9ede885cf62dfbe93d7b53783/589824/?lang=ru',
27 'only_matching': True,
29 'url': 'https://www.ivideon.com/tv/map/22.917923/-31.816406/16/camera/100-e7bc16c7d4b5bbd633fd5350b66dfa9a/0',
30 'only_matching': True,
33 _QUALITIES
= ('low', 'mid', 'hi')
35 def _real_extract(self
, url
):
36 mobj
= self
._match
_valid
_url
(url
)
37 server_id
, camera_id
= mobj
.group('id'), mobj
.group('camera_id')
38 camera_name
, description
= None, None
39 camera_url
= compat_urlparse
.urljoin(
40 url
, '/tv/camera/%s/%s/' % (server_id
, camera_id
))
42 webpage
= self
._download
_webpage
(camera_url
, server_id
, fatal
=False)
44 config_string
= self
._search
_regex
(
45 r
'var\s+config\s*=\s*({.+?});', webpage
, 'config', default
=None)
47 config
= self
._parse
_json
(config_string
, server_id
, fatal
=False)
48 camera_info
= config
.get('ivTvAppOptions', {}).get('currentCameraInfo')
50 camera_name
= camera_info
.get('camera_name')
51 description
= camera_info
.get('misc', {}).get('description')
53 camera_name
= self
._html
_search
_meta
(
54 'name', webpage
, 'camera name', default
=None) or self
._search
_regex
(
55 r
'<h1[^>]+class="b-video-title"[^>]*>([^<]+)', webpage
, 'camera name', default
=None)
57 quality
= qualities(self
._QUALITIES
)
60 'url': 'https://streaming.ivideon.com/flv/live?%s' % compat_urllib_parse_urlencode({
64 'q': quality(format_id
),
66 'format_id': format_id
,
68 'quality': quality(format_id
),
69 } for format_id
in self
._QUALITIES
]
73 'title': camera_name
or server_id
,
74 'description': description
,