]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/vyborymos.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
5 from ..compat
import compat_str
8 class VyboryMosIE(InfoExtractor
):
9 _VALID_URL
= r
'https?://vybory\.mos\.ru/(?:#precinct/|account/channels\?.*?\bstation_id=)(?P<id>\d+)'
11 'url': 'http://vybory.mos.ru/#precinct/13636',
15 'title': 're:^Участковая избирательная комиссия №2231 [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$',
16 'description': 'Россия, Москва, улица Введенского, 32А',
20 'skip_download': True,
23 'url': 'http://vybory.mos.ru/account/channels?station_id=13636',
24 'only_matching': True,
27 def _real_extract(self
, url
):
28 station_id
= self
._match
_id
(url
)
30 channels
= self
._download
_json
(
31 'http://vybory.mos.ru/account/channels?station_id=%s' % station_id
,
32 station_id
, 'Downloading channels JSON')
35 for cam_num
, (sid
, hosts
, name
, _
) in enumerate(channels
, 1):
36 for num
, host
in enumerate(hosts
, 1):
38 'url': 'http://%s/master.m3u8?sid=%s' % (host
, sid
),
40 'format_id': 'camera%d-host%d' % (cam_num
, num
),
41 'format_note': '%s, %s' % (name
, host
),
44 info
= self
._download
_json
(
45 'http://vybory.mos.ru/json/voting_stations/%s/%s.json'
46 % (compat_str(station_id
)[:3], station_id
),
47 station_id
, 'Downloading station JSON', fatal
=False)
51 'title': self
._live
_title
(info
['name'] if info
else station_id
),
52 'description': info
.get('address'),