summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/FileserveCom.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/hoster/FileserveCom.py')
-rw-r--r--module/plugins/hoster/FileserveCom.py41
1 files changed, 20 insertions, 21 deletions
diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py
index 782f09188..cc977ac25 100644
--- a/module/plugins/hoster/FileserveCom.py
+++ b/module/plugins/hoster/FileserveCom.py
@@ -2,13 +2,13 @@
import re
-from pyload.utils import json_loads
-from pyload.network.RequestFactory import getURL
-from pyload.plugin.Hoster import Hoster
-from pyload.plugin.Plugin import chunks
-from pyload.plugin.hoster.UnrestrictLi import secondsToMidnight
-from pyload.plugin.internal.captcha import ReCaptcha
-from pyload.utils import parseFileSize
+from module.common.json_layer import json_loads
+from module.network.RequestFactory import getURL
+from module.plugins.Hoster import Hoster
+from module.plugins.Plugin import chunks
+from module.plugins.internal.CaptchaService import ReCaptcha
+from module.plugins.internal.SimpleHoster import secondsToMidnight
+from module.utils import parseFileSize
def checkFile(plugin, urls):
@@ -33,9 +33,9 @@ def checkFile(plugin, urls):
class FileserveCom(Hoster):
__name__ = "FileserveCom"
__type__ = "hoster"
- __version__ = "0.52"
+ __version__ = "0.54"
- __pattern__ = r'http://(?:www\.)?fileserve\.com/file/(?P<id>[^/]+).*'
+ __pattern__ = r'http://(?:www\.)?fileserve\.com/file/(?P<ID>[^/]+)'
__description__ = """Fileserve.com hoster plugin"""
__license__ = "GPLv3"
@@ -50,7 +50,7 @@ class FileserveCom(Hoster):
LINKCHECK_TR = r'<tr>\s*(<td>http://www\.fileserve\.com/file/.*?)</tr>'
LINKCHECK_TD = r'<td>(?:<[^>]*>|&nbsp;)*([^<]*)'
- CAPTCHA_KEY_PATTERN = r'var reCAPTCHA_publickey=\'(?P<key>.+?)\''
+ CAPTCHA_KEY_PATTERN = r'var reCAPTCHA_publickey=\'(.+?)\''
LONG_WAIT_PATTERN = r'<li class="title">You need to wait (\d+) (\w+) to start another download\.</li>'
LINK_EXPIRED_PATTERN = r'Your download link has expired'
DAILY_LIMIT_PATTERN = r'Your daily download limit has been reached'
@@ -59,7 +59,7 @@ class FileserveCom(Hoster):
def setup(self):
self.resumeDownload = self.multiDL = self.premium
- self.file_id = re.match(self.__pattern__, self.pyfile.url).group('id')
+ self.file_id = re.match(self.__pattern__, self.pyfile.url).group('ID')
self.url = "%s%s" % (self.URLS[0], self.file_id)
self.logDebug("File ID: %s URL: %s" % (self.file_id, self.url))
@@ -118,14 +118,16 @@ class FileserveCom(Hoster):
self.logDebug(self.req.http.lastEffectiveURL)
check = self.checkDownload({"expired": self.LINK_EXPIRED_PATTERN,
- "wait": re.compile(self.LONG_WAIT_PATTERN),
- "limit": self.DAILY_LIMIT_PATTERN})
+ "wait" : re.compile(self.LONG_WAIT_PATTERN),
+ "limit" : self.DAILY_LIMIT_PATTERN})
if check == "expired":
self.logDebug("Download link was expired")
self.retry()
+
elif check == "wait":
self.doLongWait(self.lastCheck)
+
elif check == "limit":
self.logWarning(_("Download limited reached for today"))
self.setWait(secondsToMidnight(gmt=2), True)
@@ -155,11 +157,11 @@ class FileserveCom(Hoster):
def doCaptcha(self):
- captcha_key = re.search(self.CAPTCHA_KEY_PATTERN, self.html).group("key")
+ captcha_key = re.search(self.CAPTCHA_KEY_PATTERN, self.html).group(1)
recaptcha = ReCaptcha(self)
for _i in xrange(5):
- challenge, response = recaptcha.challenge(captcha_key)
+ response, challenge = recaptcha.challenge(captcha_key)
res = json_loads(self.load(self.URLS[2],
post={'recaptcha_challenge_field' : challenge,
'recaptcha_response_field' : response,
@@ -204,12 +206,9 @@ class FileserveCom(Hoster):
self.download(premium_url or self.pyfile.url)
- if not premium_url:
- check = self.checkDownload({"login": re.compile(self.NOT_LOGGED_IN_PATTERN)})
-
- if check == "login":
- self.account.relogin(self.user)
- self.retry(reason=_("Not logged in"))
+ if not premium_url and self.checkDownload({"login": re.compile(self.NOT_LOGGED_IN_PATTERN)}):
+ self.account.relogin(self.user)
+ self.retry(reason=_("Not logged in"))
def getInfo(urls):