]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/vporn.py
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
12 class VpornIE(InfoExtractor
):
13 _VALID_URL
= r
'https?://(?:www\.)?vporn\.com/[^/]+/(?P<display_id>[^/]+)/(?P<id>\d+)'
15 'url': 'http://www.vporn.com/masturbation/violet-on-her-th-birthday/497944/',
16 'md5': 'facf37c1b86546fa0208058546842c55',
19 'display_id': 'violet-on-her-th-birthday',
21 'title': 'Violet on her 19th birthday',
22 'description': 'Violet dances in front of the camera which is sure to get you horny.',
23 'thumbnail': 're:^https?://.*\.jpg$',
24 'uploader': 'kileyGrope',
25 'categories': ['Masturbation', 'Teen'],
31 def _real_extract(self
, url
):
32 mobj
= re
.match(self
._VALID
_URL
, url
)
33 video_id
= mobj
.group('id')
34 display_id
= mobj
.group('display_id')
36 webpage
= self
._download
_webpage
(url
, display_id
)
38 title
= self
._html
_search
_regex
(
39 r
'videoname\s*=\s*\'([^
\']+)\'', webpage, 'title
').strip()
40 description = self._html_search_regex(
41 r'<div
class="description_txt">(.*?
)</div
>', webpage, 'description
', fatal=False)
42 thumbnail = self._html_search_regex(
43 r'flashvars\
.imageUrl\s
*=\s
*"([^"]+)"', webpage, 'description', fatal=False, default=None)
45 thumbnail = 'http://www.vporn.com' + thumbnail
47 uploader = self._html_search_regex(
48 r'(?s)UPLOADED BY.*?<a href="/user
/[^
"]+">([^
<]+)</a
>',
49 webpage, 'uploader
', fatal=False)
51 categories = re.findall(r'<a href
="/cat/[^"]+">([^<]+)</a>', webpage)
53 duration = parse_duration(self._search_regex(
54 r'duration (\d+ min \d+ sec)', webpage, 'duration', fatal=False))
56 view_count = str_to_int(self._html_search_regex(
57 r'<span>([\d,\.]+) VIEWS</span>', webpage, 'view count', fatal=False))
58 like_count = str_to_int(self._html_search_regex(
59 r'<span id="like
" class="n
">([\d,\.]+)</span>', webpage, 'like count', fatal=False))
60 dislike_count = str_to_int(self._html_search_regex(
61 r'<span id="dislike
" class="n
">([\d,\.]+)</span>', webpage, 'dislike count', fatal=False))
62 comment_count = str_to_int(self._html_search_regex(
63 r'<h4>Comments \(<b>([\d,\.]+)</b>\)</h4>', webpage, 'comment count', fatal=False))
67 for video in re.findall(r'flashvars\.videoUrl([^=]+?)\s*=\s*"([^
"]+)"', webpage):
71 'format_id
': video[0],
73 m = re.search(r'_(?P
<width
>\d
+)x(?P
<height
>\d
+)_(?P
<vbr
>\d
+)k\
.mp4$
', video_url)
76 'width
': int(m.group('width
')),
77 'height
': int(m.group('height
')),
78 'vbr
': int(m.group('vbr
')),
82 self._sort_formats(formats)
86 'display_id
': display_id,
88 'description
': description,
89 'thumbnail
': thumbnail,
91 'categories
': categories,
93 'view_count
': view_count,
94 'like_count
': like_count,
95 'dislike_count
': dislike_count,
96 'comment_count
': comment_count,