X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Fextractor%2Ftvigle.py;h=ba65996dc01646e019cfd5820aa36c1934365d9b;hb=9fa6ea26806867cb62b76b16a188dbe395a239ff;hp=dc86978509da2b8680fd37bdd912028366c3928b;hpb=cc7fec5818254f4679896823c7de9d17f50201ca;p=youtube-dl diff --git a/youtube_dl/extractor/tvigle.py b/youtube_dl/extractor/tvigle.py index dc8697850..ba65996dc 100644 --- a/youtube_dl/extractor/tvigle.py +++ b/youtube_dl/extractor/tvigle.py @@ -1,31 +1,29 @@ # encoding: utf-8 from __future__ import unicode_literals -import re - from .common import InfoExtractor from ..utils import ( float_or_none, - str_to_int, + parse_age_limit, ) class TvigleIE(InfoExtractor): IE_NAME = 'tvigle' IE_DESC = 'Интернет-телевидение Tvigle.ru' - _VALID_URL = r'http://(?:www\.)?tvigle\.ru/(?:[^/]+/)+(?P[^/]+)/$' + _VALID_URL = r'http://(?:www\.)?tvigle\.ru/(?:[^/]+/)+(?P[^/]+)/$' _TESTS = [ { - 'url': 'http://www.tvigle.ru/video/brat-2/', - 'md5': '72cb7eab33e54314e1790da402d3c9c3', + 'url': 'http://www.tvigle.ru/video/sokrat/', + 'md5': '36514aed3657d4f70b4b2cef8eb520cd', 'info_dict': { - 'id': '5119390', - 'display_id': 'brat-2', - 'ext': 'mp4', - 'title': 'Брат 2 ', - 'description': 'md5:5751f4fe345a58e1692585c361294bd8', - 'duration': 7356.369, + 'id': '1848932', + 'display_id': 'sokrat', + 'ext': 'flv', + 'title': 'Сократ', + 'description': 'md5:a05bd01be310074d5833efc6743be95e', + 'duration': 6586, 'age_limit': 0, }, }, @@ -44,8 +42,7 @@ class TvigleIE(InfoExtractor): ] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) - display_id = mobj.group('display_id') + display_id = self._match_id(url) webpage = self._download_webpage(url, display_id) @@ -60,8 +57,8 @@ class TvigleIE(InfoExtractor): title = item['title'] description = item['description'] thumbnail = item['thumbnail'] - duration = float_or_none(item['durationMilliseconds'], 1000) - age_limit = str_to_int(item['ageRestrictions']) + duration = float_or_none(item.get('durationMilliseconds'), 1000) + age_limit = parse_age_limit(item.get('ageRestrictions')) formats = [] for vcodec, fmts in item['videos'].items(): @@ -71,6 +68,7 @@ class TvigleIE(InfoExtractor): 'format_id': '%s-%s' % (vcodec, quality), 'vcodec': vcodec, 'height': int(quality[:-1]), + 'filesize': item['video_files_size'][vcodec][quality], }) self._sort_formats(formats) @@ -83,4 +81,4 @@ class TvigleIE(InfoExtractor): 'duration': duration, 'age_limit': age_limit, 'formats': formats, - } \ No newline at end of file + }