summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-03-20 11:21:27 +0100
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-03-20 11:21:27 +0100
commit04b29926182e7f3181a7c2e20dd57dec4e400def (patch)
treeb3f5552394b69166eb09743109dca0219658ac61
parent[ExternalScripts] New events support (diff)
downloadpyload-04b29926182e7f3181a7c2e20dd57dec4e400def.tar.xz
[UploadheroCom] Fix https://github.com/pyload/pyload/issues/1244
-rw-r--r--module/plugins/hoster/UploadheroCom.py44
1 files changed, 19 insertions, 25 deletions
diff --git a/module/plugins/hoster/UploadheroCom.py b/module/plugins/hoster/UploadheroCom.py
index 34e42f091..12729ee8b 100644
--- a/module/plugins/hoster/UploadheroCom.py
+++ b/module/plugins/hoster/UploadheroCom.py
@@ -5,13 +5,15 @@
import re
+from urlparse import urljoin
+
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class UploadheroCom(SimpleHoster):
__name__ = "UploadheroCom"
__type__ = "hoster"
- __version__ = "0.17"
+ __version__ = "0.18"
__pattern__ = r'http://(?:www\.)?uploadhero\.com?/dl/\w+'
@@ -21,56 +23,48 @@ class UploadheroCom(SimpleHoster):
("zoidberg", "zoidberg@mujmail.cz")]
- NAME_PATTERN = r'<div class="nom_de_fichier">(?P<N>.*?)</div>'
- SIZE_PATTERN = r'Taille du fichier : </span><strong>(?P<S>.*?)</strong>'
- OFFLINE_PATTERN = r'<p class="titre_dl_2">|<div class="raison"><strong>Le lien du fichier ci-dessus n\'existe plus.'
+ NAME_PATTERN = r'<div class="nom_de_fichier">(?P<N>.+?)<'
+ SIZE_PATTERN = r'>Filesize: </span><strong>(?P<S>[\d.,]+) (?P<U>[\w^_]+)'
+ OFFLINE_PATTERN = r'<p class="titre_dl_2">'
COOKIES = [("uploadhero.co", "lang", "en")]
- IP_BLOCKED_PATTERN = r'href="(/lightbox_block_download\.php\?min=.*?)"'
+ IP_BLOCKED_PATTERN = r'href="(/lightbox_block_download\.php\?min=.+?)"'
IP_WAIT_PATTERN = r'<span id="minutes">(\d+)</span>.*\s*<span id="seconds">(\d+)</span>'
CAPTCHA_PATTERN = r'"(/captchadl\.php\?\w+)"'
- LINK_FREE_PATTERN = r'var magicomfg = \'<a href="(http://[^<>"]*?)"|"(http://storage\d+\.uploadhero\.co/\?d=\w+/[^<>"/]+)"'
+ LINK_FREE_PATTERN = r'var magicomfg = \'<a href="(.+?)"|"(http://storage\d+\.uploadhero\.co.+?)"'
LINK_PREMIUM_PATTERN = r'<a href="(.+?)" id="downloadnow"'
def handleFree(self, pyfile):
- self.checkErrors()
-
m = re.search(self.CAPTCHA_PATTERN, self.html)
if m is None:
- self.error(_("CAPTCHA_PATTERN not found"))
- captcha_url = "http://uploadhero.co" + m.group(1)
+ self.error(_("Captcha not found"))
- for _i in xrange(5):
- captcha = self.decryptCaptcha(captcha_url)
- self.html = self.load(pyfile.url, get={"code": captcha})
- m = re.search(self.LINK_FREE_PATTERN, self.html)
- if m:
- self.correctCaptcha()
- download_url = m.group(1) or m.group(2)
- break
- else:
- self.invalidCaptcha()
- else:
- self.fail(_("No valid captcha code entered"))
+ captcha = self.decryptCaptcha(urljoin("http://uploadhero.co", m.group(1)))
- self.download(download_url)
+ self.html = self.load(pyfile.url,
+ get={"code": captcha})
+
+ m = re.search(self.LINK_FREE_PATTERN, self.html)
+ if m:
+ self.link = m.group(1) or m.group(2)
+ self.wait(50)
def checkErrors(self):
m = re.search(self.IP_BLOCKED_PATTERN, self.html)
if m:
- self.html = self.load("http://uploadhero.co" + m.group(1))
+ self.html = self.load(urljoin("http://uploadhero.co", m.group(1)))
m = re.search(self.IP_WAIT_PATTERN, self.html)
wait_time = (int(m.group(1)) * 60 + int(m.group(2))) if m else 5 * 60
self.wait(wait_time, True)
self.retry()
- self.info.pop('error', None)
+ return super(UploadheroCom, self).checkErrors()
getInfo = create_getInfo(UploadheroCom)