2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
8 compat_urllib_parse_urlencode
,
11 from ..utils
import qualities
14 class IvideonIE(InfoExtractor
):
16 IE_DESC
= 'Ivideon TV'
17 _VALID_URL
= r
'https?://(?:www\.)?ivideon\.com/tv/(?:[^/]+/)*camera/(?P<id>\d+-[\da-f]+)/(?P<camera_id>\d+)'
19 'url': 'https://www.ivideon.com/tv/camera/100-916ca13b5c4ad9f564266424a026386d/0/',
21 'id': '100-916ca13b5c4ad9f564266424a026386d',
23 'title': 're:^Касса [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$',
24 'description': 'Основное предназначение - запись действий кассиров. Плюс общий вид.',
28 'skip_download': True,
31 'url': 'https://www.ivideon.com/tv/camera/100-c4ee4cb9ede885cf62dfbe93d7b53783/589824/?lang=ru',
32 'only_matching': True,
34 'url': 'https://www.ivideon.com/tv/map/22.917923/-31.816406/16/camera/100-e7bc16c7d4b5bbd633fd5350b66dfa9a/0',
35 'only_matching': True,
38 _QUALITIES
= ('low', 'mid', 'hi')
40 def _real_extract(self
, url
):
41 mobj
= re
.match(self
._VALID
_URL
, url
)
42 server_id
, camera_id
= mobj
.group('id'), mobj
.group('camera_id')
43 camera_name
, description
= None, None
44 camera_url
= compat_urlparse
.urljoin(
45 url
, '/tv/camera/%s/%s/' % (server_id
, camera_id
))
47 webpage
= self
._download
_webpage
(camera_url
, server_id
, fatal
=False)
49 config_string
= self
._search
_regex
(
50 r
'var\s+config\s*=\s*({.+?});', webpage
, 'config', default
=None)
52 config
= self
._parse
_json
(config_string
, server_id
, fatal
=False)
53 camera_info
= config
.get('ivTvAppOptions', {}).get('currentCameraInfo')
55 camera_name
= camera_info
.get('camera_name')
56 description
= camera_info
.get('misc', {}).get('description')
58 camera_name
= self
._html
_search
_meta
(
59 'name', webpage
, 'camera name', default
=None) or self
._search
_regex
(
60 r
'<h1[^>]+class="b-video-title"[^>]*>([^<]+)', webpage
, 'camera name', default
=None)
62 quality
= qualities(self
._QUALITIES
)
65 'url': 'https://streaming.ivideon.com/flv/live?%s' % compat_urllib_parse_urlencode({
69 'q': quality(format_id
),
71 'format_id': format_id
,
73 'quality': quality(format_id
),
74 } for format_id
in self
._QUALITIES
]
75 self
._sort
_formats
(formats
)
79 'title': self
._live
_title
(camera_name
or server_id
),
80 'description': description
,