]>
Commit | Line | Data |
---|---|---|
64102296 | 1 | from __future__ import unicode_literals |
2 | ||
64102296 | 3 | import re |
4 | ||
d97aae75 | 5 | from .common import InfoExtractor |
8fe767e0 | 6 | from ..utils import ExtractorError |
d97aae75 S |
7 | |
8 | ||
64102296 | 9 | class SpankBangIE(InfoExtractor): |
3192d4bc | 10 | _VALID_URL = r'https?://(?:(?:www|m|[a-z]{2})\.)?spankbang\.com/(?P<id>[\da-z]+)/video' |
d9e543b6 | 11 | _TESTS = [{ |
d97aae75 S |
12 | 'url': 'http://spankbang.com/3vvn/video/fantasy+solo', |
13 | 'md5': '1cc433e1d6aa14bc376535b8679302f7', | |
14 | 'info_dict': { | |
15 | 'id': '3vvn', | |
16 | 'ext': 'mp4', | |
17 | 'title': 'fantasy solo', | |
3192d4bc | 18 | 'description': 'Watch fantasy solo free HD porn video - 05 minutes - Babe,Masturbation,Solo,Toy - dillion harper masturbates on a bed free adult movies sexy clips.', |
ec85ded8 | 19 | 'thumbnail': r're:^https?://.*\.jpg$', |
d97aae75 S |
20 | 'uploader': 'silly2587', |
21 | 'age_limit': 18, | |
5c1d459a | 22 | } |
d9e543b6 S |
23 | }, { |
24 | # 480p only | |
25 | 'url': 'http://spankbang.com/1vt0/video/solvane+gangbang', | |
26 | 'only_matching': True, | |
69263044 S |
27 | }, { |
28 | # no uploader | |
29 | 'url': 'http://spankbang.com/lklg/video/sex+with+anyone+wedding+edition+2', | |
30 | 'only_matching': True, | |
3192d4bc W |
31 | }, { |
32 | # mobile page | |
33 | 'url': 'http://m.spankbang.com/1o2de/video/can+t+remember+her+name', | |
34 | 'only_matching': True, | |
d9e543b6 | 35 | }] |
64102296 | 36 | |
37 | def _real_extract(self, url): | |
38 | video_id = self._match_id(url) | |
39 | webpage = self._download_webpage(url, video_id) | |
40 | ||
8fe767e0 S |
41 | if re.search(r'<[^>]+\bid=["\']video_removed', webpage): |
42 | raise ExtractorError( | |
43 | 'Video %s is not available' % video_id, expected=True) | |
44 | ||
d97aae75 S |
45 | stream_key = self._html_search_regex( |
46 | r'''var\s+stream_key\s*=\s*['"](.+?)['"]''', | |
47 | webpage, 'stream key') | |
48 | ||
49 | formats = [{ | |
50 | 'url': 'http://spankbang.com/_%s/%s/title/%sp__mp4' % (video_id, stream_key, height), | |
51 | 'ext': 'mp4', | |
52 | 'format_id': '%sp' % height, | |
53 | 'height': int(height), | |
58ae2433 | 54 | } for height in re.findall(r'<(?:span|li|p)[^>]+[qb]_(\d+)p', webpage)] |
c773c232 | 55 | self._check_formats(formats, video_id) |
d97aae75 S |
56 | self._sort_formats(formats) |
57 | ||
58 | title = self._html_search_regex( | |
c3111ab3 | 59 | r'(?s)<h1[^>]*>(.+?)</h1>', webpage, 'title') |
dc2c37f3 | 60 | description = self._og_search_description(webpage) |
d97aae75 S |
61 | thumbnail = self._og_search_thumbnail(webpage) |
62 | uploader = self._search_regex( | |
dc2c37f3 | 63 | r'class="user"[^>]*><img[^>]+>([^<]+)', |
69263044 | 64 | webpage, 'uploader', default=None) |
d97aae75 S |
65 | |
66 | age_limit = self._rta_search(webpage) | |
64102296 | 67 | |
68 | return { | |
d97aae75 S |
69 | 'id': video_id, |
70 | 'title': title, | |
71 | 'description': description, | |
72 | 'thumbnail': thumbnail, | |
73 | 'uploader': uploader, | |
74 | 'formats': formats, | |
75 | 'age_limit': age_limit, | |
64102296 | 76 | } |