1
0
Fork 0
mirror of https://gitlab.com/dstftw/youtube-dl.git synced 2020-11-16 09:42:26 +00:00

[vyborymos] Improve station info extraction

This commit is contained in:
Sergey M․ 2016-09-18 17:28:41 +07:00
parent 3acff9423d
commit a1da888d0c
No known key found for this signature in database
GPG key ID: 2C393E0F18A9236D

View file

@ -2,6 +2,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from .common import InfoExtractor from .common import InfoExtractor
from ..compat import compat_str
class VyboryMosIE(InfoExtractor): class VyboryMosIE(InfoExtractor):
@ -28,7 +29,7 @@ class VyboryMosIE(InfoExtractor):
channels = self._download_json( channels = self._download_json(
'http://vybory.mos.ru/account/channels?station_id=%s' % station_id, 'http://vybory.mos.ru/account/channels?station_id=%s' % station_id,
station_id) station_id, 'Downloading channels JSON')
formats = [] formats = []
for cam_num, (sid, hosts, name, _) in enumerate(channels, 1): for cam_num, (sid, hosts, name, _) in enumerate(channels, 1):
@ -41,14 +42,13 @@ class VyboryMosIE(InfoExtractor):
}) })
info = self._download_json( info = self._download_json(
'http://vybory.mos.ru/json/voting_stations/136/%s.json' % station_id, 'http://vybory.mos.ru/json/voting_stations/%s/%s.json'
station_id, 'Downloading station info') % (compat_str(station_id)[:3], station_id),
station_id, 'Downloading station JSON', fatal=False)
title = info['name']
return { return {
'id': station_id, 'id': station_id,
'title': self._live_title(title), 'title': self._live_title(info['name'] if info else station_id),
'description': info.get('address'), 'description': info.get('address'),
'is_live': True, 'is_live': True,
'formats': formats, 'formats': formats,