projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
603c920
)
[tvigle] Update test and modernize
author
Sergey M․
<dstftw@gmail.com>
Mon, 8 Dec 2014 16:03:02 +0000
(22:03 +0600)
committer
Sergey M․
<dstftw@gmail.com>
Mon, 8 Dec 2014 16:03:02 +0000
(22:03 +0600)
youtube_dl/extractor/tvigle.py
patch
|
blob
|
history
diff --git
a/youtube_dl/extractor/tvigle.py
b/youtube_dl/extractor/tvigle.py
index d81d1d1a67cef49d4f612f08bfb5b7b7002b51fd..ba65996dc01646e019cfd5820aa36c1934365d9b 100644
(file)
--- a/
youtube_dl/extractor/tvigle.py
+++ b/
youtube_dl/extractor/tvigle.py
@@
-1,32
+1,30
@@
# encoding: utf-8
from __future__ import unicode_literals
# encoding: utf-8
from __future__ import unicode_literals
-import re
-
from .common import InfoExtractor
from ..utils import (
float_or_none,
from .common import InfoExtractor
from ..utils import (
float_or_none,
-
str_to_in
t,
+
parse_age_limi
t,
)
class TvigleIE(InfoExtractor):
IE_NAME = 'tvigle'
IE_DESC = 'Интернет-телевидение Tvigle.ru'
)
class TvigleIE(InfoExtractor):
IE_NAME = 'tvigle'
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/
b
rat/',
- 'md5': '
ff4344a4894b0524441fb6f8218dc716
',
+ 'url': 'http://www.tvigle.ru/video/
sok
rat/',
+ 'md5': '
36514aed3657d4f70b4b2cef8eb520cd
',
'info_dict': {
'info_dict': {
- 'id': '
5118490
',
- 'display_id': '
b
rat',
- 'ext': '
mp4
',
- 'title': 'Ð
\91
рат',
- 'description': 'md5:
d16ac7c0b47052ea51fddb92c4e413eb
',
- 'duration':
5722.
6,
- 'age_limit':
16
,
+ 'id': '
1848932
',
+ 'display_id': '
sok
rat',
+ 'ext': '
flv
',
+ 'title': 'Ð
¡Ð¾Ðº
рат',
+ 'description': 'md5:
a05bd01be310074d5833efc6743be95e
',
+ 'duration':
658
6,
+ '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 = mobj.group('display_id')
+ display_id = self._match_id(url)
webpage = self._download_webpage(url, display_id)
webpage = self._download_webpage(url, display_id)
@@
-60,8
+57,8
@@
class TvigleIE(InfoExtractor):
title = item['title']
description = item['description']
thumbnail = item['thumbnail']
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():
formats = []
for vcodec, fmts in item['videos'].items():