mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-16 01:25:06 +00:00
[tvigle] Update test and modernize
This commit is contained in:
parent
603c92080f
commit
819039ee63
1 changed files with 14 additions and 17 deletions
|
@ -1,32 +1,30 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
float_or_none,
|
float_or_none,
|
||||||
str_to_int,
|
parse_age_limit,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class TvigleIE(InfoExtractor):
|
class TvigleIE(InfoExtractor):
|
||||||
IE_NAME = 'tvigle'
|
IE_NAME = 'tvigle'
|
||||||
IE_DESC = 'Интернет-телевидение Tvigle.ru'
|
IE_DESC = 'Интернет-телевидение Tvigle.ru'
|
||||||
_VALID_URL = r'http://(?:www\.)?tvigle\.ru/(?:[^/]+/)+(?P<display_id>[^/]+)/$'
|
_VALID_URL = r'http://(?:www\.)?tvigle\.ru/(?:[^/]+/)+(?P<id>[^/]+)/$'
|
||||||
|
|
||||||
_TESTS = [
|
_TESTS = [
|
||||||
{
|
{
|
||||||
'url': 'http://www.tvigle.ru/video/brat/',
|
'url': 'http://www.tvigle.ru/video/sokrat/',
|
||||||
'md5': 'ff4344a4894b0524441fb6f8218dc716',
|
'md5': '36514aed3657d4f70b4b2cef8eb520cd',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '5118490',
|
'id': '1848932',
|
||||||
'display_id': 'brat',
|
'display_id': 'sokrat',
|
||||||
'ext': 'mp4',
|
'ext': 'flv',
|
||||||
'title': 'Брат',
|
'title': 'Сократ',
|
||||||
'description': 'md5:d16ac7c0b47052ea51fddb92c4e413eb',
|
'description': 'md5:a05bd01be310074d5833efc6743be95e',
|
||||||
'duration': 5722.6,
|
'duration': 6586,
|
||||||
'age_limit': 16,
|
'age_limit': 0,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -44,8 +42,7 @@ class TvigleIE(InfoExtractor):
|
||||||
]
|
]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
display_id = self._match_id(url)
|
||||||
display_id = mobj.group('display_id')
|
|
||||||
|
|
||||||
webpage = self._download_webpage(url, display_id)
|
webpage = self._download_webpage(url, display_id)
|
||||||
|
|
||||||
|
@ -60,8 +57,8 @@ def _real_extract(self, url):
|
||||||
title = item['title']
|
title = item['title']
|
||||||
description = item['description']
|
description = item['description']
|
||||||
thumbnail = item['thumbnail']
|
thumbnail = item['thumbnail']
|
||||||
duration = float_or_none(item['durationMilliseconds'], 1000)
|
duration = float_or_none(item.get('durationMilliseconds'), 1000)
|
||||||
age_limit = str_to_int(item['ageRestrictions'])
|
age_limit = parse_age_limit(item.get('ageRestrictions'))
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
for vcodec, fmts in item['videos'].items():
|
for vcodec, fmts in item['videos'].items():
|
||||||
|
|
Loading…
Reference in a new issue