Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SpankBangPlaylist] Add new extractor #19145

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion youtube_dl/extractor/extractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -1058,7 +1058,10 @@
SouthParkEsIE,
SouthParkNlIE
)
from .spankbang import SpankBangIE
from .spankbang import (
SpankBangIE,
SpankBangPlaylistIE,
)
from .spankwire import SpankwireIE
from .spiegel import SpiegelIE, SpiegelArticleIE
from .spiegeltv import SpiegeltvIE
Expand Down
33 changes: 32 additions & 1 deletion youtube_dl/extractor/spankbang.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


class SpankBangIE(InfoExtractor):
_VALID_URL = r'https?://(?:(?:www|m|[a-z]{2})\.)?spankbang\.com/(?P<id>[\da-z]+)/video'
_VALID_URL = r'https?://(?:(?:www|m|[a-z]{2})\.)?spankbang\.com/(?P<id>[\da-z-]+)/(?:video|playlist)'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not match playlist URLs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was to match single playlist videos..but i changed it back

_TESTS = [{
'url': 'http://spankbang.com/3vvn/video/fantasy+solo',
'md5': '1cc433e1d6aa14bc376535b8679302f7',
Expand Down Expand Up @@ -94,3 +94,34 @@ def _real_extract(self, url):
'formats': formats,
'age_limit': age_limit,
}


class SpankBangPlaylistIE(InfoExtractor):
_VALID_URL = r'https?://(?:(?:www|m|[a-z]{2})\.)?spankbang\.com/(?P<id>[\da-z]+)/playlist'
_TEST = {
'url': 'https://spankbang.com/ug0k/playlist/big+ass+titties',
'info_dict': {
'id': 'ug0k',
'title': 'Big Ass Titties playlist',
},
'playlist_mincount': 2,
}

def _extract_entries(self, webpage):
return [
self.url_result(
'http://www.%s/%s' % ('spankbang.com', video_url),
JChris246 marked this conversation as resolved.
Show resolved Hide resolved
SpankBangIE.ie_key())
for video_url in re.findall(
r'href="/?([\da-z-]+/playlist/[^"]+)', webpage)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. This is too broad, regex should be restricted by playlist id.
  2. This captures duplicates.

]

def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url)
playlist_id = mobj.group('id')
JChris246 marked this conversation as resolved.
Show resolved Hide resolved
webpage = self._download_webpage(url, playlist_id)

entries = self._extract_entries(webpage)
title = self._search_regex(r'<h1>(.+)</h1>', webpage, 'playlist_title')
JChris246 marked this conversation as resolved.
Show resolved Hide resolved

return self.playlist_result(entries, playlist_id, title)