summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/LoadTo.py
diff options
context:
space:
mode:
authorGravatar GammaC0de <GammaC0de@users.noreply.github.com> 2015-05-29 23:33:10 +0200
committerGravatar GammaC0de <GammaC0de@users.noreply.github.com> 2015-05-29 23:33:10 +0200
commit844dfd92f590e531ca2f7fd86305fcbc13a03721 (patch)
tree5303bd07749b362dab071ada6197fe37dda85b27 /module/plugins/hoster/LoadTo.py
parent[BitshareCom] Code cosmetics (diff)
parent[SimpleHoster] Fix DB error (diff)
downloadpyload-844dfd92f590e531ca2f7fd86305fcbc13a03721.tar.xz
Merge pull request #1 from pyload/stable
sync stable
Diffstat (limited to 'module/plugins/hoster/LoadTo.py')
-rw-r--r--module/plugins/hoster/LoadTo.py38
1 files changed, 15 insertions, 23 deletions
diff --git a/module/plugins/hoster/LoadTo.py b/module/plugins/hoster/LoadTo.py
index 0a5b26410..2b4202051 100644
--- a/module/plugins/hoster/LoadTo.py
+++ b/module/plugins/hoster/LoadTo.py
@@ -13,9 +13,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class LoadTo(SimpleHoster):
__name__ = "LoadTo"
__type__ = "hoster"
- __version__ = "0.18"
+ __version__ = "0.22"
__pattern__ = r'http://(?:www\.)?load\.to/\w+'
+ __config__ = [("use_premium", "bool", "Use premium account if available", True)]
__description__ = """ Load.to hoster plugin """
__license__ = "GPLv3"
@@ -27,7 +28,7 @@ class LoadTo(SimpleHoster):
SIZE_PATTERN = r'Size: (?P<S>[\d.,]+) (?P<U>[\w^_]+)'
OFFLINE_PATTERN = r'>Can\'t find file'
- LINK_PATTERN = r'<form method="post" action="(.+?)"'
+ LINK_FREE_PATTERN = r'<form method="post" action="(.+?)"'
WAIT_PATTERN = r'type="submit" value="Download \((\d+)\)"'
URL_REPLACEMENTS = [(r'(\w)$', r'\1/')]
@@ -38,38 +39,29 @@ class LoadTo(SimpleHoster):
self.chunkLimit = 1
- def handleFree(self):
+ def handleFree(self, pyfile):
# Search for Download URL
- m = re.search(self.LINK_PATTERN, self.html)
+ m = re.search(self.LINK_FREE_PATTERN, self.html)
if m is None:
- self.error(_("LINK_PATTERN not found"))
+ self.error(_("LINK_FREE_PATTERN not found"))
- download_url = m.group(1)
+ self.link = m.group(1)
# Set Timer - may be obsolete
m = re.search(self.WAIT_PATTERN, self.html)
if m:
- self.wait(int(m.group(1)))
+ self.wait(m.group(1))
# Load.to is using solvemedia captchas since ~july 2014:
- solvemedia = SolveMedia(self)
+ solvemedia = SolveMedia(self)
captcha_key = solvemedia.detect_key()
- if captcha_key is None:
- self.download(download_url)
- else:
- challenge, response = solvemedia.challenge(captcha_key)
-
- self.download(download_url, post={"adcopy_challenge": challenge, "adcopy_response": response})
-
- check = self.checkDownload({'404': re.compile("\A<h1>404 Not Found</h1>"), 'html': re.compile("html")})
-
- if check == "404":
- self.invalidCaptcha()
- self.retry()
- elif check == "html":
- self.logWarning(_("Downloaded file is an html page, will retry"))
- self.retry()
+ if captcha_key:
+ response, challenge = solvemedia.challenge(captcha_key)
+ self.download(self.link,
+ post={'adcopy_challenge': challenge,
+ 'adcopy_response' : response,
+ 'returnUrl' : pyfile.url})
getInfo = create_getInfo(LoadTo)