Skip to content

Commit

Permalink
[spankbang] Extend _VALID_URL
Browse files Browse the repository at this point in the history
  • Loading branch information
dstftw authored and meunierd committed Feb 13, 2020
1 parent 241c5d7 commit 721e191
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions 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?://(?:[^/]+\.)?spankbang\.com/(?P<id>[\da-z]+)/(?:video|play|embed)'
_TESTS = [{
'url': 'http://spankbang.com/3vvn/video/fantasy+solo',
'md5': '1cc433e1d6aa14bc376535b8679302f7',
Expand Down Expand Up @@ -41,13 +41,22 @@ class SpankBangIE(InfoExtractor):
# 4k
'url': 'https://spankbang.com/1vwqx/video/jade+kush+solo+4k',
'only_matching': True,
}, {
'url': 'https://m.spankbang.com/3vvn/play/fantasy+solo/480p/',
'only_matching': True,
}, {
'url': 'https://m.spankbang.com/3vvn/play',
'only_matching': True,
}, {
'url': 'https://spankbang.com/2y3td/embed/',
'only_matching': True,
}]

def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id, headers={
'Cookie': 'country=US'
})
webpage = self._download_webpage(
url.replace('/%s/embed' % video_id, '/%s/video' % video_id),
video_id, headers={'Cookie': 'country=US'})

if re.search(r'<[^>]+\bid=["\']video_removed', webpage):
raise ExtractorError(
Expand Down

0 comments on commit 721e191

Please sign in to comment.