]>
Commit | Line | Data |
---|---|---|
1910077e YCH |
1 | # coding: utf-8 |
2 | from __future__ import unicode_literals | |
3 | ||
4 | import re | |
5 | ||
6 | from .common import InfoExtractor | |
7 | from ..utils import ( | |
8 | unified_strdate, | |
9 | parse_duration, | |
10 | int_or_none, | |
11 | ) | |
12 | ||
13 | ||
14 | class SexyKarmaIE(InfoExtractor): | |
15 | IE_DESC = 'Sexy Karma and Watch Indian Porn' | |
16 | _VALID_URL = r'https?://(?:www\.)?(?:sexykarma\.com|watchindianporn\.net)/(?:[^/]+/)*video/(?P<display_id>[^/]+)-(?P<id>[a-zA-Z0-9]+)\.html' | |
17 | _TESTS = [{ | |
18 | 'url': 'http://www.sexykarma.com/gonewild/video/taking-a-quick-pee-yHI70cOyIHt.html', | |
19 | 'md5': 'b9798e7d1ef1765116a8f516c8091dbd', | |
20 | 'info_dict': { | |
21 | 'id': 'yHI70cOyIHt', | |
22 | 'display_id': 'taking-a-quick-pee', | |
23 | 'ext': 'mp4', | |
24 | 'title': 'Taking a quick pee.', | |
25 | 'thumbnail': 're:^https?://.*\.jpg$', | |
26 | 'uploader': 'wildginger7', | |
27 | 'upload_date': '20141008', | |
28 | 'duration': 22, | |
29 | 'view_count': int, | |
30 | 'comment_count': int, | |
31 | 'categories': list, | |
32 | 'age_limit': 18, | |
33 | } | |
34 | }, { | |
35 | 'url': 'http://www.sexykarma.com/gonewild/video/pot-pixie-tribute-8Id6EZPbuHf.html', | |
36 | 'md5': 'dd216c68d29b49b12842b9babe762a5d', | |
37 | 'info_dict': { | |
38 | 'id': '8Id6EZPbuHf', | |
39 | 'display_id': 'pot-pixie-tribute', | |
40 | 'ext': 'mp4', | |
41 | 'title': 'pot_pixie tribute', | |
42 | 'thumbnail': 're:^https?://.*\.jpg$', | |
43 | 'uploader': 'banffite', | |
44 | 'upload_date': '20141013', | |
45 | 'duration': 16, | |
46 | 'view_count': int, | |
47 | 'comment_count': int, | |
48 | 'categories': list, | |
49 | 'age_limit': 18, | |
50 | } | |
51 | }, { | |
52 | 'url': 'http://www.watchindianporn.net/video/desi-dancer-namrata-stripping-completely-nude-and-dancing-on-a-hot-number-dW2mtctxJfs.html', | |
53 | 'md5': '9afb80675550406ed9a63ac2819ef69d', | |
54 | 'info_dict': { | |
55 | 'id': 'dW2mtctxJfs', | |
56 | 'display_id': 'desi-dancer-namrata-stripping-completely-nude-and-dancing-on-a-hot-number', | |
57 | 'ext': 'mp4', | |
58 | 'title': 'Desi dancer namrata stripping completely nude and dancing on a hot number', | |
59 | 'thumbnail': 're:^https?://.*\.jpg$', | |
60 | 'uploader': 'Don', | |
61 | 'upload_date': '20140213', | |
62 | 'duration': 83, | |
63 | 'view_count': int, | |
64 | 'comment_count': int, | |
65 | 'categories': list, | |
66 | 'age_limit': 18, | |
67 | } | |
68 | }] | |
69 | ||
70 | def _real_extract(self, url): | |
71 | mobj = re.match(self._VALID_URL, url) | |
72 | video_id = mobj.group('id') | |
73 | display_id = mobj.group('display_id') | |
74 | ||
75 | webpage = self._download_webpage(url, display_id) | |
76 | ||
77 | video_url = self._html_search_regex( | |
78 | r"url: escape\('([^']+)'\)", webpage, 'url') | |
79 | ||
80 | title = self._html_search_regex( | |
81 | r'<h2 class="he2"><span>(.*?)</span>', | |
82 | webpage, 'title') | |
83 | thumbnail = self._html_search_regex( | |
84 | r'<span id="container"><img\s+src="([^"]+)"', | |
85 | webpage, 'thumbnail', fatal=False) | |
86 | ||
87 | uploader = self._html_search_regex( | |
88 | r'class="aupa">\s*(.*?)</a>', | |
89 | webpage, 'uploader') | |
90 | upload_date = unified_strdate(self._html_search_regex( | |
91 | r'Added: <strong>(.+?)</strong>', webpage, 'upload date', fatal=False)) | |
92 | ||
93 | duration = parse_duration(self._search_regex( | |
94 | r'<td>Time:\s*</td>\s*<td align="right"><span>\s*(.+?)\s*</span>', | |
95 | webpage, 'duration', fatal=False)) | |
96 | ||
97 | view_count = int_or_none(self._search_regex( | |
98 | r'<td>Views:\s*</td>\s*<td align="right"><span>\s*(\d+)\s*</span>', | |
99 | webpage, 'view count', fatal=False)) | |
100 | comment_count = int_or_none(self._search_regex( | |
101 | r'<td>Comments:\s*</td>\s*<td align="right"><span>\s*(\d+)\s*</span>', | |
102 | webpage, 'comment count', fatal=False)) | |
103 | ||
104 | categories = re.findall( | |
105 | r'<a href="[^"]+/search/video/desi"><span>([^<]+)</span></a>', | |
106 | webpage) | |
107 | ||
108 | return { | |
109 | 'id': video_id, | |
110 | 'display_id': display_id, | |
111 | 'url': video_url, | |
112 | 'title': title, | |
113 | 'thumbnail': thumbnail, | |
114 | 'uploader': uploader, | |
115 | 'upload_date': upload_date, | |
116 | 'duration': duration, | |
117 | 'view_count': view_count, | |
118 | 'comment_count': comment_count, | |
119 | 'categories': categories, | |
120 | 'age_limit': 18, | |
121 | } |