1 from __future__ import unicode_literals
5 from .common import InfoExtractor
15 class SpankBangIE(InfoExtractor):
16 _VALID_URL = r'https?://(?:[^/]+\.)?spankbang\.com/(?P<id>[\da-z]+)/(?:video|play|embed)\b'
18 'url': 'http://spankbang.com/3vvn/video/fantasy+solo',
19 'md5': '1cc433e1d6aa14bc376535b8679302f7',
23 'title': 'fantasy solo',
24 'description': 'dillion harper masturbates on a bed',
25 'thumbnail': r're:^https?://.*\.jpg$',
26 'uploader': 'silly2587',
31 'url': 'http://spankbang.com/1vt0/video/solvane+gangbang',
32 'only_matching': True,
35 'url': 'http://spankbang.com/lklg/video/sex+with+anyone+wedding+edition+2',
36 'only_matching': True,
39 'url': 'http://m.spankbang.com/1o2de/video/can+t+remember+her+name',
40 'only_matching': True,
43 'url': 'https://spankbang.com/1vwqx/video/jade+kush+solo+4k',
44 'only_matching': True,
46 'url': 'https://m.spankbang.com/3vvn/play/fantasy+solo/480p/',
47 'only_matching': True,
49 'url': 'https://m.spankbang.com/3vvn/play',
50 'only_matching': True,
52 'url': 'https://spankbang.com/2y3td/embed/',
53 'only_matching': True,
56 def _real_extract(self, url):
57 video_id = self._match_id(url)
58 webpage = self._download_webpage(
59 url.replace('/%s/embed' % video_id, '/%s/video' % video_id),
60 video_id, headers={'Cookie': 'country=US'})
62 if re.search(r'<[^>]+\bid=["\']video_removed', webpage):
64 'Video %s is not available' % video_id, expected=True)
67 for mobj in re.finditer(
68 r'stream_url_(?P<id>[^\s=]+)\s*=\s*(["\'])(?P<url>(?:(?!\2).)+)\2',
70 format_id, format_url = mobj.group('id', 'url')
71 f = parse_resolution(format_id)
74 'format_id': format_id,
77 self._sort_formats(formats)
79 title = self._html_search_regex(
80 r'(?s)<h1[^>]*>(.+?)</h1>', webpage, 'title')
81 description = self._search_regex(
82 r'<div[^>]+\bclass=["\']bottom[^>]+>\s*<p>[^<]*</p>\s*<p>([^<]+)',
83 webpage, 'description', fatal=False)
84 thumbnail = self._og_search_thumbnail(webpage)
85 uploader = self._search_regex(
86 r'class="user"[^>]*><img[^>]+>([^<]+)',
87 webpage, 'uploader', default=None)
88 duration = parse_duration(self._search_regex(
89 r'<div[^>]+\bclass=["\']right_side[^>]+>\s*<span>([^<]+)',
90 webpage, 'duration', fatal=False))
91 view_count = str_to_int(self._search_regex(
92 r'([\d,.]+)\s+plays', webpage, 'view count', fatal=False))
94 age_limit = self._rta_search(webpage)
99 'description': description,
100 'thumbnail': thumbnail,
101 'uploader': uploader,
102 'duration': duration,
103 'view_count': view_count,
105 'age_limit': age_limit,
109 class SpankBangPlaylistIE(InfoExtractor):
110 _VALID_URL = r'https?://(?:[^/]+\.)?spankbang\.com/(?P<id>[\da-z]+)/playlist/[^/]+'
112 'url': 'https://spankbang.com/ug0k/playlist/big+ass+titties',
115 'title': 'Big Ass Titties',
117 'playlist_mincount': 50,
120 def _real_extract(self, url):
121 playlist_id = self._match_id(url)
123 webpage = self._download_webpage(
124 url, playlist_id, headers={'Cookie': 'country=US; mobile=on'})
126 entries = [self.url_result(
127 'https://spankbang.com/%s/video' % video_id,
128 ie=SpankBangIE.ie_key(), video_id=video_id)
129 for video_id in orderedSet(re.findall(
130 r'<a[^>]+\bhref=["\']/?([\da-z]+)/play/', webpage))]
132 title = self._html_search_regex(
133 r'<h1>([^<]+)\s+playlist</h1>', webpage, 'playlist title',
136 return self.playlist_result(entries, playlist_id, title)