diff options
author | Walter Purcaro <vuolter@gmail.com> | 2013-12-13 11:20:19 +0100 |
---|---|---|
committer | Stefano <l.stickell@yahoo.it> | 2013-12-13 11:20:39 +0100 |
commit | 7f239b41cb29ee95c878f78a6e9cacd55f301a8d (patch) | |
tree | 6fdb219256a3fa2c6de6f858197d91c829f73ff2 /module/plugins/hoster/ShragleCom.py | |
parent | Merge pull request #434 from kmarty/stable (diff) | |
download | pyload-7f239b41cb29ee95c878f78a6e9cacd55f301a8d.tar.xz |
Some hosters marked as dead
Merged #375
Diffstat (limited to 'module/plugins/hoster/ShragleCom.py')
-rw-r--r-- | module/plugins/hoster/ShragleCom.py | 95 |
1 files changed, 4 insertions, 91 deletions
diff --git a/module/plugins/hoster/ShragleCom.py b/module/plugins/hoster/ShragleCom.py index 5d19afbc7..2b1a8b80a 100644 --- a/module/plugins/hoster/ShragleCom.py +++ b/module/plugins/hoster/ShragleCom.py @@ -1,104 +1,17 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -import re -from pycurl import FOLLOWLOCATION +from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo -from module.plugins.Hoster import Hoster -from module.plugins.internal.SimpleHoster import parseHtmlForm -from module.plugins.internal.CaptchaService import ReCaptcha -from module.network.RequestFactory import getURL -API_KEY = "078e5ca290d728fd874121030efb4a0d" - - -def parseFileInfo(self, url): - file_id = re.match(self.__pattern__, url).group('ID') - - data = getURL("http://www.cloudnator.com/api.php?key=%s&action=getStatus&fileID=%s" % (API_KEY, file_id), - decode=True).split() - - if len(data) == 4: - name, size, md5, status = data - size = int(size) - - if hasattr(self, "check_data"): - self.checkdata = {"size": size, "md5": md5} - - return name, size, 2 if status == "0" else 1, url - else: - return url, 0, 1, url - - -def getInfo(urls): - for url in urls: - file_info = parseFileInfo(ShragleCom, url) - yield file_info - - -class ShragleCom(Hoster): +class ShragleCom(DeadHoster): __name__ = "ShragleCom" __type__ = "hoster" __pattern__ = r"http://(?:www.)?(cloudnator|shragle).com/files/(?P<ID>.*?)/" - __version__ = "0.21" + __version__ = "0.22" __description__ = """Cloudnator.com (Shragle.com) Download PLugin""" __author_name__ = ("RaNaN", "zoidberg") __author_mail__ = ("RaNaN@pyload.org", "zoidberg@mujmail.cz") - def setup(self): - self.multiDL = False - self.check_data = None - - def process(self, pyfile): - #get file status and info - self.pyfile.name, self.pyfile.size, status = parseFileInfo(self, pyfile.url)[:3] - if status != 2: - self.offline() - - self.handleFree() - - def handleFree(self): - self.html = self.load(self.pyfile.url) - - #get wait time - found = re.search('\s*var\sdownloadWait\s=\s(\d+);', self.html) - self.setWait(int(found.group(1)) if found else 30) - - #parse download form - action, inputs = parseHtmlForm('id="download', self.html) - - #solve captcha - found = re.search('recaptcha/api/(?:challenge|noscript)?k=(.+?)', self.html) - captcha_key = found.group(1) if found else "6LdEFb0SAAAAAAwM70vnYo2AkiVkCx-xmfniatHz" - - recaptcha = ReCaptcha(self) - - inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge(captcha_key) - self.wait() - - #validate - self.req.http.c.setopt(FOLLOWLOCATION, 0) - self.html = self.load(action, post=inputs) - - found = re.search(r"Location\s*:\s*(\S*)", self.req.http.header, re.I) - if found: - self.correctCaptcha() - download_url = found.group(1) - else: - if "Sicherheitscode falsch" in self.html: - self.invalidCaptcha() - self.retry(max_tries=5, reason="Invalid captcha") - else: - self.fail("Invalid session") - - #download - self.req.http.c.setopt(FOLLOWLOCATION, 1) - self.download(download_url) - check = self.checkDownload({ - "ip_blocked": re.compile(r'<div class="error".*IP.*loading') - }) - if check == "ip_blocked": - self.setWait(1800, True) - self.wait() - self.retry() +getInfo = create_getInfo(ShragleCom) |