summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-10-22 19:47:00 +0200
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-10-22 19:47:00 +0200
commit1b096b2eb2634e8dea80b06ab9ecde206b198b35 (patch)
treec37727ef1c0c43c553725c6a4ae92022f48bcc23 /module/plugins/hoster
parent[Keep2shareCC] Fix CAPTCHA_PATTERN (diff)
downloadpyload-1b096b2eb2634e8dea80b06ab9ecde206b198b35.tar.xz
Spare code cosmetics
Diffstat (limited to 'module/plugins/hoster')
-rw-r--r--module/plugins/hoster/BezvadataCz.py2
-rw-r--r--module/plugins/hoster/CrockoCom.py4
-rw-r--r--module/plugins/hoster/DataHu.py6
-rw-r--r--module/plugins/hoster/DataportCz.py2
-rw-r--r--module/plugins/hoster/DepositfilesCom.py2
-rw-r--r--module/plugins/hoster/FastshareCz.py19
-rw-r--r--module/plugins/hoster/FilefactoryCom.py1
-rw-r--r--module/plugins/hoster/FilerNet.py5
-rw-r--r--module/plugins/hoster/LomafileCom.py2
-rw-r--r--module/plugins/hoster/MegaRapidCz.py4
-rw-r--r--module/plugins/hoster/OneFichierCom.py1
-rw-r--r--module/plugins/hoster/ShareonlineBiz.py25
-rw-r--r--module/plugins/hoster/TurbobitNet.py5
-rw-r--r--module/plugins/hoster/UploadheroCom.py1
14 files changed, 31 insertions, 48 deletions
diff --git a/module/plugins/hoster/BezvadataCz.py b/module/plugins/hoster/BezvadataCz.py
index dcf9bf293..ffd586f74 100644
--- a/module/plugins/hoster/BezvadataCz.py
+++ b/module/plugins/hoster/BezvadataCz.py
@@ -77,7 +77,7 @@ class BezvadataCz(SimpleHoster):
def checkErrors(self):
if 'images/button-download-disable.png' in self.html:
- self.longWait(5 * 60, 24) # parallel dl limit
+ self.longWait(5 * 60, 24) #: parallel dl limit
elif '<div class="infobox' in self.html:
self.tempOffline()
diff --git a/module/plugins/hoster/CrockoCom.py b/module/plugins/hoster/CrockoCom.py
index f685d7452..15bf25ad2 100644
--- a/module/plugins/hoster/CrockoCom.py
+++ b/module/plugins/hoster/CrockoCom.py
@@ -22,7 +22,7 @@ class CrockoCom(SimpleHoster):
FILE_SIZE_PATTERN = r'<span class="tip1"><span class="inner">(?P<S>[^<]+)</span></span>'
OFFLINE_PATTERN = r'<h1>Sorry,<br />the page you\'re looking for <br />isn\'t here.</h1>|File not found'
- CAPTCHA_URL_PATTERN = re.compile(r"u='(/file_contents/captcha/\w+)';\s*w='(\d+)';")
+ CAPTCHA_PATTERN = re.compile(r"u='(/file_contents/captcha/\w+)';\s*w='(\d+)';")
FORM_PATTERN = r'<form method="post" action="([^"]+)">(.*?)</form>'
FORM_INPUT_PATTERN = r'<input[^>]* name="?([^" ]+)"? value="?([^" ]+)"?[^>]*>'
@@ -35,7 +35,7 @@ class CrockoCom(SimpleHoster):
self.fail("You need Premium membership to download this file.")
for _ in xrange(5):
- m = re.search(self.CAPTCHA_URL_PATTERN, self.html)
+ m = re.search(self.CAPTCHA_PATTERN, self.html)
if m:
url, wait_time = 'http://crocko.com' + m.group(1), m.group(2)
self.wait(wait_time)
diff --git a/module/plugins/hoster/DataHu.py b/module/plugins/hoster/DataHu.py
index d3a13c54b..d76444d32 100644
--- a/module/plugins/hoster/DataHu.py
+++ b/module/plugins/hoster/DataHu.py
@@ -26,10 +26,12 @@ class DataHu(SimpleHoster):
LINK_PATTERN = r'<div class="download_box_button"><a href="([^"]+)">'
- def handleFree(self):
+ def setup(self):
self.resumeDownload = True
- self.html = self.load(self.pyfile.url, decode=True)
+ self.multiDL = self.premium
+
+ def handleFree(self):
m = re.search(self.LINK_PATTERN, self.html)
if m:
url = m.group(1)
diff --git a/module/plugins/hoster/DataportCz.py b/module/plugins/hoster/DataportCz.py
index c79a21b8e..6fcbfc2ad 100644
--- a/module/plugins/hoster/DataportCz.py
+++ b/module/plugins/hoster/DataportCz.py
@@ -21,7 +21,7 @@ class DataportCz(SimpleHoster):
FILE_URL_REPLACEMENTS = [(__pattern__, r'http://www.dataport.cz/file/\1')]
- CAPTCHA_URL_PATTERN = r'<section id="captcha_bg">\s*<img src="(.*?)"'
+ CAPTCHA_PATTERN = r'<section id="captcha_bg">\s*<img src="(.*?)"'
FREE_SLOTS_PATTERN = ur'Počet volných slotů: <span class="darkblue">(\d+)</span><br />'
diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py
index d49b3fc94..ade91e7d4 100644
--- a/module/plugins/hoster/DepositfilesCom.py
+++ b/module/plugins/hoster/DepositfilesCom.py
@@ -102,8 +102,6 @@ class DepositfilesCom(SimpleHoster):
self.retry(wait_time=60)
def handlePremium(self):
- self.html = self.load(self.pyfile.url, cookies=self.COOKIES)
-
if '<span class="html_download_api-gold_traffic_limit">' in self.html:
self.logWarning("Download limit reached")
self.retry(25, 60 * 60, "Download limit reached")
diff --git a/module/plugins/hoster/FastshareCz.py b/module/plugins/hoster/FastshareCz.py
index 337977095..2a8d3af7d 100644
--- a/module/plugins/hoster/FastshareCz.py
+++ b/module/plugins/hoster/FastshareCz.py
@@ -64,20 +64,15 @@ class FastshareCz(SimpleHoster):
header = self.load(self.pyfile.url, just_header=True)
if "location" in header:
url = header['location']
+ elif self.CREDIT_PATTERN in self.html:
+ self.logWarning("Not enough traffic left")
+ self.resetAccount()
else:
- self.html = self.load(self.pyfile.url)
-
- self.getFileInfo() #
-
- if self.CREDIT_PATTERN in self.html:
- self.logWarning("Not enough traffic left")
- self.resetAccount()
+ m = re.search(self.PREMIUM_URL_PATTERN, self.html)
+ if m:
+ url = m.group(1)
else:
- m = re.search(self.PREMIUM_URL_PATTERN, self.html)
- if m:
- url = m.group(1)
- else:
- self.error("Premium URL")
+ self.error("Premium URL")
self.logDebug("PREMIUM URL: " + url)
self.download(url, disposition=True)
diff --git a/module/plugins/hoster/FilefactoryCom.py b/module/plugins/hoster/FilefactoryCom.py
index 0e422f108..a5942e261 100644
--- a/module/plugins/hoster/FilefactoryCom.py
+++ b/module/plugins/hoster/FilefactoryCom.py
@@ -38,7 +38,6 @@ class FilefactoryCom(SimpleHoster):
def handleFree(self):
- self.html = self.load(self.pyfile.url, decode=True)
if "Currently only Premium Members can download files larger than" in self.html:
self.fail("File too large for free download")
elif "All free download slots on this server are currently in use" in self.html:
diff --git a/module/plugins/hoster/FilerNet.py b/module/plugins/hoster/FilerNet.py
index 6d62dfde8..7a8d49378 100644
--- a/module/plugins/hoster/FilerNet.py
+++ b/module/plugins/hoster/FilerNet.py
@@ -18,7 +18,7 @@ class FilerNet(SimpleHoster):
__type__ = "hoster"
__version__ = "0.07"
- __pattern__ = r'https?://(?:www\.)?filer\.net/get/(\w+)'
+ __pattern__ = r'https?://(?:www\.)?filer\.net/get/\w+'
__description__ = """Filer.net hoster plugin"""
__license__ = "GPLv3"
@@ -35,8 +35,7 @@ class FilerNet(SimpleHoster):
# Wait between downloads
m = re.search(r'musst du <span id="time">(\d+)</span> Sekunden warten', self.html)
if m:
- waittime = int(m.group(1))
- self.retry(3, waittime, "Wait between free downloads")
+ self.retry(wait_time=int(m.group(1)), reason="Wait between free downloads")
self.html = self.load(self.pyfile.url, decode=True)
diff --git a/module/plugins/hoster/LomafileCom.py b/module/plugins/hoster/LomafileCom.py
index 0c7e03484..1c86b16e8 100644
--- a/module/plugins/hoster/LomafileCom.py
+++ b/module/plugins/hoster/LomafileCom.py
@@ -24,7 +24,7 @@ class LomafileCom(XFSPHoster):
OFFLINE_PATTERN = r'>(No such file|Software error:<)'
TEMP_OFFLINE_PATTERN = r'The page may have been renamed, removed or be temporarily unavailable.<'
- CAPTCHA_URL_PATTERN = r'(http://lomafile\.com/captchas/[^"\']+)'
+ CAPTCHA_PATTERN = r'(http://lomafile\.com/captchas/[^"\']+)'
getInfo = create_getInfo(LomafileCom)
diff --git a/module/plugins/hoster/MegaRapidCz.py b/module/plugins/hoster/MegaRapidCz.py
index 06e6626c6..153f6ea8b 100644
--- a/module/plugins/hoster/MegaRapidCz.py
+++ b/module/plugins/hoster/MegaRapidCz.py
@@ -53,7 +53,7 @@ class MegaRapidCz(SimpleHoster):
self.html = self.load(self.pyfile.url, decode=True)
except BadHeader, e:
self.account.relogin(self.user)
- self.retry(max_tries=3, reason=str(e))
+ self.retry(wait_time=60, reason=str(e))
m = re.search(self.LINK_PATTERN, self.html)
if m:
@@ -63,7 +63,7 @@ class MegaRapidCz(SimpleHoster):
else:
if re.search(self.ERR_LOGIN_PATTERN, self.html):
self.relogin(self.user)
- self.retry(max_tries=3, reason="User login failed")
+ self.retry(wait_time=60, reason="User login failed")
elif re.search(self.ERR_CREDIT_PATTERN, self.html):
self.fail("Not enough credit left")
else:
diff --git a/module/plugins/hoster/OneFichierCom.py b/module/plugins/hoster/OneFichierCom.py
index e6e193b89..3f3d0a19a 100644
--- a/module/plugins/hoster/OneFichierCom.py
+++ b/module/plugins/hoster/OneFichierCom.py
@@ -37,7 +37,6 @@ class OneFichierCom(SimpleHoster):
def handleFree(self):
- self.html = self.load(self.pyfile.url, decode=True)
m = re.search(self.WAIT_PATTERN, self.html)
if m:
wait_time = int(m.group(1)) + 1 #: One minute more than what the page displays to be safe
diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py
index 7a73ab316..b7c112a45 100644
--- a/module/plugins/hoster/ShareonlineBiz.py
+++ b/module/plugins/hoster/ShareonlineBiz.py
@@ -55,38 +55,28 @@ class ShareonlineBiz(Hoster):
def setup(self):
- # range request not working?
- # api supports resume, only one chunk
- # website isn't supporting resuming in first place
self.file_id = re.match(self.__pattern__, self.pyfile.url).group("ID")
self.pyfile.url = "http://www.share-online.biz/dl/" + self.file_id
self.resumeDownload = self.premium
self.multiDL = False
- #self.chunkLimit = 1
self.check_data = None
+
def process(self, pyfile):
if self.premium:
self.handlePremium()
- #web-download fallback removed - didn't work anyway
else:
self.handleFree()
- # check = self.checkDownload({"failure": re.compile(self.ERROR_INFO_PATTERN)})
- # if check == "failure":
- # try:
- # self.retry(reason=self.lastCheck.group(1).decode("utf8"))
- # except:
- # self.retry(reason="Unknown error")
-
if self.api_data:
self.check_data = {"size": int(self.api_data['size']), "md5": self.api_data['md5']}
+
def loadAPIData(self):
api_url_base = "http://api.share-online.biz/linkcheck.php?md5=1"
- api_param_file = {"links": self.file_id} # api only supports old style links
+ api_param_file = {"links": self.file_id} #: api only supports old style links
src = self.load(api_url_base, cookies=False, post=api_param_file, decode=True)
fields = src.split(";")
@@ -96,15 +86,16 @@ class ShareonlineBiz(Hoster):
self.offline()
else:
self.api_data['filename'] = fields[2]
- self.api_data['size'] = fields[3] # in bytes
- self.api_data['md5'] = fields[4].strip().lower().replace("\n\n", "") # md5
+ self.api_data['size'] = fields[3] #: in bytes
+ self.api_data['md5'] = fields[4].strip().lower().replace("\n\n", "") #: md5
+
def handleFree(self):
self.loadAPIData()
self.pyfile.name = self.api_data['filename']
self.pyfile.size = int(self.api_data['size'])
- self.html = self.load(self.pyfile.url, cookies=True) # refer, stuff
+ self.html = self.load(self.pyfile.url, cookies=True) #: refer, stuff
self.setWait(3)
self.wait()
@@ -152,6 +143,7 @@ class ShareonlineBiz(Hoster):
else:
self.correctCaptcha()
+
def handlePremium(self): #: should be working better loading (account) api internally
self.account.getAccountInfo(self.user, True)
src = self.load("http://api.share-online.biz/account.php",
@@ -177,6 +169,7 @@ class ShareonlineBiz(Hoster):
self.multiDL = True
self.download(dlLink)
+
def checkErrors(self):
m = re.search(r"/failure/(.*?)/1", self.req.lastEffectiveURL)
if m is None:
diff --git a/module/plugins/hoster/TurbobitNet.py b/module/plugins/hoster/TurbobitNet.py
index 8557e0ce7..ded926010 100644
--- a/module/plugins/hoster/TurbobitNet.py
+++ b/module/plugins/hoster/TurbobitNet.py
@@ -38,7 +38,7 @@ class TurbobitNet(SimpleHoster):
LINK_PATTERN = r'(?P<url>/download/redirect/[^"\']+)'
LIMIT_WAIT_PATTERN = r'<div id=\'timeout\'>(\d+)<'
- CAPTCHA_URL_PATTERN = r'<img alt="Captcha" src="(.+?)"'
+ CAPTCHA_PATTERN = r'<img alt="Captcha" src="(.+?)"'
def handleFree(self):
@@ -78,7 +78,7 @@ class TurbobitNet(SimpleHoster):
inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge(captcha_key)
else:
- m = re.search(self.CAPTCHA_URL_PATTERN, self.html)
+ m = re.search(self.CAPTCHA_PATTERN, self.html)
if m is None:
self.error('captcha')
captcha_url = m.group(1)
@@ -165,7 +165,6 @@ class TurbobitNet(SimpleHoster):
def handlePremium(self):
self.logDebug("Premium download as user %s" % self.user)
- self.html = self.load(self.pyfile.url) # Useless in 0.5
self.downloadFile()
diff --git a/module/plugins/hoster/UploadheroCom.py b/module/plugins/hoster/UploadheroCom.py
index 3c26a0b8b..753ad6807 100644
--- a/module/plugins/hoster/UploadheroCom.py
+++ b/module/plugins/hoster/UploadheroCom.py
@@ -60,7 +60,6 @@ class UploadheroCom(SimpleHoster):
def handlePremium(self):
self.logDebug("%s: Use Premium Account" % self.__name__)
- self.html = self.load(self.pyfile.url)
link = re.search(self.PREMIUM_URL_PATTERN, self.html).group(1)
self.logDebug("Downloading link : '%s'" % link)
self.download(link)