1 from .common
import InfoExtractor
2 from ..compat
import compat_str
5 class VyboryMosIE(InfoExtractor
):
6 _VALID_URL
= r
'https?://vybory\.mos\.ru/(?:#precinct/|account/channels\?.*?\bstation_id=)(?P<id>\d+)'
8 'url': 'http://vybory.mos.ru/#precinct/13636',
12 'title': 're:^Участковая избирательная комиссия №2231 [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$',
13 'description': 'Россия, Москва, улица Введенского, 32А',
17 'skip_download': True,
20 'url': 'http://vybory.mos.ru/account/channels?station_id=13636',
21 'only_matching': True,
24 def _real_extract(self
, url
):
25 station_id
= self
._match
_id
(url
)
27 channels
= self
._download
_json
(
28 'http://vybory.mos.ru/account/channels?station_id=%s' % station_id
,
29 station_id
, 'Downloading channels JSON')
32 for cam_num
, (sid
, hosts
, name
, _
) in enumerate(channels
, 1):
33 for num
, host
in enumerate(hosts
, 1):
35 'url': 'http://%s/master.m3u8?sid=%s' % (host
, sid
),
37 'format_id': 'camera%d-host%d' % (cam_num
, num
),
38 'format_note': '%s, %s' % (name
, host
),
41 info
= self
._download
_json
(
42 'http://vybory.mos.ru/json/voting_stations/%s/%s.json'
43 % (compat_str(station_id
)[:3], station_id
),
44 station_id
, 'Downloading station JSON', fatal
=False) or {}
48 'title': info
.get('name') or station_id
,
49 'description': info
.get('address'),