]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/spankbang.py
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
19 class SpankBangIE(InfoExtractor
):
22 (?:[^/]+\.)?spankbang\.com/
24 (?P<id>[\da-z]+)/(?:video|play|embed)\b|
25 [\da-z]+-(?P<id_2>[\da-z]+)/playlist/[^/?#&]+
29 'url': 'https://spankbang.com/56b3d/video/the+slut+maker+hmv',
30 'md5': '2D13903DE4ECC7895B5D55930741650A',
34 'title': 'The Slut Maker HMV',
35 'description': 'Girls getting converted into cock slaves.',
36 'thumbnail': r
're:^https?://.*\.jpg$',
37 'uploader': 'Mindself',
38 'uploader_id': 'mindself',
39 'timestamp': 1617109572,
40 'upload_date': '20210330',
45 'url': 'http://spankbang.com/1vt0/video/solvane+gangbang',
46 'only_matching': True,
49 'url': 'http://spankbang.com/lklg/video/sex+with+anyone+wedding+edition+2',
50 'only_matching': True,
53 'url': 'http://m.spankbang.com/1o2de/video/can+t+remember+her+name',
54 'only_matching': True,
57 'url': 'https://spankbang.com/1vwqx/video/jade+kush+solo+4k',
58 'only_matching': True,
60 'url': 'https://m.spankbang.com/3vvn/play/fantasy+solo/480p/',
61 'only_matching': True,
63 'url': 'https://m.spankbang.com/3vvn/play',
64 'only_matching': True,
66 'url': 'https://spankbang.com/2y3td/embed/',
67 'only_matching': True,
69 'url': 'https://spankbang.com/2v7ik-7ecbgu/playlist/latina+booty',
70 'only_matching': True,
73 def _real_extract(self
, url
):
74 mobj
= self
._match
_valid
_url
(url
)
75 video_id
= mobj
.group('id') or mobj
.group('id_2')
76 webpage
= self
._download
_webpage
(
77 url
.replace('/%s/embed' % video_id
, '/%s/video' % video_id
),
78 video_id
, headers
={'Cookie': 'country=US'}
)
80 if re
.search(r
'<[^>]+\b(?:id|class)=["\']video_removed
', webpage):
82 'Video
%s is not available
' % video_id, expected=True)
86 def extract_format(format_id, format_url):
87 f_url = url_or_none(format_url)
90 f = parse_resolution(format_id)
91 ext = determine_ext(f_url)
92 if format_id.startswith('m3u8
') or ext == 'm3u8
':
93 formats.extend(self._extract_m3u8_formats(
94 f_url, video_id, 'mp4
', entry_protocol='m3u8_native
',
95 m3u8_id='hls
', fatal=False))
96 elif format_id.startswith('mpd
') or ext == 'mpd
':
97 formats.extend(self._extract_mpd_formats(
98 f_url, video_id, mpd_id='dash
', fatal=False))
99 elif ext == 'mp4
' or f.get('width
') or f.get('height
'):
102 'format_id
': format_id,
106 STREAM_URL_PREFIX = 'stream_url_
'
108 for mobj in re.finditer(
109 r'%s(?P
<id>[^\s
=]+)\s
*=\s
*(["\'])(?P<url>(?:(?!\2).)+)\2'
110 % STREAM_URL_PREFIX, webpage):
111 extract_format(mobj.group('id', 'url'))
114 stream_key = self._search_regex(
115 r'data-streamkey\s*=\s*(["\'])(?P
<value
>(?
:(?
!\
1).)+)\
1',
116 webpage, 'stream key
', group='value
')
118 stream = self._download_json(
119 'https
://spankbang
.com
/api
/videos
/stream
', video_id,
120 'Downloading stream JSON
', data=urlencode_postdata({
125 'X
-Requested
-With
': 'XMLHttpRequest
',
128 for format_id, format_url in stream.items():
129 if format_url and isinstance(format_url, list):
130 format_url = format_url[0]
131 extract_format(format_id, format_url)
133 self._sort_formats(formats)
135 info = self._search_json_ld(webpage, video_id, default={})
137 title = self._html_search_regex(
138 r'(?s
)<h1
[^
>]+\btitle
=["\']([^"]+)["\']>', webpage, 'title', default=None)
139 description = self._search_regex(
140 r'<div[^>]+\bclass=["\']bottom
[^
>]+>\s
*<p
>[^
<]*</p
>\s
*<p
>([^
<]+)',
141 webpage, 'description
', default=None)
142 thumbnail = self._og_search_thumbnail(webpage, default=None)
143 uploader = self._html_search_regex(
144 r'<svg
[^
>]+\bclass
="(?:[^"]*?user
[^
"]*?)">.*?
</svg
>([^
<]+)', webpage, 'uploader
', default=None)
145 uploader_id = self._html_search_regex(
146 r'<a
[^
>]+href
="/profile/([^"]+)"', webpage, 'uploader_id', default=None)
147 duration = parse_duration(self._search_regex(
148 r'<div[^>]+\bclass=["\']right_side
[^
>]+>\s
*<span
>([^
<]+)',
149 webpage, 'duration
', default=None))
150 view_count = str_to_int(self._search_regex(
151 r'([\d
,.]+)\s
+plays
', webpage, 'view count
', default=None))
153 age_limit = self._rta_search(webpage)
157 'title
': title or video_id,
158 'description
': description,
159 'thumbnail
': thumbnail,
160 'uploader
': uploader,
161 'uploader_id
': uploader_id,
162 'duration
': duration,
163 'view_count
': view_count,
165 'age_limit
': age_limit,
170 class SpankBangPlaylistIE(InfoExtractor):
171 _VALID_URL = r'https?
://(?
:[^
/]+\
.)?spankbang\
.com
/(?P
<id>[\da
-z
]+)/playlist
/(?P
<display_id
>[^
/]+)'
173 'url
': 'https
://spankbang
.com
/ug0k
/playlist
/big
+ass
+titties
',
176 'title
': 'Big Ass Titties
',
178 'playlist_mincount
': 40,
181 def _real_extract(self, url):
182 mobj = self._match_valid_url(url)
183 playlist_id = mobj.group('id')
184 display_id = mobj.group('display_id
')
186 webpage = self._download_webpage(
187 url, playlist_id, headers={'Cookie': 'country=US; mobile=on'})
189 entries = [self.url_result(
190 urljoin(url, mobj.group('path
')),
191 ie=SpankBangIE.ie_key(), video_id=mobj.group('id'))
192 for mobj in re.finditer(
193 r'<a
[^
>]+\bhref
=(["\'])(?P<path>/?[\da-z]+-(?P<id>[\da-z]+)/playlist/%s(?:(?!\1).)*)\1'
194 % re.escape(display_id), webpage)]
196 title = self._html_search_regex(
197 r'<h1>([^<]+)\s+playlist\s*<', webpage, 'playlist title',
200 return self.playlist_result(entries, playlist_id, title)