[vporn] Make video URL regex more strict

There is a garbage instead of proper URL for some HD videos
This commit is contained in:
Sergey M․ 2014-09-15 19:19:37 +07:00
parent b04c8f7358
commit 59d284c316

View File

@ -11,7 +11,8 @@
class VpornIE(InfoExtractor): class VpornIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?vporn\.com/[^/]+/(?P<display_id>[^/]+)/(?P<id>\d+)' _VALID_URL = r'https?://(?:www\.)?vporn\.com/[^/]+/(?P<display_id>[^/]+)/(?P<id>\d+)'
_TEST = { _TESTS = [
{
'url': 'http://www.vporn.com/masturbation/violet-on-her-th-birthday/497944/', 'url': 'http://www.vporn.com/masturbation/violet-on-her-th-birthday/497944/',
'md5': 'facf37c1b86546fa0208058546842c55', 'md5': 'facf37c1b86546fa0208058546842c55',
'info_dict': { 'info_dict': {
@ -25,8 +26,33 @@ class VpornIE(InfoExtractor):
'categories': ['Masturbation', 'Teen'], 'categories': ['Masturbation', 'Teen'],
'duration': 393, 'duration': 393,
'age_limit': 18, 'age_limit': 18,
'view_count': int,
'like_count': int,
'dislike_count': int,
'comment_count': int,
} }
},
{
'url': 'http://www.vporn.com/female/hana-shower/523564/',
'md5': 'ced35a4656198a1664cf2cda1575a25f',
'info_dict': {
'id': '523564',
'display_id': 'hana-shower',
'ext': 'mp4',
'title': 'Hana Shower',
'description': 'Hana showers at the bathroom.',
'thumbnail': 're:^https?://.*\.jpg$',
'uploader': 'Hmmmmm',
'categories': ['Big Boobs', 'Erotic', 'Teen', 'Female'],
'duration': 588,
'age_limit': 18,
'view_count': int,
'like_count': int,
'dislike_count': int,
'comment_count': int,
} }
},
]
def _real_extract(self, url): def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url) mobj = re.match(self._VALID_URL, url)
@ -64,7 +90,7 @@ def _real_extract(self, url):
formats = [] formats = []
for video in re.findall(r'flashvars\.videoUrl([^=]+?)\s*=\s*"([^"]+)"', webpage): for video in re.findall(r'flashvars\.videoUrl([^=]+?)\s*=\s*"(https?://[^"]+)"', webpage):
video_url = video[1] video_url = video[1]
fmt = { fmt = {
'url': video_url, 'url': video_url,