3 from .common
import InfoExtractor
17 class SpankBangIE(InfoExtractor
):
20 (?:[^/]+\.)?spankbang\.com/
22 (?P<id>[\da-z]+)/(?:video|play|embed)\b|
23 [\da-z]+-(?P<id_2>[\da-z]+)/playlist/[^/?#&]+
27 'url': 'https://spankbang.com/56b3d/video/the+slut+maker+hmv',
28 'md5': '2D13903DE4ECC7895B5D55930741650A',
32 'title': 'The Slut Maker HMV',
33 'description': 'Girls getting converted into cock slaves.',
34 'thumbnail': r
're:^https?://.*\.jpg$',
35 'uploader': 'Mindself',
36 'uploader_id': 'mindself',
37 'timestamp': 1617109572,
38 'upload_date': '20210330',
43 'url': 'http://spankbang.com/1vt0/video/solvane+gangbang',
44 'only_matching': True,
47 'url': 'http://spankbang.com/lklg/video/sex+with+anyone+wedding+edition+2',
48 'only_matching': True,
51 'url': 'http://m.spankbang.com/1o2de/video/can+t+remember+her+name',
52 'only_matching': True,
55 'url': 'https://spankbang.com/1vwqx/video/jade+kush+solo+4k',
56 'only_matching': True,
58 'url': 'https://m.spankbang.com/3vvn/play/fantasy+solo/480p/',
59 'only_matching': True,
61 'url': 'https://m.spankbang.com/3vvn/play',
62 'only_matching': True,
64 'url': 'https://spankbang.com/2y3td/embed/',
65 'only_matching': True,
67 'url': 'https://spankbang.com/2v7ik-7ecbgu/playlist/latina+booty',
68 'only_matching': True,
71 def _real_extract(self
, url
):
72 mobj
= self
._match
_valid
_url
(url
)
73 video_id
= mobj
.group('id') or mobj
.group('id_2')
74 webpage
= self
._download
_webpage
(
75 url
.replace(f
'/{video_id}/embed', f
'/{video_id}/video'),
76 video_id
, headers
={'Cookie': 'country=US'})
78 if re
.search(r
'<[^>]+\b(?:id|class)=["\']video_removed
', webpage):
80 f'Video {video_id}
is not available
', expected=True)
84 def extract_format(format_id, format_url):
85 f_url = url_or_none(format_url)
88 f = parse_resolution(format_id)
89 ext = determine_ext(f_url)
90 if format_id.startswith('m3u8
') or ext == 'm3u8
':
91 formats.extend(self._extract_m3u8_formats(
92 f_url, video_id, 'mp4
', entry_protocol='m3u8_native
',
93 m3u8_id='hls
', fatal=False))
94 elif format_id.startswith('mpd
') or ext == 'mpd
':
95 formats.extend(self._extract_mpd_formats(
96 f_url, video_id, mpd_id='dash
', fatal=False))
97 elif ext == 'mp4
' or f.get('width
') or f.get('height
'):
100 'format_id
': format_id,
104 STREAM_URL_PREFIX = 'stream_url_
'
106 for mobj in re.finditer(
107 rf'{STREAM_URL_PREFIX}
(?P
<id>[^\s
=]+)\s
*=\s
*(["\'])(?P<url>(?:(?!\2).)+)\2', webpage):
108 extract_format(mobj.group('id', 'url'))
111 stream_key = self._search_regex(
112 r'data-streamkey\s*=\s*(["\'])(?P
<value
>(?
:(?
!\
1).)+)\
1',
113 webpage, 'stream key
', group='value
')
115 stream = self._download_json(
116 'https
://spankbang
.com
/api
/videos
/stream
', video_id,
117 'Downloading stream JSON
', data=urlencode_postdata({
122 'X
-Requested
-With
': 'XMLHttpRequest
',
125 for format_id, format_url in stream.items():
126 if format_url and isinstance(format_url, list):
127 format_url = format_url[0]
128 extract_format(format_id, format_url)
130 info = self._search_json_ld(webpage, video_id, default={})
132 title = self._html_search_regex(
133 r'(?s
)<h1
[^
>]+\btitle
=["\']([^"]+)["\']>', webpage, 'title', default=None)
134 description = self._search_regex(
135 r'<div[^>]+\bclass=["\']bottom
[^
>]+>\s
*<p
>[^
<]*</p
>\s
*<p
>([^
<]+)',
136 webpage, 'description
', default=None)
137 thumbnail = self._og_search_thumbnail(webpage, default=None)
138 uploader = self._html_search_regex(
139 r'<svg
[^
>]+\bclass
="(?:[^"]*?user
[^
"]*?)">.*?
</svg
>([^
<]+)', webpage, 'uploader
', default=None)
140 uploader_id = self._html_search_regex(
141 r'<a
[^
>]+href
="/profile/([^"]+)"', webpage, 'uploader_id', default=None)
142 duration = parse_duration(self._search_regex(
143 r'<div[^>]+\bclass=["\']right_side
[^
>]+>\s
*<span
>([^
<]+)',
144 webpage, 'duration
', default=None))
145 view_count = str_to_int(self._search_regex(
146 r'([\d
,.]+)\s
+plays
', webpage, 'view count
', default=None))
148 age_limit = self._rta_search(webpage)
152 'title
': title or video_id,
153 'description
': description,
154 'thumbnail
': thumbnail,
155 'uploader
': uploader,
156 'uploader_id
': uploader_id,
157 'duration
': duration,
158 'view_count
': view_count,
160 'age_limit
': age_limit,
165 class SpankBangPlaylistIE(InfoExtractor):
166 _VALID_URL = r'https?
://(?
:[^
/]+\
.)?spankbang\
.com
/(?P
<id>[\da
-z
]+)/playlist
/(?P
<display_id
>[^
/]+)'
168 'url
': 'https
://spankbang
.com
/ug0k
/playlist
/big
+ass
+titties
',
171 'title
': 'Big Ass Titties
',
173 'playlist_mincount
': 40,
176 def _real_extract(self, url):
177 mobj = self._match_valid_url(url)
178 playlist_id = mobj.group('id')
180 webpage = self._download_webpage(
181 url, playlist_id, headers={'Cookie
': 'country
=US
; mobile
=on
'})
183 entries = [self.url_result(
184 urljoin(url, mobj.group('path
')),
185 ie=SpankBangIE.ie_key(), video_id=mobj.group('id'))
186 for mobj in re.finditer(
187 r'<a
[^
>]+\bhref
=(["\'])(?P<path>/?[\da-z]+-(?P<id>[\da-z]+)/playlist/[^"\'](?
:(?
!\
1).)*)\
1',
190 title = self._html_search_regex(
191 r'<em
>([^
<]+)</em
>\s
+playlist\s
*<', webpage, 'playlist title
',
194 return self.playlist_result(entries, playlist_id, title)