mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-15 03:27:51 +01:00
Merge pull request #3716 from naglis/nosvideo
[nosvideo] Check for deleted video
This commit is contained in:
commit
de00ff6494
@ -5,8 +5,9 @@
|
|||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
compat_urllib_parse,
|
ExtractorError,
|
||||||
compat_urllib_request,
|
compat_urllib_request,
|
||||||
|
urlencode_postdata,
|
||||||
xpath_with_ns,
|
xpath_with_ns,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -18,11 +19,12 @@ class NosVideoIE(InfoExtractor):
|
|||||||
_VALID_URL = r'https?://(?:www\.)?nosvideo\.com/' + \
|
_VALID_URL = r'https?://(?:www\.)?nosvideo\.com/' + \
|
||||||
'(?:embed/|\?v=)(?P<id>[A-Za-z0-9]{12})/?'
|
'(?:embed/|\?v=)(?P<id>[A-Za-z0-9]{12})/?'
|
||||||
_PLAYLIST_URL = 'http://nosvideo.com/xml/{xml_id:s}.xml'
|
_PLAYLIST_URL = 'http://nosvideo.com/xml/{xml_id:s}.xml'
|
||||||
|
_FILE_DELETED_REGEX = r'<b>File Not Found</b>'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
'url': 'http://nosvideo.com/?v=drlp6s40kg54',
|
'url': 'http://nosvideo.com/?v=mu8fle7g7rpq',
|
||||||
'md5': '4b4ac54c6ad5d70ab88f2c2c6ccec71c',
|
'md5': '6124ed47130d8be3eacae635b071e6b6',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'drlp6s40kg54',
|
'id': 'mu8fle7g7rpq',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'big_buck_bunny_480p_surround-fix.avi.mp4',
|
'title': 'big_buck_bunny_480p_surround-fix.avi.mp4',
|
||||||
'thumbnail': 're:^https?://.*\.jpg$',
|
'thumbnail': 're:^https?://.*\.jpg$',
|
||||||
@ -38,11 +40,14 @@ def _real_extract(self, url):
|
|||||||
'op': 'download1',
|
'op': 'download1',
|
||||||
'method_free': 'Continue to Video',
|
'method_free': 'Continue to Video',
|
||||||
}
|
}
|
||||||
post = compat_urllib_parse.urlencode(fields)
|
req = compat_urllib_request.Request(url, urlencode_postdata(fields))
|
||||||
req = compat_urllib_request.Request(url, post)
|
|
||||||
req.add_header('Content-type', 'application/x-www-form-urlencoded')
|
req.add_header('Content-type', 'application/x-www-form-urlencoded')
|
||||||
webpage = self._download_webpage(req, video_id,
|
webpage = self._download_webpage(req, video_id,
|
||||||
'Downloading download page')
|
'Downloading download page')
|
||||||
|
if re.search(self._FILE_DELETED_REGEX, webpage) is not None:
|
||||||
|
raise ExtractorError('Video %s does not exist' % video_id,
|
||||||
|
expected=True)
|
||||||
|
|
||||||
xml_id = self._search_regex(r'php\|([^\|]+)\|', webpage, 'XML ID')
|
xml_id = self._search_regex(r'php\|([^\|]+)\|', webpage, 'XML ID')
|
||||||
playlist_url = self._PLAYLIST_URL.format(xml_id=xml_id)
|
playlist_url = self._PLAYLIST_URL.format(xml_id=xml_id)
|
||||||
playlist = self._download_xml(playlist_url, video_id)
|
playlist = self._download_xml(playlist_url, video_id)
|
||||||
|
Loading…
Reference in New Issue
Block a user