2 from __future__ import unicode_literals
6 from .common import InfoExtractor
7 from ..utils import int_or_none
9 class VpornIE(InfoExtractor):
10 _VALID_URL = r'http?://(?:www\.)?vporn\.com/[a-z]+/(?P<title_dash>[a-z-]+)/(?P<id>\d+)/?'
12 'url': 'http://www.vporn.com/masturbation/violet-on-her-th-birthday/497944/',
13 'md5': 'facf37c1b86546fa0208058546842c55',
17 'title': 'Violet On Her 19th Birthday',
18 'description': 'Violet dances in front of the camera which is sure to get you horny.',
20 'thumbnail': 're:^https?://.*\.jpg$',
24 def _real_extract(self, url):
25 mobj = re.match(self._VALID_URL, url)
26 video_id = mobj.group('id')
28 webpage = self._download_webpage(url, video_id)
29 title = self._html_search_regex(r'<title>(.*?) - Vporn Video</title>', webpage, 'title')
30 video_url = self._html_search_regex(r'flashvars.videoUrlMedium = "(.*?)"', webpage, 'video_url')
31 description = self._html_search_regex(r'<div class="description_txt">(.*?)</div>', webpage, 'description')
32 thumbnail = 'http://www.vporn.com' + self._html_search_regex(r'flashvars.imageUrl = "(.*?)"', webpage, 'description')
34 mobj = re.search(r'<span class="f_right">duration (?P<minutes>\d+) min (?P<seconds>\d+) sec </span>', webpage)
35 duration = int(mobj.group('minutes')) * 60 + int(mobj.group('seconds')) if mobj else None
37 mobj = re.search(r'<span>((?P<thousands>\d+),)?(?P<units>\d+) VIEWS</span>', webpage)
39 view_count = int(mobj.group('units'))
40 view_count += int(mobj.group('thousands')) * 1000
47 'thumbnail': thumbnail,
49 'description': description,
50 'duration': int_or_none(duration),
51 'view_count': int_or_none(view_count),