3 from .common
import InfoExtractor
4 from ..utils
import qualities
7 class IvideonIE(InfoExtractor
):
10 _VALID_URL
= r
'https?://(?:www\.)?ivideon\.com/tv/(?:[^/]+/)*camera/(?P<id>\d+-[\da-f]+)/(?P<camera_id>\d+)'
12 'url': 'https://www.ivideon.com/tv/camera/100-916ca13b5c4ad9f564266424a026386d/0/',
14 'id': '100-916ca13b5c4ad9f564266424a026386d',
16 'title': 're:^Касса [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$',
17 'description': 'Основное предназначение - запись действий кассиров. Плюс общий вид.',
21 'skip_download': True,
24 'url': 'https://www.ivideon.com/tv/camera/100-c4ee4cb9ede885cf62dfbe93d7b53783/589824/?lang=ru',
25 'only_matching': True,
27 'url': 'https://www.ivideon.com/tv/map/22.917923/-31.816406/16/camera/100-e7bc16c7d4b5bbd633fd5350b66dfa9a/0',
28 'only_matching': True,
31 _QUALITIES
= ('low', 'mid', 'hi')
33 def _real_extract(self
, url
):
34 mobj
= self
._match
_valid
_url
(url
)
35 server_id
, camera_id
= mobj
.group('id'), mobj
.group('camera_id')
36 camera_name
, description
= None, None
37 camera_url
= urllib
.parse
.urljoin(
38 url
, f
'/tv/camera/{server_id}/{camera_id}/')
40 webpage
= self
._download
_webpage
(camera_url
, server_id
, fatal
=False)
42 config_string
= self
._search
_regex
(
43 r
'var\s+config\s*=\s*({.+?});', webpage
, 'config', default
=None)
45 config
= self
._parse
_json
(config_string
, server_id
, fatal
=False)
46 camera_info
= config
.get('ivTvAppOptions', {}).get('currentCameraInfo')
48 camera_name
= camera_info
.get('camera_name')
49 description
= camera_info
.get('misc', {}).get('description')
51 camera_name
= self
._html
_search
_meta
(
52 'name', webpage
, 'camera name', default
=None) or self
._search
_regex
(
53 r
'<h1[^>]+class="b-video-title"[^>]*>([^<]+)', webpage
, 'camera name', default
=None)
55 quality
= qualities(self
._QUALITIES
)
58 'url': 'https://streaming.ivideon.com/flv/live?{}'.format(urllib
.parse
.urlencode({
62 'q': quality(format_id
),
64 'format_id': format_id
,
66 'quality': quality(format_id
),
67 } for format_id
in self
._QUALITIES
]
71 'title': camera_name
or server_id
,
72 'description': description
,