1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-02 09:12:40 +01:00

[spankbang] Detect unavailable videos (closes #14644)

This commit is contained in:
Sergey M․ 2017-10-31 23:05:25 +07:00
parent 6d0630d880
commit 8fe767e072
No known key found for this signature in database
GPG Key ID: 2C393E0F18A9236D

View File

@ -3,6 +3,7 @@
import re import re
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ExtractorError
class SpankBangIE(InfoExtractor): class SpankBangIE(InfoExtractor):
@ -33,6 +34,10 @@ def _real_extract(self, url):
video_id = self._match_id(url) video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id) webpage = self._download_webpage(url, video_id)
if re.search(r'<[^>]+\bid=["\']video_removed', webpage):
raise ExtractorError(
'Video %s is not available' % video_id, expected=True)
stream_key = self._html_search_regex( stream_key = self._html_search_regex(
r'''var\s+stream_key\s*=\s*['"](.+?)['"]''', r'''var\s+stream_key\s*=\s*['"](.+?)['"]''',
webpage, 'stream key') webpage, 'stream key')