summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-12-18 16:07:21 +0100
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-12-18 16:07:21 +0100
commit4e9c8f7ab1269966a9eac9e1b6363f5458f9f970 (patch)
tree82f54383c4f5a341ff43c06bb51e6309987c22ad /module
parentUpdate account plugins (diff)
downloadpyload-4e9c8f7ab1269966a9eac9e1b6363f5458f9f970.tar.xz
Update checkFile routine in some hoster plugins
Diffstat (limited to 'module')
-rw-r--r--module/plugins/hoster/AlldebridCom.py11
-rw-r--r--module/plugins/hoster/DebridItaliaCom.py8
-rw-r--r--module/plugins/hoster/FastixRu.py9
-rw-r--r--module/plugins/hoster/FastshareCz.py4
-rw-r--r--module/plugins/hoster/FileSharkPl.py4
-rw-r--r--module/plugins/hoster/LinksnappyCom.py4
-rw-r--r--module/plugins/hoster/OverLoadMe.py4
-rw-r--r--module/plugins/hoster/PremiumTo.py14
-rw-r--r--module/plugins/hoster/RealdebridCom.py4
-rw-r--r--module/plugins/hoster/ShareonlineBiz.py11
-rw-r--r--module/plugins/hoster/SimplydebridCom.py4
-rw-r--r--module/plugins/hoster/UploadableCh.py4
-rw-r--r--module/plugins/hoster/ZeveraCom.py6
-rw-r--r--module/plugins/internal/MultiHoster.py2
-rw-r--r--module/plugins/internal/SimpleHoster.py20
15 files changed, 59 insertions, 50 deletions
diff --git a/module/plugins/hoster/AlldebridCom.py b/module/plugins/hoster/AlldebridCom.py
index abcb1e5b1..ff909b596 100644
--- a/module/plugins/hoster/AlldebridCom.py
+++ b/module/plugins/hoster/AlldebridCom.py
@@ -13,7 +13,7 @@ from module.utils import parseFileSize
class AlldebridCom(SimpleHoster):
__name__ = "AlldebridCom"
__type__ = "hoster"
- __version__ = "0.35"
+ __version__ = "0.36"
__pattern__ = r'https?://(?:[^/]*\.)?alldebrid\..*'
@@ -73,14 +73,11 @@ class AlldebridCom(SimpleHoster):
self.pyfile.name = self.getFilename(self.link)
- def checkFile(self):
- check = self.checkDownload({'error': "<title>An error occured while processing your request</title>",
- 'empty': re.compile(r"^$")})
+ def AlldebridCom(self):
+ super(AlldebridCom, self).checkFile()
- if check == "error":
+ if self.checkDownload({'error': "<title>An error occured while processing your request</title>"}) is "error":
self.retry(wait_time=60, reason=_("An error occured while generating link"))
- elif check == "empty":
- self.retry(wait_time=60, reason=_("Downloaded File was empty"))
getInfo = create_getInfo(AlldebridCom)
diff --git a/module/plugins/hoster/DebridItaliaCom.py b/module/plugins/hoster/DebridItaliaCom.py
index 6a86ba4e4..ae7051572 100644
--- a/module/plugins/hoster/DebridItaliaCom.py
+++ b/module/plugins/hoster/DebridItaliaCom.py
@@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class DebridItaliaCom(SimpleHoster):
__name__ = "DebridItaliaCom"
__type__ = "hoster"
- __version__ = "0.09"
+ __version__ = "0.10"
__pattern__ = r'http://s\d+\.debriditalia\.com/dl/\d+'
@@ -36,10 +36,4 @@ class DebridItaliaCom(SimpleHoster):
self.link = html.strip()
- def checkFile(self):
- check = self.checkDownload({'empty': re.compile(r'^$')})
- if check == "empty":
- self.retry(5, 2 * 60, "Empty file downloaded")
-
-
getInfo = create_getInfo(DebridItaliaCom)
diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py
index 56d1e911a..8778d770e 100644
--- a/module/plugins/hoster/FastixRu.py
+++ b/module/plugins/hoster/FastixRu.py
@@ -12,7 +12,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class FastixRu(SimpleHoster):
__name__ = "FastixRu"
__type__ = "hoster"
- __version__ = "0.05"
+ __version__ = "0.06"
__pattern__ = r'http://(?:www\.)?fastix\.(ru|it)/file/(?P<ID>\w{24})'
@@ -63,13 +63,10 @@ class FastixRu(SimpleHoster):
def checkFile(self):
- check = self.checkDownload({"error": "<title>An error occurred while processing your request</title>",
- "empty": re.compile(r"^$")})
+ super(FastixRu, self).checkFile()
- if check == "error":
+ if self.checkDownload({"error": "<title>An error occurred while processing your request</title>"}) is "error":
self.retry(wait_time=60, reason=_("An error occurred while generating link"))
- elif check == "empty":
- self.retry(wait_time=60, reason=_("Downloaded File was empty"))
getInfo = create_getInfo(FastixRu)
diff --git a/module/plugins/hoster/FastshareCz.py b/module/plugins/hoster/FastshareCz.py
index 5e2057aa5..31437c6e7 100644
--- a/module/plugins/hoster/FastshareCz.py
+++ b/module/plugins/hoster/FastshareCz.py
@@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class FastshareCz(SimpleHoster):
__name__ = "FastshareCz"
__type__ = "hoster"
- __version__ = "0.25"
+ __version__ = "0.26"
__pattern__ = r'http://(?:www\.)?fastshare\.cz/\d+/.+'
@@ -58,6 +58,8 @@ class FastshareCz(SimpleHoster):
def checkFile(self):
+ super(FastshareCz, self).checkFile()
+
check = self.checkDownload({
'paralell_dl' : re.compile(r"<title>FastShare.cz</title>|<script>alert\('Pres FREE muzete stahovat jen jeden soubor najednou.'\)"),
'wrong_captcha': re.compile(r'Download for FREE'),
diff --git a/module/plugins/hoster/FileSharkPl.py b/module/plugins/hoster/FileSharkPl.py
index 25825a229..5250a92fe 100644
--- a/module/plugins/hoster/FileSharkPl.py
+++ b/module/plugins/hoster/FileSharkPl.py
@@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class FileSharkPl(SimpleHoster):
__name__ = "FileSharkPl"
__type__ = "hoster"
- __version__ = "0.04"
+ __version__ = "0.05"
__pattern__ = r'http://(?:www\.)?fileshark\.pl/pobierz/\d{6}/\w{5}'
@@ -116,6 +116,8 @@ class FileSharkPl(SimpleHoster):
def checkFile(self):
+ super(FileSharkPl, self).checkFile()
+
check = self.checkDownload({'wrong_captcha': re.compile(r'<label for="form_captcha" generated="true" class="error">(.*?)</label>'),
'wait_pattern' : re.compile(self.SECONDS_PATTERN),
'DL-found' : re.compile('<a href="(.*)">')})
diff --git a/module/plugins/hoster/LinksnappyCom.py b/module/plugins/hoster/LinksnappyCom.py
index c7bce407e..376b6d093 100644
--- a/module/plugins/hoster/LinksnappyCom.py
+++ b/module/plugins/hoster/LinksnappyCom.py
@@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class LinksnappyCom(SimpleHoster):
__name__ = "LinksnappyCom"
__type__ = "hoster"
- __version__ = "0.03"
+ __version__ = "0.04"
__pattern__ = r'https?://(?:[^/]*\.)?linksnappy\.com'
@@ -60,6 +60,8 @@ class LinksnappyCom(SimpleHoster):
def checkFile(self):
+ super(LinksnappyCom, self).checkFile()
+
check = self.checkDownload({"html302": "<title>302 Found</title>"})
if check == "html302":
diff --git a/module/plugins/hoster/OverLoadMe.py b/module/plugins/hoster/OverLoadMe.py
index 815313dd1..2ac1d755b 100644
--- a/module/plugins/hoster/OverLoadMe.py
+++ b/module/plugins/hoster/OverLoadMe.py
@@ -13,7 +13,7 @@ from module.utils import parseFileSize
class OverLoadMe(SimpleHoster):
__name__ = "OverLoadMe"
__type__ = "hoster"
- __version__ = "0.03"
+ __version__ = "0.04"
__pattern__ = r'https?://.*overload\.me.*'
@@ -72,6 +72,8 @@ class OverLoadMe(SimpleHoster):
def checkFile(self):
+ super(OverLoadMe, self).checkFile()
+
check = self.checkDownload(
{"error": "<title>An error occured while processing your request</title>"})
diff --git a/module/plugins/hoster/PremiumTo.py b/module/plugins/hoster/PremiumTo.py
index 6c94b3fa9..cb880d6c1 100644
--- a/module/plugins/hoster/PremiumTo.py
+++ b/module/plugins/hoster/PremiumTo.py
@@ -13,7 +13,7 @@ from module.utils import fs_encode
class PremiumTo(SimpleHoster):
__name__ = "PremiumTo"
__type__ = "hoster"
- __version__ = "0.12"
+ __version__ = "0.13"
__pattern__ = r'https?://(?:www\.)?premium\.to/.*'
@@ -47,6 +47,8 @@ class PremiumTo(SimpleHoster):
def checkFile(self):
+ super(PremiumTo, self).checkFile()
+
check = self.checkDownload({"nopremium": "No premium account available"})
if check == "nopremium":
@@ -56,13 +58,9 @@ class PremiumTo(SimpleHoster):
if self.req.http.code == '420':
# Custom error code send - fail
lastDownload = fs_encode(self.lastDownload)
-
- if exists(lastDownload):
- with open(lastDownload, "rb") as f:
- err = f.read(256).strip()
- remove(lastDownload)
- else:
- err = _('File does not exist')
+ with open(lastDownload, "rb") as f:
+ err = f.read(256).strip()
+ remove(lastDownload)
trb = self.getTraffic()
self.logInfo(_("Filesize: %d, Traffic used %d, traffic left %d") % (self.pyfile.size, tra - trb, trb))
diff --git a/module/plugins/hoster/RealdebridCom.py b/module/plugins/hoster/RealdebridCom.py
index 4fa42242a..e624d1f34 100644
--- a/module/plugins/hoster/RealdebridCom.py
+++ b/module/plugins/hoster/RealdebridCom.py
@@ -14,7 +14,7 @@ from module.utils import parseFileSize
class RealdebridCom(SimpleHoster):
__name__ = "RealdebridCom"
__type__ = "hoster"
- __version__ = "0.54"
+ __version__ = "0.55"
__pattern__ = r'https?://(?:[^/]*\.)?real-debrid\..*'
@@ -82,6 +82,8 @@ class RealdebridCom(SimpleHoster):
def checkFile(self):
+ super(RealdebridCom, self).checkFile()
+
check = self.checkDownload(
{"error": "<title>An error occured while processing your request</title>"})
diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py
index c40e8560f..dc3d5093c 100644
--- a/module/plugins/hoster/ShareonlineBiz.py
+++ b/module/plugins/hoster/ShareonlineBiz.py
@@ -14,7 +14,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class ShareonlineBiz(SimpleHoster):
__name__ = "ShareonlineBiz"
__type__ = "hoster"
- __version__ = "0.44"
+ __version__ = "0.45"
__pattern__ = r'https?://(?:www\.)?(share-online\.biz|egoshare\.com)/(download\.php\?id=|dl/)(?P<ID>\w+)'
@@ -108,17 +108,14 @@ class ShareonlineBiz(SimpleHoster):
def checkFile(self):
- # check download
+ super(ShareonlineBiz, self).checkFile()
+
check = self.checkDownload({
- 'empty' : re.compile(r"^$"),
'cookie': re.compile(r'<div id="dl_failure"'),
'fail' : re.compile(r"<title>Share-Online")
})
- if check == "empty":
- self.fail(_("Empty file"))
-
- elif check == "cookie":
+ if check == "cookie":
self.invalidCaptcha()
self.retry(5, 60, _("Cookie failure"))
diff --git a/module/plugins/hoster/SimplydebridCom.py b/module/plugins/hoster/SimplydebridCom.py
index 1b8ff11b2..8fa756606 100644
--- a/module/plugins/hoster/SimplydebridCom.py
+++ b/module/plugins/hoster/SimplydebridCom.py
@@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class SimplydebridCom(SimpleHoster):
__name__ = "SimplydebridCom"
__type__ = "hoster"
- __version__ = "0.11"
+ __version__ = "0.12"
__pattern__ = r'http://(?:www\.)?\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/sd\.php/*'
@@ -55,6 +55,8 @@ class SimplydebridCom(SimpleHoster):
def checkFile(self):
+ super(SimplydebridCom, self).checkFile()
+
check = self.checkDownload({"bad1": "No address associated with hostname", "bad2": "<html"})
if check == "bad1" or check == "bad2":
diff --git a/module/plugins/hoster/UploadableCh.py b/module/plugins/hoster/UploadableCh.py
index 1310ded36..6d8a032e9 100644
--- a/module/plugins/hoster/UploadableCh.py
+++ b/module/plugins/hoster/UploadableCh.py
@@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class UploadableCh(SimpleHoster):
__name__ = "UploadableCh"
__type__ = "hoster"
- __version__ = "0.03"
+ __version__ = "0.04"
__pattern__ = r'http://(?:www\.)?uploadable\.ch/file/(?P<ID>\w+)'
@@ -73,6 +73,8 @@ class UploadableCh(SimpleHoster):
def checkFile(self):
+ super(UploadableCh, self).checkFile()
+
check = self.checkDownload({'wait_or_reconnect': re.compile("Please wait for"),
'is_html' : re.compile("<head>")})
diff --git a/module/plugins/hoster/ZeveraCom.py b/module/plugins/hoster/ZeveraCom.py
index 8effea20b..d337dac9d 100644
--- a/module/plugins/hoster/ZeveraCom.py
+++ b/module/plugins/hoster/ZeveraCom.py
@@ -6,7 +6,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class ZeveraCom(SimpleHoster):
__name__ = "ZeveraCom"
__type__ = "hoster"
- __version__ = "0.22"
+ __version__ = "0.23"
__pattern__ = r'http://(?:www\.)?zevera\.com/.*'
@@ -36,9 +36,9 @@ class ZeveraCom(SimpleHoster):
def checkFile(self):
- check = self.checkDownload({"error": 'action="ErrorDownload.aspx'})
+ super(ZeveraCom, self).checkFile()
- if check == "error":
+ if self.checkDownload({"error": 'action="ErrorDownload.aspx'}) is "error":
self.fail(_("Error response received - contact Zevera support"))
diff --git a/module/plugins/internal/MultiHoster.py b/module/plugins/internal/MultiHoster.py
index 0bcb79817..68550a4dd 100644
--- a/module/plugins/internal/MultiHoster.py
+++ b/module/plugins/internal/MultiHoster.py
@@ -33,7 +33,7 @@ class MultiHoster(Hook):
("share-rapid.cz" , "multishare.cz" ),
("sharerapid.cz" , "multishare.cz" ),
("ul.to" , "uploaded.to" ),
- ("uploaded.net" , "uploaded.to" )]
+ ("uploaded.net" , "uploaded.to" )]
HOSTER_EXCLUDED = []
diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py
index 2ff60d6ea..949a6c66a 100644
--- a/module/plugins/internal/SimpleHoster.py
+++ b/module/plugins/internal/SimpleHoster.py
@@ -2,6 +2,7 @@
import re
+from os.path import exists
from time import time
from urllib import unquote
from urlparse import urljoin, urlparse
@@ -11,7 +12,7 @@ from module.network.CookieJar import CookieJar
from module.network.RequestFactory import getURL
from module.plugins.Hoster import Hoster
from module.plugins.Plugin import Fail
-from module.utils import fixup, parseFileSize
+from module.utils import fixup, fs_encode, parseFileSize
#@TODO: Adapt and move to PyFile in 0.4.10
@@ -154,7 +155,7 @@ def _isDirectLink(self, url, resumable=True):
class SimpleHoster(Hoster):
__name__ = "SimpleHoster"
__type__ = "hoster"
- __version__ = "0.75"
+ __version__ = "0.76"
__pattern__ = r'^unmatchable$'
@@ -410,8 +411,19 @@ class SimpleHoster(Hoster):
def checkFile(self):
- if self.checkDownload({'empty': re.compile(r"^$")}) is "empty": #@TODO: Move to hoster in 0.4.10
- self.fail(_("Empty file"))
+ if not self.lastDownload or not exists(fs_encode(self.lastDownload)):
+ self.fail(_("No file downloaded"))
+
+ else:
+ rules = {'empty file': re.compile(r"^$")}
+
+ if hasattr(self, 'ERROR_PATTERN'):
+ rules['error'] = re.compile(self.ERROR_PATTERN)
+
+ check = self.checkDownload(rules)
+ if check: #@TODO: Move to hoster in 0.4.10
+ errmsg = check.strip().capitalize() + (" | " + self.lastCheck.strip() if self.lastCheck else "")
+ self.retry(10, 60, errmsg)
def checkErrors(self):