diff options
author | zoidberg10 <zoidberg@mujmail.cz> | 2012-06-16 01:03:58 +0200 |
---|---|---|
committer | zoidberg10 <zoidberg@mujmail.cz> | 2012-06-16 01:03:58 +0200 |
commit | e69ed5c8007c6ed2e26986d7b738f77a08045ad8 (patch) | |
tree | 4e3c22939bb9300d572d96b37a4b0fc90d6ea5cf /module/plugins | |
parent | update uloz.to, cloudnator.com, checksum plugin (diff) | |
download | pyload-e69ed5c8007c6ed2e26986d7b738f77a08045ad8.tar.xz |
Diffstat (limited to 'module/plugins')
-rw-r--r-- | module/plugins/crypter/MediafireComFolder.py | 4 | ||||
-rw-r--r-- | module/plugins/hoster/MediafireCom.py | 11 | ||||
-rw-r--r-- | module/plugins/hoster/RapidgatorNet.py | 75 |
3 files changed, 64 insertions, 26 deletions
diff --git a/module/plugins/crypter/MediafireComFolder.py b/module/plugins/crypter/MediafireComFolder.py index 1d800b1b0..ddd61379c 100644 --- a/module/plugins/crypter/MediafireComFolder.py +++ b/module/plugins/crypter/MediafireComFolder.py @@ -8,8 +8,8 @@ from module.common.json_layer import json_loads class MediafireComFolder(Crypter): __name__ = "MediafireComFolder" __type__ = "crypter" - __pattern__ = r"http://(\w*\.)*mediafire\.com/(folder/|\?sharekey=|(\?\w{13}|\w+)($|[/#]))" - __version__ = "0.13" + __pattern__ = r"http://(\w*\.)*mediafire\.com/(folder/|\?sharekey=|\?\w{13}($|[/#]))" + __version__ = "0.14" __description__ = """Mediafire.com Folder Plugin""" __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") diff --git a/module/plugins/hoster/MediafireCom.py b/module/plugins/hoster/MediafireCom.py index 717143880..dce16118f 100644 --- a/module/plugins/hoster/MediafireCom.py +++ b/module/plugins/hoster/MediafireCom.py @@ -58,7 +58,7 @@ class MediafireCom(SimpleHoster): __name__ = "MediafireCom" __type__ = "hoster" __pattern__ = r"http://(\w*\.)*mediafire\.com/(file/|(download.php)?\?)(\w{11}|\w{15})($|/)" - __version__ = "0.75" + __version__ = "0.76" __description__ = """Mediafire.com plugin - free only""" __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") @@ -75,7 +75,7 @@ class MediafireCom(SimpleHoster): FILE_OFFLINE_PATTERN = r'class="error_msg_title"> Invalid or Deleted File. </div>' def setup(self): - self.multiDL = True + self.multiDL = False def process(self, pyfile): self.url, result = checkHTMLHeader(pyfile.url) @@ -83,15 +83,18 @@ class MediafireCom(SimpleHoster): if result == 0: self.html = self.load(self.url, decode = True) - self.checkCaptcha() + self.checkCaptcha() + self.multiDL = True self.getFileInfo() + if self.account: self.handlePremium() else: self.handleFree() elif result == 1: self.offline() - else: + else: + self.multiDL = True self.download(self.url, disposition = True) def handleFree(self): diff --git a/module/plugins/hoster/RapidgatorNet.py b/module/plugins/hoster/RapidgatorNet.py index 8a6ab6150..4791c0a20 100644 --- a/module/plugins/hoster/RapidgatorNet.py +++ b/module/plugins/hoster/RapidgatorNet.py @@ -18,25 +18,46 @@ import re from pycurl import HTTPHEADER +from random import random from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo from module.common.json_layer import json_loads from module.plugins.ReCaptcha import ReCaptcha +class AdsCaptcha(): + def __init__(self, plugin): + self.plugin = plugin + + def challenge(self, src): + js = self.plugin.req.load(src, cookies=True) + + try: + challenge = re.search("challenge: '(.*?)',", js).group(1) + server = re.search("server: '(.*?)',", js).group(1) + except: + self.plugin.fail("adscaptcha error") + result = self.result(server,challenge) + + return challenge, result + + def result(self, server, challenge): + return self.plugin.decryptCaptcha("%sChallenge.aspx" % server, get={"cid": challenge, "dummy": random()}, cookies=True, imgtype="jpg") + class RapidgatorNet(SimpleHoster): __name__ = "RapidgatorNet" __type__ = "hoster" __pattern__ = r"http://(?:www\.)?(rapidgator.net)/file/(\d+)" - __version__ = "0.03" + __version__ = "0.04" __description__ = """rapidgator.net""" __author_name__ = ("zoidberg") - FILE_INFO_PATTERN = r'Downloading:\s*</strong>\s*(?P<N>.*?)\s*</p>\s*<div>\s*File size:\s*<strong>(?P<S>.*?)</strong>' + FILE_INFO_PATTERN = r'Downloading:(\s*<[^>]*>)*\s*(?P<N>.*?)(\s*<[^>]*>)*\s*File size:\s*<strong>(?P<S>.*?)</strong>' FILE_OFFLINE_PATTERN = r'<title>File not found</title>' JSVARS_PATTERN = r"\s+var\s*(startTimerUrl|getDownloadUrl|captchaUrl|fid|secs)\s*=\s*'?(.*?)'?;" DOWNLOAD_LINK_PATTERN = r"location.href = '(.*?)'" RECAPTCHA_KEY_PATTERN = r'"http://api.recaptcha.net/challenge?k=(.*?)"' + ADSCAPTCHA_SRC_PATTERN = r'(http://api.adscaptcha.com/Get.aspx[^"\']*)' def handleFree(self): if "You can download files up to 500 MB in free mode" in self.html: @@ -64,18 +85,29 @@ class RapidgatorNet(SimpleHoster): url = "http://rapidgator.net%s" % jsvars.get('captchaUrl', '/download/captcha') self.html = self.load(url) - found = re.search(self.RECAPTCHA_KEY_PATTERN, self.html) - captcha_key = found.group(1) if found else "6Lc3yccSAAAAACb1PdeP4xZm1oTZrYzhlhRPjQd_" - recaptcha = ReCaptcha(self) - + + found = re.search(self.ADSCAPTCHA_SRC_PATTERN, self.html) + if found: + captcha_key = found.group(1) + captcha = AdsCaptcha(self) + else: + found = re.search(self.RECAPTCHA_KEY_PATTERN, self.html) + if found: + captcha_key = found.group(1) + captcha = ReCaptcha(self) + + else: + self.parseError("CAPTCHA") + captcha_prov = captcha.__class__.__name__.lower() + for i in range(5): self.checkWait() - captcha_challenge, captcha_response = recaptcha.challenge(captcha_key) + captcha_challenge, captcha_response = captcha.challenge(captcha_key) self.html = self.load(url, post={ "DownloadCaptchaForm[captcha]": "", - "recaptcha_challenge_field": captcha_challenge, - "recaptcha_response_field": captcha_response + "%s_challenge_field" % captcha_prov: captcha_challenge, + "%s_response_field" % captcha_prov: captcha_response }) if 'The verification code is incorrect' in self.html: @@ -94,17 +126,20 @@ class RapidgatorNet(SimpleHoster): self.download(download_url) def checkWait(self): - wait_time = 0 - if "Delay between downloads must be not less than" in self.html: - wait_time = 5 * 60 - elif "You have reached your daily downloads limit" in self.html: - self.logInfo("Daily limit reached") - wait_time = 60 * 60 - - if wait_time: - self.setWait(wait_time, True) - self.wait() - self.retry(max_tries = 24) + found = re.search(r"(?:Delay between downloads must be not less than|Try again in)\s*(\d+)\s*(hour|minute)", self.html) + if found: + wait_time = int(found.group(1)) * {"h": 60, "m": 1}[found.group(2)] + else: + found = re.search(r"You have reached your (daily|hourly) downloads limit", self.html) + if found: + wait_time = 60 + else: + return + + self.logDebug("Waiting %d minutes" % wait_time) + self.setWait(wait_time * 60, True) + self.wait() + self.retry(max_tries = 24) def getJsonResponse(self, url): response = self.load(url, decode = True) |