From 12c82cf9cb59e97186b96fea76a15b52a0a9bb37 Mon Sep 17 00:00:00 2001 From: peugeot Date: Sat, 30 Aug 2014 20:54:38 +0200 Subject: [PATCH] add support for view count --- youtube_dl/extractor/vporn.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/youtube_dl/extractor/vporn.py b/youtube_dl/extractor/vporn.py index bdbd7543d..0d182b650 100644 --- a/youtube_dl/extractor/vporn.py +++ b/youtube_dl/extractor/vporn.py @@ -4,6 +4,7 @@ from __future__ import unicode_literals import re from .common import InfoExtractor +from ..utils import int_or_none class VpornIE(InfoExtractor): _VALID_URL = r'http?://(?:www\.)?vporn\.com/[a-z]+/(?P[a-z-]+)/(?P\d+)/?' @@ -30,15 +31,18 @@ class VpornIE(InfoExtractor): description = self._html_search_regex(r'
(.*?)
', webpage, 'description') thumbnail = 'http://www.vporn.com' + self._html_search_regex(r'flashvars.imageUrl = "(.*?)"', webpage, 'description') - mobj = re.search( - r'duration (?P\d+) min (?P\d+) sec ', webpage) + mobj = re.search(r'duration (?P\d+) min (?P\d+) sec ', webpage) duration = int(mobj.group('minutes')) * 60 + int(mobj.group('seconds')) if mobj else None + mobj = re.search(r'((?P\d+),)?(?P\d+) VIEWS', webpage) + view_count = int(mobj.group('thousands')) * 1000 + int(mobj.group('units')) if mobj else None + return { 'id': video_id, 'url': video_url, 'thumbnail': thumbnail, 'title': title, 'description': description, - 'duration': duration, + 'duration': int_or_none(duration), + 'view_count': int_or_none(view_count), } -- 2.22.2