2 from __future__ import unicode_literals
6 from .common import InfoExtractor
14 class SexyKarmaIE(InfoExtractor):
15 _VALID_URL = r'https?://(?:www\.)?sexykarma\.com/gonewild/video/(?P<display_id>[^/]+)-(?P<id>[a-zA-Z0-9]+)\.html'
17 'url': 'http://www.sexykarma.com/gonewild/video/taking-a-quick-pee-yHI70cOyIHt.html',
18 'md5': 'b9798e7d1ef1765116a8f516c8091dbd',
21 'display_id': 'taking-a-quick-pee',
23 'title': 'Taking a quick pee.',
25 'thumbnail': 're:^https?://.*\.jpg$',
26 'uploader': 'wildginger7',
27 'upload_date': '20141007',
34 'url': 'http://www.sexykarma.com/gonewild/video/pot-pixie-tribute-8Id6EZPbuHf.html',
35 'md5': 'dd216c68d29b49b12842b9babe762a5d',
38 'display_id': 'pot-pixie-tribute',
40 'title': 'pot_pixie tribute',
41 'description': 'tribute',
42 'thumbnail': 're:^https?://.*\.jpg$',
43 'uploader': 'banffite',
44 'upload_date': '20141013',
52 def _real_extract(self, url):
53 mobj = re.match(self._VALID_URL, url)
54 video_id = mobj.group('id')
55 display_id = mobj.group('display_id')
57 webpage = self._download_webpage(url, display_id)
59 video_url = self._html_search_regex(
60 r'<p>Save this video to your computer: </p><p><a href="([^"]+)"',
63 title = self._html_search_regex(
64 r'<h2 class="he2"><span>(.*?)</span>',
66 description = self._html_search_meta(
67 'description', webpage, 'description', fatal=False, default='')
68 thumbnail = self._html_search_regex(
69 r'<span id="container"><img\s+src="([^"]+)"',
70 webpage, 'thumbnail', fatal=False)
72 uploader = self._html_search_regex(
73 r'class="aupa">\s*(.*?)</a>',
75 upload_date = unified_strdate(self._html_search_regex(
76 r'Added: <strong>(.+?)</strong>', webpage, 'upload date', fatal=False))
78 duration = parse_duration(self._search_regex(
79 r'<td>Time:\s*</td>\s*<td align="right"><span>\s*(.+?)\s*</span>',
80 webpage, 'duration', fatal=False))
82 view_count = int_or_none(self._search_regex(
83 r'<td>Views:\s*</td>\s*<td align="right"><span>\s*(\d+)\s*</span>',
84 webpage, 'view count', fatal=False))
85 comment_count = int_or_none(self._search_regex(
86 r'<td>Comments:\s*</td>\s*<td align="right"><span>\s*(\d+)\s*</span>',
87 webpage, 'comment count', fatal=False))
89 categories = self._html_search_meta(
90 'keywords', webpage, 'categories',
91 fatal=False, default='').split(',')
95 'display_id': display_id,
98 'description': description,
99 'thumbnail': thumbnail,
100 'uploader': uploader,
101 'upload_date': upload_date,
102 'duration': duration,
103 'view_count': view_count,
104 'comment_count': comment_count,
105 'categories': categories,