aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Buchbinder <jeff@ourexchange.net>2015-03-04 17:38:21 -0500
committerSergey M․ <dstftw@gmail.com>2015-03-17 20:33:32 +0600
commit13047f41359e32bf56bdc8dd555bae6c1065512d (patch)
tree509da1143aa1acf82cad47bad7c71fc99ae1c3c9
parentaf69cab21d48da78ff7d2b54effb9dfd5fcfd1d8 (diff)
[Primesharetv] Handle file not existing properly.
-rw-r--r--youtube_dl/extractor/primesharetv.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/youtube_dl/extractor/primesharetv.py b/youtube_dl/extractor/primesharetv.py
index 7c545761b..570fd2210 100644
--- a/youtube_dl/extractor/primesharetv.py
+++ b/youtube_dl/extractor/primesharetv.py
@@ -1,8 +1,11 @@
# encoding: utf-8
from __future__ import unicode_literals
+import re
+
from .common import InfoExtractor
from ..utils import (
+ ExtractorError,
int_or_none,
parse_filesize,
unified_strdate,
@@ -31,10 +34,12 @@ class PrimesharetvIE(InfoExtractor):
def _real_extract(self, url):
video_id = self._match_id(url)
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)
- hashtoken = self._search_regex(r' name="hash" value="(.*?)" ', webpage, 'hash token')
data = urlencode_postdata({
'hash': hashtoken,
})
@@ -44,7 +49,6 @@ class PrimesharetvIE(InfoExtractor):
}
video_page_request = compat_urllib_request.Request(url, data, headers=headers)
video_page = self._download_webpage(video_page_request, None, False, '')
-
video_url = self._html_search_regex(
r'url: \'(http://[a-z0-9]+\.primeshare\.tv:443/file/get/[^\']+)\',', video_page, 'video url')
@@ -57,3 +61,8 @@ class PrimesharetvIE(InfoExtractor):
'title': title,
'ext': 'mp4',
}
+
+ def _debug_print(self, txt):
+ if self._downloader.params.get('verbose'):
+ self.to_screen('[debug] %s' % txt)
+