diff options
author | Walter Purcaro <vuolter@gmail.com> | 2015-02-16 21:59:10 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2015-02-16 21:59:10 +0100 |
commit | 8e7d14bae4d3c836f029a1235eb227380acc3f75 (patch) | |
tree | ebd0679642cccb994e70a89a106b394189cb28bc /pyload/plugin/hoster/UploadheroCom.py | |
parent | Merge branch 'stable' into 0.4.10 (diff) | |
download | pyload-8e7d14bae4d3c836f029a1235eb227380acc3f75.tar.xz |
Fix plugins to work on 0.4.10
Diffstat (limited to 'pyload/plugin/hoster/UploadheroCom.py')
-rw-r--r-- | pyload/plugin/hoster/UploadheroCom.py | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/pyload/plugin/hoster/UploadheroCom.py b/pyload/plugin/hoster/UploadheroCom.py new file mode 100644 index 000000000..917053f18 --- /dev/null +++ b/pyload/plugin/hoster/UploadheroCom.py @@ -0,0 +1,73 @@ +# -*- coding: utf-8 -*- +# +# Test links: +# http://uploadhero.co/dl/wQBRAVSM + +import re + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class UploadheroCom(SimpleHoster): + __name__ = "UploadheroCom" + __type__ = "hoster" + __version__ = "0.17" + + __pattern__ = r'http://(?:www\.)?uploadhero\.com?/dl/\w+' + + __description__ = """UploadHero.co plugin""" + __license__ = "GPLv3" + __authors__ = [("mcmyst", "mcmyst@hotmail.fr"), + ("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.' + + COOKIES = [("uploadhero.co", "lang", "en")] + + 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_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) + + 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")) + + self.download(download_url) + + + def checkErrors(self): + m = re.search(self.IP_BLOCKED_PATTERN, self.html) + if m: + self.html = self.load("http://uploadhero.co%s" % 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) |