[spangbang:playlist] Fix extraction (closes #24087)
This commit is contained in:
parent
cfa4ffa23b
commit
8bc4c6350e
1 changed files with 12 additions and 8 deletions
|
@ -13,6 +13,7 @@ from ..utils import (
|
||||||
str_to_int,
|
str_to_int,
|
||||||
url_or_none,
|
url_or_none,
|
||||||
urlencode_postdata,
|
urlencode_postdata,
|
||||||
|
urljoin,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -166,30 +167,33 @@ class SpankBangIE(InfoExtractor):
|
||||||
|
|
||||||
|
|
||||||
class SpankBangPlaylistIE(InfoExtractor):
|
class SpankBangPlaylistIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:[^/]+\.)?spankbang\.com/(?P<id>[\da-z]+)/playlist/[^/]+'
|
_VALID_URL = r'https?://(?:[^/]+\.)?spankbang\.com/(?P<id>[\da-z]+)/playlist/(?P<display_id>[^/]+)'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
'url': 'https://spankbang.com/ug0k/playlist/big+ass+titties',
|
'url': 'https://spankbang.com/ug0k/playlist/big+ass+titties',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'ug0k',
|
'id': 'ug0k',
|
||||||
'title': 'Big Ass Titties',
|
'title': 'Big Ass Titties',
|
||||||
},
|
},
|
||||||
'playlist_mincount': 50,
|
'playlist_mincount': 40,
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
playlist_id = self._match_id(url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
|
playlist_id = mobj.group('id')
|
||||||
|
display_id = mobj.group('display_id')
|
||||||
|
|
||||||
webpage = self._download_webpage(
|
webpage = self._download_webpage(
|
||||||
url, playlist_id, headers={'Cookie': 'country=US; mobile=on'})
|
url, playlist_id, headers={'Cookie': 'country=US; mobile=on'})
|
||||||
|
|
||||||
entries = [self.url_result(
|
entries = [self.url_result(
|
||||||
'https://spankbang.com/%s/video' % video_id,
|
urljoin(url, mobj.group('path')),
|
||||||
ie=SpankBangIE.ie_key(), video_id=video_id)
|
ie=SpankBangIE.ie_key(), video_id=mobj.group('id'))
|
||||||
for video_id in orderedSet(re.findall(
|
for mobj in re.finditer(
|
||||||
r'<a[^>]+\bhref=["\']/?([\da-z]+)/play/', webpage))]
|
r'<a[^>]+\bhref=(["\'])(?P<path>/?[\da-z]+-(?P<id>[\da-z]+)/playlist/%s(?:(?!\1).)*)\1'
|
||||||
|
% re.escape(display_id), webpage)]
|
||||||
|
|
||||||
title = self._html_search_regex(
|
title = self._html_search_regex(
|
||||||
r'<h1>([^<]+)\s+playlist</h1>', webpage, 'playlist title',
|
r'<h1>([^<]+)\s+playlist\s*<', webpage, 'playlist title',
|
||||||
fatal=False)
|
fatal=False)
|
||||||
|
|
||||||
return self.playlist_result(entries, playlist_id, title)
|
return self.playlist_result(entries, playlist_id, title)
|
||||||
|
|
Loading…
Reference in a new issue