mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-18 19:45:03 +00:00
[Primesharetv] Handle file not existing properly.
This commit is contained in:
parent
af69cab21d
commit
13047f4135
@ -1,8 +1,11 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
|
ExtractorError,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
parse_filesize,
|
parse_filesize,
|
||||||
unified_strdate,
|
unified_strdate,
|
||||||
@ -31,10 +34,12 @@ class PrimesharetvIE(InfoExtractor):
|
|||||||
def _real_extract(self, url):
|
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'<h1>File not exist</h1>', webpage) is not None:
|
||||||
|
raise ExtractorError('The file does not exist', expected=True)
|
||||||
|
hashtoken = self._search_regex(r' name="hash" value="(.*?)" ', webpage, 'hash token')
|
||||||
|
|
||||||
self._sleep(9, video_id)
|
self._sleep(9, video_id)
|
||||||
|
|
||||||
hashtoken = self._search_regex(r' name="hash" value="(.*?)" ', webpage, 'hash token')
|
|
||||||
data = urlencode_postdata({
|
data = urlencode_postdata({
|
||||||
'hash': hashtoken,
|
'hash': hashtoken,
|
||||||
})
|
})
|
||||||
@ -44,7 +49,6 @@ class PrimesharetvIE(InfoExtractor):
|
|||||||
}
|
}
|
||||||
video_page_request = compat_urllib_request.Request(url, data, headers=headers)
|
video_page_request = compat_urllib_request.Request(url, data, headers=headers)
|
||||||
video_page = self._download_webpage(video_page_request, None, False, '')
|
video_page = self._download_webpage(video_page_request, None, False, '')
|
||||||
|
|
||||||
video_url = self._html_search_regex(
|
video_url = self._html_search_regex(
|
||||||
r'url: \'(http://[a-z0-9]+\.primeshare\.tv:443/file/get/[^\']+)\',', video_page, 'video url')
|
r'url: \'(http://[a-z0-9]+\.primeshare\.tv:443/file/get/[^\']+)\',', video_page, 'video url')
|
||||||
|
|
||||||
@ -57,3 +61,8 @@ class PrimesharetvIE(InfoExtractor):
|
|||||||
'title': title,
|
'title': title,
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def _debug_print(self, txt):
|
||||||
|
if self._downloader.params.get('verbose'):
|
||||||
|
self.to_screen('[debug] %s' % txt)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user