diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-10-03 17:40:27 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-10-03 17:40:27 +0200 |
commit | cdd7d2db6b372a38a6b4281f19881b95aa5b7a50 (patch) | |
tree | 9b9e29d2f85e99ef558f49d3c33ebad6ff69552c /pyload/plugins | |
parent | Changed XFileSharingPro and UpdateManager to internal plugins (diff) | |
parent | [Dev-Host] Improve patterns a bit (diff) | |
download | pyload-cdd7d2db6b372a38a6b4281f19881b95aa5b7a50.tar.xz |
Merge branch 'stable' into 0.4.10
Conflicts:
pyload/plugins/ocr/GigasizeCom.py
pyload/plugins/ocr/LinksaveIn.py
pyload/plugins/ocr/NetloadIn.py
pyload/plugins/ocr/ShareonlineBiz.py
Diffstat (limited to 'pyload/plugins')
35 files changed, 372 insertions, 231 deletions
diff --git a/pyload/plugins/hoster/BillionuploadsCom.py b/pyload/plugins/hoster/BillionuploadsCom.py index 08d3bb1e5..251186558 100644 --- a/pyload/plugins/hoster/BillionuploadsCom.py +++ b/pyload/plugins/hoster/BillionuploadsCom.py @@ -17,8 +17,8 @@ class BillionuploadsCom(XFileSharingPro): HOSTER_NAME = "billionuploads.com" - FILE_NAME_PATTERN = r'<b>Filename:</b>(?P<N>.*?)<br>' - FILE_SIZE_PATTERN = r'<b>Size:</b>(?P<S>.*?)<br>' + FILE_NAME_PATTERN = r'<td class="dofir" title="(?P<N>.+?)"' + FILE_SIZE_PATTERN = r'<td class="dofir">(?P<S>[\d.]+) (?P<U>\w+)' getInfo = create_getInfo(BillionuploadsCom) diff --git a/pyload/plugins/hoster/BitshareCom.py b/pyload/plugins/hoster/BitshareCom.py index 897206f87..75d3ea38b 100644 --- a/pyload/plugins/hoster/BitshareCom.py +++ b/pyload/plugins/hoster/BitshareCom.py @@ -23,7 +23,6 @@ class BitshareCom(SimpleHoster): OFFLINE_PATTERN = r'(>We are sorry, but the requested file was not found in our database|>Error - File not available<|The file was deleted either by the uploader, inactivity or due to copyright claim)' FILE_AJAXID_PATTERN = r'var ajaxdl = "(.*?)";' - CAPTCHA_KEY_PATTERN = r'http://api\.recaptcha\.net/challenge\?k=(.*?) ' TRAFFIC_USED_UP = r'Your Traffic is used up for today. Upgrade to premium to continue!' @@ -108,12 +107,15 @@ class BitshareCom(SimpleHoster): # Resolve captcha if captcha == 1: self.logDebug("File is captcha protected") - id = re.search(self.CAPTCHA_KEY_PATTERN, self.html).group(1) + recaptcha = ReCaptcha(self) + captcha_key = recaptcha.detect_key() + if captcha_key is None: + self.parseError("ReCaptcha captcha key not found") + # Try up to 3 times for i in xrange(3): - self.logDebug("Resolving ReCaptcha with key [%s], round %d" % (id, i + 1)) - recaptcha = ReCaptcha(self) - challenge, code = recaptcha.challenge(id) + self.logDebug("Resolving ReCaptcha with key [%s], round %d" % (captcha_key, i + 1)) + challenge, code = recaptcha.challenge(captcha_key) response = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", post={"request": "validateCaptcha", "ajaxid": self.ajaxid, "recaptcha_challenge_field": challenge, "recaptcha_response_field": code}) diff --git a/pyload/plugins/hoster/CatShareNet.py b/pyload/plugins/hoster/CatShareNet.py index 36f2ea441..051ce2e99 100644 --- a/pyload/plugins/hoster/CatShareNet.py +++ b/pyload/plugins/hoster/CatShareNet.py @@ -9,7 +9,7 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class CatShareNet(SimpleHoster): __name__ = "CatShareNet" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" __pattern__ = r'http://(?:www\.)?catshare\.net/\w{16}' @@ -18,18 +18,24 @@ class CatShareNet(SimpleHoster): __author_mail__ = ("z00nx0@gmail.com", None, "vuolter@gmail.com") + TEXT_ENCODING = True + FILE_INFO_PATTERN = r'<title>(?P<N>.+) \((?P<S>[\d.]+) (?P<U>\w+)\)<' OFFLINE_PATTERN = r'Podany plik został usunięty\s*</div>' IP_BLOCKED_PATTERN = r'>Nasz serwis wykrył że Twój adres IP nie pochodzi z Polski.<' - SECONDS_PATTERN = 'var count = (\d+);' - RECAPTCHA_KEY = "6Lfln9kSAAAAANZ9JtHSOgxUPB9qfDFeLUI_QMEy" + SECONDS_PATTERN = 'var\scount\s=\s(\d+);' LINK_PATTERN = r'<form action="(.+?)" method="GET">' + def setup(self): + self.multiDL = self.premium + self.resumeDownload = True + + def getFileInfo(self): m = re.search(self.IP_BLOCKED_PATTERN, self.html) - if m is None: + if m: self.fail("Only connections from Polish IP address are allowed") return super(CatShareNet, self).getFileInfo() @@ -41,7 +47,12 @@ class CatShareNet(SimpleHoster): self.wait(wait_time, True) recaptcha = ReCaptcha(self) - challenge, code = recaptcha.challenge(self.RECAPTCHA_KEY) + + captcha_key = recaptcha.detect_key() + if captcha_key is None: + self.parseError("ReCaptcha key not found") + + challenge, code = recaptcha.challenge(captcha_key) self.html = self.load(self.pyfile.url, post={'recaptcha_challenge_field': challenge, 'recaptcha_response_field': code}) @@ -52,7 +63,7 @@ class CatShareNet(SimpleHoster): self.retry(reason="Wrong captcha entered") dl_link = m.group(1) - self.download(dl_link) + self.download(dl_link, disposition=True) getInfo = create_getInfo(CatShareNet) diff --git a/pyload/plugins/hoster/CrockoCom.py b/pyload/plugins/hoster/CrockoCom.py index c1e941553..05f460716 100644 --- a/pyload/plugins/hoster/CrockoCom.py +++ b/pyload/plugins/hoster/CrockoCom.py @@ -22,7 +22,6 @@ class CrockoCom(SimpleHoster): OFFLINE_PATTERN = r"<h1>Sorry,<br />the page you're looking for <br />isn't here.</h1>|File not found" CAPTCHA_URL_PATTERN = re.compile(r"u='(/file_contents/captcha/\w+)';\s*w='(\d+)';") - CAPTCHA_KEY_PATTERN = re.compile(r'Recaptcha.create\("([^"]+)"') FORM_PATTERN = r'<form method="post" action="([^"]+)">(.*?)</form>' FORM_INPUT_PATTERN = r'<input[^>]* name="?([^" ]+)"? value="?([^" ]+)"?[^>]*>' @@ -43,10 +42,10 @@ class CrockoCom(SimpleHoster): else: break - m = re.search(self.CAPTCHA_KEY_PATTERN, self.html) - if m is None: - self.parseError('Captcha KEY') - captcha_key = m.group(1) + recaptcha = ReCaptcha(self) + captcha_key = recaptcha.detect_key() + if captcha_key is None: + self.parseError("ReCaptcha captcha key not found") m = re.search(self.FORM_PATTERN, self.html, re.DOTALL) if m is None: @@ -54,14 +53,12 @@ class CrockoCom(SimpleHoster): action, form = m.groups() inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form)) - recaptcha = ReCaptcha(self) - for _ in xrange(5): inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge(captcha_key) self.download(action, post=inputs) check = self.checkDownload({ - "captcha_err": self.CAPTCHA_KEY_PATTERN + "captcha_err": recaptcha.KEY_AJAX_PATTERN }) if check == "captcha_err": diff --git a/pyload/plugins/hoster/DateiTo.py b/pyload/plugins/hoster/DateiTo.py index 9ada88157..d440a7566 100644 --- a/pyload/plugins/hoster/DateiTo.py +++ b/pyload/plugins/hoster/DateiTo.py @@ -24,7 +24,6 @@ class DateiTo(SimpleHoster): WAIT_PATTERN = r'countdown\({seconds: (\d+)' DATA_PATTERN = r'url: "(.*?)", data: "(.*?)",' - RECAPTCHA_KEY_PATTERN = r'Recaptcha.create\("(.*?)"' def handleFree(self): @@ -52,10 +51,11 @@ class DateiTo(SimpleHoster): data = dict(x.split('=') for x in m.group(2).split('&')) if url.endswith('recaptcha.php'): - m = re.search(self.RECAPTCHA_KEY_PATTERN, self.html) - recaptcha_key = m.group(1) if m else "6LdBbL8SAAAAAI0vKUo58XRwDd5Tu_Ze1DA7qTao" + captcha_key = recaptcha.detect_key() + if captcha_key is None: + self.parseError("ReCaptcha key not found") - data['recaptcha_challenge_field'], data['recaptcha_response_field'] = recaptcha.challenge(recaptcha_key) + data['recaptcha_challenge_field'], data['recaptcha_response_field'] = recaptcha.challenge(captcha_key) else: self.fail('Too bad...') diff --git a/pyload/plugins/hoster/DepositfilesCom.py b/pyload/plugins/hoster/DepositfilesCom.py index 2f647514f..660adb06d 100644 --- a/pyload/plugins/hoster/DepositfilesCom.py +++ b/pyload/plugins/hoster/DepositfilesCom.py @@ -29,8 +29,6 @@ class DepositfilesCom(SimpleHoster): COOKIES = [(".dfiles.eu", "lang_current", "en")] - RECAPTCHA_PATTERN = r"Recaptcha.create\('([^']+)'" - FREE_LINK_PATTERN = r'<form id="downloader_file_form" action="(http://.+?\.(dfiles\.eu|depositfiles\.com)/.+?)" method="post"' PREMIUM_LINK_PATTERN = r'class="repeat"><a href="(.+?)"' PREMIUM_MIRROR_PATTERN = r'class="repeat_mirror"><a href="(.+?)"' @@ -67,21 +65,16 @@ class DepositfilesCom(SimpleHoster): params = {'fid': m.group(1)} self.logDebug("FID: %s" % params['fid']) - captcha_key = '6LdRTL8SAAAAAE9UOdWZ4d0Ky-aeA7XfSqyWDM2m' - m = re.search(self.RECAPTCHA_PATTERN, self.html) - if m: - captcha_key = m.group(1) - self.logDebug("CAPTCHA_KEY: %s" % captcha_key) - self.wait() recaptcha = ReCaptcha(self) + captcha_key = recaptcha.detect_key() + if captcha_key is None: + self.parseError("ReCaptcha key not found") for _ in xrange(5): self.html = self.load("https://dfiles.eu/get_file.php", get=params) if '<input type=button value="Continue" onclick="check_recaptcha' in self.html: - if not captcha_key: - self.parseError('Captcha key') if 'response' in params: self.invalidCaptcha() params['challenge'], params['response'] = recaptcha.challenge(captcha_key) diff --git a/pyload/plugins/hoster/EasybytezCom.py b/pyload/plugins/hoster/EasybytezCom.py index cdb07de0e..0d2f2fed4 100644 --- a/pyload/plugins/hoster/EasybytezCom.py +++ b/pyload/plugins/hoster/EasybytezCom.py @@ -18,7 +18,7 @@ class EasybytezCom(XFileSharingPro): HOSTER_NAME = "easybytez.com" FILE_INFO_PATTERN = r'<span class="name">(?P<N>.+)</span><br>\s*<span class="size">(?P<S>[^<]+)</span>' - OFFLINE_PATTERN = r'<h1>File not available</h1>' + OFFLINE_PATTERN = r'>File not available' LINK_PATTERN = r'(http://(\w+\.(easyload|easybytez|zingload)\.(com|to)|\d+\.\d+\.\d+\.\d+)/files/\d+/\w+/[^"<]+)' OVR_LINK_PATTERN = r'<h2>Download Link</h2>\s*<textarea[^>]*>([^<]+)' diff --git a/pyload/plugins/hoster/EgoFilesCom.py b/pyload/plugins/hoster/EgoFilesCom.py index 7bf723926..9d477e156 100644 --- a/pyload/plugins/hoster/EgoFilesCom.py +++ b/pyload/plugins/hoster/EgoFilesCom.py @@ -24,7 +24,6 @@ class EgoFilesCom(SimpleHoster): OFFLINE_PATTERN = r'(File size|Rozmiar): 0 KB' WAIT_TIME_PATTERN = r'For next free download you have to wait <strong>((?P<m>\d*)m)? ?((?P<s>\d+)s)?</strong>' LINK_PATTERN = r'<a href="(?P<link>[^"]+)">Download ></a>' - RECAPTCHA_KEY = "6LeXatQSAAAAAHezcjXyWAni-4t302TeYe7_gfvX" def setup(self): @@ -48,9 +47,15 @@ class EgoFilesCom(SimpleHoster): self.wait(waittime, True) downloadURL = r'' + recaptcha = ReCaptcha(self) + + captcha_key = recaptcha.detect_key() + if captcha_key is None: + self.parseError("ReCaptcha key not found") + for _ in xrange(5): - challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY) + challenge, response = recaptcha.challenge(captcha_key) post_data = {'recaptcha_challenge_field': challenge, 'recaptcha_response_field': response} self.html = self.load(self.pyfile.url, post=post_data, decode=True) diff --git a/pyload/plugins/hoster/EpicShareNet.py b/pyload/plugins/hoster/EpicShareNet.py index bf746ce2a..f653c0aee 100644 --- a/pyload/plugins/hoster/EpicShareNet.py +++ b/pyload/plugins/hoster/EpicShareNet.py @@ -19,7 +19,6 @@ class EpicShareNet(XFileSharingPro): HOSTER_NAME = "epicshare.net" - OFFLINE_PATTERN = r'<b>File Not Found</b><br><br>' FILE_NAME_PATTERN = r'<b>Password:</b></div>\s*<h2>(?P<N>[^<]+)</h2>' diff --git a/pyload/plugins/hoster/FilecloudIo.py b/pyload/plugins/hoster/FilecloudIo.py index 9cf9306d1..93db875fe 100644 --- a/pyload/plugins/hoster/FilecloudIo.py +++ b/pyload/plugins/hoster/FilecloudIo.py @@ -26,9 +26,9 @@ class FilecloudIo(SimpleHoster): UKEY_PATTERN = r"'ukey'\s*:'(\w+)'," AB1_PATTERN = r"if\( __ab1 == '(\w+)' \)" ERROR_MSG_PATTERN = r'var __error_msg\s*=\s*l10n\.(.*?);' + RECAPTCHA_PATTERN = r"var __recaptcha_public\s*=\s*'([^']+)';" + LINK_PATTERN = r'"(http://s\d+.filecloud.io/%s/\d+/.*?)"' - RECAPTCHA_KEY_PATTERN = r"var __recaptcha_public\s*=\s*'([^']+)';" - RECAPTCHA_KEY = "6Lf5OdISAAAAAEZObLcx5Wlv4daMaASRov1ysDB1" def setup(self): @@ -43,11 +43,18 @@ class FilecloudIo(SimpleHoster): self.parseError("__AB1") data['__ab1'] = m.group(1) + recaptcha = ReCaptcha(self) + + m = re.search(self.RECAPTCHA_PATTERN, self.html) + captcha_key = m.group(1) if m else recaptcha.detect_key() + + if captcha_key is None: + self.parseError("ReCaptcha key not found") + if not self.account: self.fail("User not logged in") elif not self.account.logged_in: - recaptcha = ReCaptcha(self) - captcha_challenge, captcha_response = recaptcha.challenge(self.RECAPTCHA_KEY) + captcha_challenge, captcha_response = recaptcha.challenge(captcha_key) self.account.form_data = {"recaptcha_challenge_field": captcha_challenge, "recaptcha_response_field": captcha_response} self.account.relogin(self.user) @@ -63,9 +70,6 @@ class FilecloudIo(SimpleHoster): self.logDebug(response) if response['captcha']: - recaptcha = ReCaptcha(self) - m = re.search(self.RECAPTCHA_KEY_PATTERN, self.html) - captcha_key = m.group(1) if m else self.RECAPTCHA_KEY data['ctype'] = "recaptcha" for _ in xrange(5): diff --git a/pyload/plugins/hoster/FilepostCom.py b/pyload/plugins/hoster/FilepostCom.py index 03eddee91..133ea72d6 100644 --- a/pyload/plugins/hoster/FilepostCom.py +++ b/pyload/plugins/hoster/FilepostCom.py @@ -24,7 +24,7 @@ class FilepostCom(SimpleHoster): OFFLINE_PATTERN = r'class="error_msg_title"> Invalid or Deleted File. </div>|<div class="file_info file_info_deleted">' PREMIUM_ONLY_PATTERN = r'members only. Please upgrade to premium|a premium membership is required to download this file' - RECAPTCHA_KEY_PATTERN = r"Captcha.init\({\s*key:\s*'([^']+)'" + RECAPTCHA_PATTERN = r"Captcha.init\({\s*key:\s*'([^']+)'" FLP_TOKEN_PATTERN = r"set_store_options\({token: '([^']+)'" @@ -37,7 +37,7 @@ class FilepostCom(SimpleHoster): self.parseError("Token") flp_token = m.group(1) - m = re.search(self.RECAPTCHA_KEY_PATTERN, self.html) + m = re.search(self.RECAPTCHA_PATTERN, self.html) if m is None: self.parseError("Captcha key") captcha_key = m.group(1) diff --git a/pyload/plugins/hoster/FilerNet.py b/pyload/plugins/hoster/FilerNet.py index bf33f7fb3..91df4ff7e 100644 --- a/pyload/plugins/hoster/FilerNet.py +++ b/pyload/plugins/hoster/FilerNet.py @@ -26,7 +26,6 @@ class FilerNet(SimpleHoster): FILE_INFO_PATTERN = r'<h1 class="page-header">Free Download (?P<N>\S+) <small>(?P<S>[\w.]+) (?P<U>\w+)</small></h1>' OFFLINE_PATTERN = r'Nicht gefunden' - RECAPTCHA_KEY = "6LcFctISAAAAAAgaeHgyqhNecGJJRnxV1m_vAz3V" LINK_PATTERN = r'href="([^"]+)">Get download</a>' @@ -65,9 +64,15 @@ class FilerNet(SimpleHoster): self.logDebug("Hash: " + hash_data) downloadURL = r'' + recaptcha = ReCaptcha(self) + + captcha_key = recaptcha.detect_key() + if captcha_key is None: + self.parseError("ReCaptcha key not found") + for _ in xrange(5): - challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY) + challenge, response = recaptcha.challenge(captcha_key) post_data = {'recaptcha_challenge_field': challenge, 'recaptcha_response_field': response, 'hash': hash_data} diff --git a/pyload/plugins/hoster/FilerioCom.py b/pyload/plugins/hoster/FilerioCom.py index c9c63c38e..77715a8e1 100644 --- a/pyload/plugins/hoster/FilerioCom.py +++ b/pyload/plugins/hoster/FilerioCom.py @@ -17,7 +17,7 @@ class FilerioCom(XFileSharingPro): HOSTER_NAME = "filerio.in" - OFFLINE_PATTERN = r'<b>"File Not Found"</b>|File has been removed due to Copyright Claim' + OFFLINE_PATTERN = r'>"File Not Found|File has been removed' FILE_URL_REPLACEMENTS = [(r'http://.*?/', 'http://filerio.in/')] diff --git a/pyload/plugins/hoster/IfileIt.py b/pyload/plugins/hoster/IfileIt.py index fc26e2f23..70ab8084d 100644 --- a/pyload/plugins/hoster/IfileIt.py +++ b/pyload/plugins/hoster/IfileIt.py @@ -19,7 +19,7 @@ class IfileIt(SimpleHoster): __author_mail__ = "zoidberg@mujmail.cz" LINK_PATTERN = r'</span> If it doesn\'t, <a target="_blank" href="([^"]+)">' - RECAPTCHA_KEY_PATTERN = r"var __recaptcha_public\s*=\s*'([^']+)';" + RECAPTCHA_PATTERN = r"var __recaptcha_public\s*=\s*'([^']+)';" FILE_INFO_PATTERN = r'<span style="cursor: default;[^>]*>\s*(?P<N>.*?)\s* \s*<strong>\s*(?P<S>[0-9.]+)\s*(?P<U>[kKMG])i?B\s*</strong>\s*</span>' OFFLINE_PATTERN = r'<span style="cursor: default;[^>]*>\s* \s*<strong>\s*</strong>\s*</span>' TEMP_OFFLINE_PATTERN = r'<span class="msg_red">Downloading of this file is temporarily disabled</span>' @@ -36,7 +36,8 @@ class IfileIt(SimpleHoster): self.offline() if json_response['captcha']: - captcha_key = re.search(self.RECAPTCHA_KEY_PATTERN, self.html).group(1) + captcha_key = re.search(self.RECAPTCHA_PATTERN, self.html).group(1) + recaptcha = ReCaptcha(self) post_data['ctype'] = "recaptcha" diff --git a/pyload/plugins/hoster/Keep2shareCC.py b/pyload/plugins/hoster/Keep2shareCC.py index 059ab8e05..9d33e17d8 100644 --- a/pyload/plugins/hoster/Keep2shareCC.py +++ b/pyload/plugins/hoster/Keep2shareCC.py @@ -1,7 +1,4 @@ # -*- coding: utf-8 -*- -# -# Test links: -# http://k2s.cc/file/55fb73e1c00c5/random.bin import re @@ -22,15 +19,14 @@ class Keep2shareCC(SimpleHoster): __author_name__ = "stickell" __author_mail__ = "l.stickell@yahoo.it" + FILE_NAME_PATTERN = r'File: <span>(?P<N>.+)</span>' FILE_SIZE_PATTERN = r'Size: (?P<S>[^<]+)</div>' OFFLINE_PATTERN = r'File not found or deleted|Sorry, this file is blocked or deleted|Error 404' LINK_PATTERN = r'To download this file with slow speed, use <a href="([^"]+)">this link</a>' WAIT_PATTERN = r'Please wait ([\d:]+) to download this file' - ALREADY_DOWNLOADING_PATTERN = r'Free account does not allow to download more than one file at the same time' - - RECAPTCHA_KEY = "6LcYcN0SAAAAABtMlxKj7X0hRxOY8_2U86kI1vbb" + MULTIDL_ERROR = r'Free account does not allow to download more than one file at the same time' def handleFree(self): @@ -59,7 +55,7 @@ class Keep2shareCC(SimpleHoster): self.wait(wait_time, reconnect=True) self.retry() - m = re.search(self.ALREADY_DOWNLOADING_PATTERN, self.html) + m = re.search(self.MULTIDL_ERROR, self.html) if m: # if someone is already downloading on our line, wait 30min and retry self.logDebug("Already downloading, waiting for 30 minutes") @@ -71,10 +67,16 @@ class Keep2shareCC(SimpleHoster): self.parseError("Unable to detect direct link") self.startDownload(m.group(1)) + def handleCaptcha(self): recaptcha = ReCaptcha(self) + + captcha_key = recaptcha.detect_key() + if captcha_key is None: + self.parseError("ReCaptcha key not found") + for _ in xrange(5): - challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY) + challenge, response = recaptcha.challenge(captcha_key) post_data = {'recaptcha_challenge_field': challenge, 'recaptcha_response_field': response, 'CaptchaForm%5Bcode%5D': '', @@ -94,11 +96,13 @@ class Keep2shareCC(SimpleHoster): else: self.fail("All captcha attempts failed") + def startDownload(self, url): d = urljoin(self.base_url, url) self.logDebug("Direct Link: " + d) self.download(d, disposition=True) + def sanitize_url(self): header = self.load(self.pyfile.url, just_header=True) if 'location' in header: diff --git a/pyload/plugins/hoster/LemUploadsCom.py b/pyload/plugins/hoster/LemUploadsCom.py index 432154981..96c8aaf1d 100644 --- a/pyload/plugins/hoster/LemUploadsCom.py +++ b/pyload/plugins/hoster/LemUploadsCom.py @@ -20,7 +20,6 @@ class LemUploadsCom(XFileSharingPro): HOSTER_NAME = "lemuploads.com" - OFFLINE_PATTERN = r'<b>File Not Found</b><br><br>' FILE_NAME_PATTERN = r'<b>Password:</b></div>\s*<h2>(?P<N>[^<]+)</h2>' diff --git a/pyload/plugins/hoster/LetitbitNet.py b/pyload/plugins/hoster/LetitbitNet.py index b9631d311..7e01a120f 100644 --- a/pyload/plugins/hoster/LetitbitNet.py +++ b/pyload/plugins/hoster/LetitbitNet.py @@ -50,7 +50,6 @@ class LetitbitNet(SimpleHoster): SECONDS_PATTERN = r'seconds\s*=\s*(\d+);' CAPTCHA_CONTROL_FIELD = r"recaptcha_control_field\s=\s'(?P<value>[^']+)'" - RECAPTCHA_KEY = "6Lc9zdMSAAAAAF-7s2wuQ-036pLRbM0p8dDaQdAM" def setup(self): @@ -108,7 +107,13 @@ class LetitbitNet(SimpleHoster): self.logDebug(response) recaptcha = ReCaptcha(self) - challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY) + + captcha_key = recaptcha.detect_key() + if captcha_key is None: + self.parseError("ReCaptcha key not found") + + challenge, response = recaptcha.challenge(captcha_key) + post_data = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": response, "recaptcha_control_field": recaptcha_control_field} self.logDebug("Post data to send", post_data) diff --git a/pyload/plugins/hoster/LoadTo.py b/pyload/plugins/hoster/LoadTo.py index bd931f91e..ebaaa3d0d 100644 --- a/pyload/plugins/hoster/LoadTo.py +++ b/pyload/plugins/hoster/LoadTo.py @@ -27,7 +27,6 @@ class LoadTo(SimpleHoster): LINK_PATTERN = r'<form method="post" action="(.+?)"' WAIT_PATTERN = r'type="submit" value="Download \((\d+)\)"' - SOLVEMEDIA_PATTERN = r'http://api\.solvemedia\.com/papi/challenge\.noscript\?k=([^"]+)' FILE_URL_REPLACEMENTS = [(r'(\w)$', r'\1/')] @@ -51,12 +50,12 @@ class LoadTo(SimpleHoster): self.wait(m.group(1)) # Load.to is using solvemedia captchas since ~july 2014: - m = re.search(self.SOLVEMEDIA_PATTERN, self.html) - if m is None: + solvemedia = SolveMedia(self) + captcha_key = solvemedia.detect_key() + + if captcha_key is None: self.download(download_url) else: - captcha_key = m.group(1) - solvemedia = SolveMedia(self) captcha_challenge, captcha_response = solvemedia.challenge(captcha_key) self.download(download_url, post={"adcopy_challenge": captcha_challenge, "adcopy_response": captcha_response}) check = self.checkDownload({"404": re.compile("\A<h1>404 Not Found</h1>")}) diff --git a/pyload/plugins/hoster/LuckyShareNet.py b/pyload/plugins/hoster/LuckyShareNet.py index 14eacae98..90af45e8d 100644 --- a/pyload/plugins/hoster/LuckyShareNet.py +++ b/pyload/plugins/hoster/LuckyShareNet.py @@ -21,7 +21,6 @@ class LuckyShareNet(SimpleHoster): FILE_INFO_PATTERN = r"<h1 class='file_name'>(?P<N>\S+)</h1>\s*<span class='file_size'>Filesize: (?P<S>[\d.]+)(?P<U>\w+)</span>" OFFLINE_PATTERN = r'There is no such file available' - RECAPTCHA_KEY = "6LdivsgSAAAAANWh-d7rPE1mus4yVWuSQIJKIYNw" def parseJson(self, rep): @@ -50,8 +49,13 @@ class LuckyShareNet(SimpleHoster): self.wait(int(json['time'])) recaptcha = ReCaptcha(self) + + captcha_key = recaptcha.detect_key() + if captcha_key is None: + self.parseError("ReCaptcha key not found") + for _ in xrange(5): - challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY) + challenge, response = recaptcha.challenge(captcha_key) rep = self.load(r"http://luckyshare.net/download/verify/challenge/%s/response/%s/hash/%s" % (challenge, response, json['hash']), decode=True) self.logDebug("JSON: " + rep) diff --git a/pyload/plugins/hoster/MediafireCom.py b/pyload/plugins/hoster/MediafireCom.py index 52382e6e6..8b882e952 100644 --- a/pyload/plugins/hoster/MediafireCom.py +++ b/pyload/plugins/hoster/MediafireCom.py @@ -58,7 +58,6 @@ class MediafireCom(SimpleHoster): LINK_PATTERN = r'<div class="download_link"[^>]*(?:z-index:(?P<zindex>\d+))?[^>]*>\s*<a href="(?P<href>http://[^"]+)"' JS_KEY_PATTERN = r"DoShow\('mfpromo1'\);[^{]*{((\w+)='';.*?)eval\(\2\);" JS_ZMODULO_PATTERN = r"\('z-index'\)\) \% (\d+)\)\);" - SOLVEMEDIA_PATTERN = r'http://api\.solvemedia\.com/papi/challenge\.noscript\?k=([^"]+)' PAGE1_ACTION_PATTERN = r'<link rel="canonical" href="([^"]+)"/>' PASSWORD_PATTERN = r'<form name="form_password"' @@ -111,15 +110,12 @@ class MediafireCom(SimpleHoster): self.download(download_url) def checkCaptcha(self): - for _ in xrange(5): - m = re.search(self.SOLVEMEDIA_PATTERN, self.html) - if m: - captcha_key = m.group(1) - solvemedia = SolveMedia(self) - captcha_challenge, captcha_response = solvemedia.challenge(captcha_key) - self.html = self.load(self.url, post={"adcopy_challenge": captcha_challenge, - "adcopy_response": captcha_response}, decode=True) - else: - break - else: - self.fail("No valid recaptcha solution received") + solvemedia = SolveMedia(self) + + captcha_key = solvemedia.detect_key() + if captcha_key is None: + self.parseError("SolveMedia key not found") + + captcha_challenge, captcha_response = solvemedia.challenge(captcha_key) + self.html = self.load(self.url, post={"adcopy_challenge": captcha_challenge, + "adcopy_response": captcha_response}, decode=True) diff --git a/pyload/plugins/hoster/MegaFilesSe.py b/pyload/plugins/hoster/MegaFilesSe.py index ae2244e94..862d8e443 100644 --- a/pyload/plugins/hoster/MegaFilesSe.py +++ b/pyload/plugins/hoster/MegaFilesSe.py @@ -16,7 +16,7 @@ class MegaFilesSe(XFileSharingPro): HOSTER_NAME = "megafiles.se" - OFFLINE_PATTERN = r'<b><font[^>]*>File Not Found</font></b><br><br>' + OFFLINE_PATTERN = r'><font[^>]*>File Not Found' FILE_NAME_PATTERN = r'<div[^>]+>\s*<b>(?P<N>[^<]+)</b>\s*</div>' diff --git a/pyload/plugins/hoster/MovReelCom.py b/pyload/plugins/hoster/MovReelCom.py index d85337e46..cfa4f6609 100644 --- a/pyload/plugins/hoster/MovReelCom.py +++ b/pyload/plugins/hoster/MovReelCom.py @@ -6,7 +6,7 @@ from pyload.plugins.internal.XFileSharingPro import XFileSharingPro, create_getI class MovReelCom(XFileSharingPro): __name__ = "MovReelCom" __type__ = "hoster" - __version__ = "1.20" + __version__ = "1.21" __pattern__ = r'http://(?:www\.)?movreel\.com/\w{12}' @@ -17,9 +17,10 @@ class MovReelCom(XFileSharingPro): HOSTER_NAME = "movreel.com" - FILE_INFO_PATTERN = r'<h3>(?P<N>.+?) <small><sup>(?P<S>[\d.]+) (?P<U>..)</sup> </small></h3>' - OFFLINE_PATTERN = r'<b>File Not Found</b><br><br>' - LINK_PATTERN = r'<a href="(http://[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*/.*)">Download Link</a>' + FILE_NAME_PATTERN = r'Filename: <b>(?P<N>.+?)<' + FILE_SIZE_PATTERN = r'Size: (?P<S>[\d.]+) (?P<U>\w+)' + + LINK_PATTERN = r'<a href="([^"]+)">Download Link' getInfo = create_getInfo(MovReelCom) diff --git a/pyload/plugins/hoster/OboomCom.py b/pyload/plugins/hoster/OboomCom.py index 8c0d9d760..1571e8bd6 100644 --- a/pyload/plugins/hoster/OboomCom.py +++ b/pyload/plugins/hoster/OboomCom.py @@ -21,17 +21,39 @@ class OboomCom(Hoster): __author_name__ = "stanley" __author_mail__ = "stanley.foerster@gmail.com" + RECAPTCHA_KEY = "6LdqpO0SAAAAAJGHXo63HyalP7H4qlRs_vff0kJX" + def setup(self): + self.chunkLimit = 1 + self.multiDL = self.premium + + + def process(self, pyfile): + self.pyfile.url.replace(".com/#id=", ".com/#") + self.pyfile.url.replace(".com/#/", ".com/#") + self.getFileId(self.pyfile.url) + self.getSessionToken() + self.getFileInfo(self.sessionToken, self.fileId) + self.pyfile.name = self.fileName + self.pyfile.size = self.fileSize + if not self.premium: + self.solveCaptcha() + self.getDownloadTicket() + self.download("https://%s/1.0/dlh" % self.downloadDomain, get={"ticket": self.downloadTicket, "http_errors": 0}) + + def loadUrl(self, url, get=None): if get is None: get = dict() return json_loads(self.load(url, get, decode=True)) + def getFileId(self, url): self.fileId = re.match(OboomCom.__pattern__, url).group('ID') + def getSessionToken(self): if self.premium: accountInfo = self.account.getAccountInfo(self.user, True) @@ -47,8 +69,10 @@ class OboomCom(Hoster): else: self.fail("Could not retrieve token for guest session. Error code %s" % result[0]) + def solveCaptcha(self): recaptcha = ReCaptcha(self) + for _ in xrange(5): challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY) apiUrl = "https://www.oboom.com/1.0/download/ticket" @@ -83,6 +107,7 @@ class OboomCom(Hoster): self.invalidCaptcha() self.fail("Received invalid captcha 5 times") + def getFileInfo(self, token, fileId): apiUrl = "https://api.oboom.com/1.0/info" params = {"token": token, "items": fileId, "http_errors": 0} @@ -98,6 +123,7 @@ class OboomCom(Hoster): else: self.fail("Could not retrieve file info. Error code %s: %s" % (result[0], result[1])) + def getDownloadTicket(self): apiUrl = "https://api.oboom.com/1.0/dl" params = {"item": self.fileId, "http_errors": 0} @@ -113,20 +139,3 @@ class OboomCom(Hoster): self.downloadTicket = result[2] else: self.fail("Could not retrieve download ticket. Error code %s" % result[0]) - - def setup(self): - self.chunkLimit = 1 - self.multiDL = self.premium - - def process(self, pyfile): - self.pyfile.url.replace(".com/#id=", ".com/#") - self.pyfile.url.replace(".com/#/", ".com/#") - self.getFileId(self.pyfile.url) - self.getSessionToken() - self.getFileInfo(self.sessionToken, self.fileId) - self.pyfile.name = self.fileName - self.pyfile.size = self.fileSize - if not self.premium: - self.solveCaptcha() - self.getDownloadTicket() - self.download("https://%s/1.0/dlh" % self.downloadDomain, get={"ticket": self.downloadTicket, "http_errors": 0}) diff --git a/pyload/plugins/hoster/OneFichierCom.py b/pyload/plugins/hoster/OneFichierCom.py index f7f42e463..cd304a86c 100644 --- a/pyload/plugins/hoster/OneFichierCom.py +++ b/pyload/plugins/hoster/OneFichierCom.py @@ -1,7 +1,4 @@ # -*- coding: utf-8 -*- -# -# Test links: -# http://5pnm24ltcw.1fichier.com/ import re @@ -11,43 +8,40 @@ from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class OneFichierCom(SimpleHoster): __name__ = "OneFichierCom" __type__ = "hoster" - __version__ = "0.61" + __version__ = "0.64" - __pattern__ = r'(http://(?P<id>\w+)\.(?P<host>(1fichier|d(es)?fichiers|pjointe)\.(com|fr|net|org)|(cjoint|mesfichiers|piecejointe|oi)\.(org|net)|tenvoi\.(com|org|net)|dl4free\.com|alterupload\.com|megadl.fr))/?' + __pattern__ = r'https?://(?P<ID>\w+)\.(?P<HOST>(1fichier|d(es)?fichiers|pjointe)\.(com|fr|net|org)|(cjoint|mesfichiers|piecejointe|oi)\.(org|net)|tenvoi\.(com|org|net)|dl4free\.com|alterupload\.com|megadl\.fr)' __description__ = """1fichier.com hoster plugin""" __author_name__ = ("fragonib", "the-razer", "zoidberg", "imclem", "stickell", "Elrick69") __author_mail__ = ("fragonib[AT]yahoo[DOT]es", "daniel_ AT gmx DOT net", "zoidberg@mujmail.cz", "imclem on github", "l.stickell@yahoo.it", "elrick69[AT]rocketmail[DOT]com") - FILE_NAME_PATTERN = r'">Filename :</th>\s*<td>(?P<N>[^<]+)</td>' - FILE_SIZE_PATTERN = r'<th>Size :</th>\s*<td>(?P<S>[^<]+)</td>' - OFFLINE_PATTERN = r'The (requested)? file (could not be found|has been deleted)' - FILE_URL_REPLACEMENTS = [(__pattern__, r'http://\g<id>.\g<host>/en/')] + FILE_NAME_PATTERN = r'>Filename :</th>\s*<td>(?P<N>.+?)<' + FILE_SIZE_PATTERN = r'>Size :</th>\s*<td>(?P<S>[\d.,]+) (?P<U>\w+)' + OFFLINE_PATTERN = r'>The (requested)? file (could not be found|has been deleted)' - WAITING_PATTERN = r'Warning ! Without premium status, you must wait between each downloads' - NOT_PARALLEL = r'Warning ! Without premium status, you can download only one file at a time' - WAIT_TIME = 10 * 60 # Retry time between each free download - RETRY_TIME = 15 * 60 # Default retry time in seconds (if detected parallel download) + FILE_URL_REPLACEMENTS = [(__pattern__, r'http://\g<ID>.\g<HOST>/en/')] + + WAIT_PATTERN = r'>You must wait (\d+)' def setup(self): self.multiDL = self.premium self.resumeDownload = True + def handleFree(self): self.html = self.load(self.pyfile.url, decode=True) - - if self.WAITING_PATTERN in self.html: - self.logInfo("You have to wait been each free download! Retrying in %d seconds." % self.WAIT_TIME) - self.waitAndRetry(self.WAIT_TIME) - else: # detect parallel download - m = re.search(self.NOT_PARALLEL, self.html) - if m: - self.waitAndRetry(self.RETRY_TIME) - - url, inputs = self.parseHtmlForm('action="http://%s' % self.file_info['id']) + m = re.search(self.WAIT_PATTERN, self.html) + if m: + wait_time = int(m.group(1)) + 1 #: One minute more than what the page displays to be safe + self.logInfo("You have to wait been each free download", "Retrying in %d minutes." % wait_time) + self.wait(wait_time * 60, True) + self.retry() + + url, inputs = self.parseHtmlForm('action="http://%s' % self.file_info['ID']) if not url: self.parseError("Download link not found") @@ -61,8 +55,9 @@ class OneFichierCom(SimpleHoster): # Check download self.checkDownloadedFile() + def handlePremium(self): - url, inputs = self.parseHtmlForm('action="http://%s' % self.file_info['id']) + url, inputs = self.parseHtmlForm('action="http://%s' % self.file_info['ID']) if not url: self.parseError("Download link not found") @@ -76,15 +71,13 @@ class OneFichierCom(SimpleHoster): # Check download self.checkDownloadedFile() + def checkDownloadedFile(self): - check = self.checkDownload({"wait": self.WAITING_PATTERN}) + check = self.checkDownload({'wait': self.WAIT_PATTERN}) if check == "wait": - self.waitAndRetry(int(self.lastcheck.group(1)) * 60) - - def waitAndRetry(self, wait_time): - self.wait(wait_time, True) - self.retry() - + wait_time = int(self.lastcheck.group(1)) * 60 + self.wait(wait_time, True) + self.retry() getInfo = create_getInfo(OneFichierCom) diff --git a/pyload/plugins/hoster/RapidgatorNet.py b/pyload/plugins/hoster/RapidgatorNet.py index a92424cac..1d84b2245 100644 --- a/pyload/plugins/hoster/RapidgatorNet.py +++ b/pyload/plugins/hoster/RapidgatorNet.py @@ -34,8 +34,8 @@ class RapidgatorNet(SimpleHoster): WAIT_PATTERN = r'(?:Delay between downloads must be not less than|Try again in)\s*(\d+)\s*(hour|min)' LINK_PATTERN = r"return '(http://\w+.rapidgator.net/.*)';" - RECAPTCHA_KEY_PATTERN = r'"http://api\.recaptcha\.net/challenge\?k=(.*?)"' - ADSCAPTCHA_SRC_PATTERN = r'(http://api\.adscaptcha\.com/Get\.aspx[^"\']*)' + RECAPTCHA_PATTERN = r'"http://api\.recaptcha\.net/challenge\?k=(.*?)"' + ADSCAPTCHA_PATTERN = r'(http://api\.adscaptcha\.com/Get\.aspx[^"\']*)' SOLVEMEDIA_PATTERN = r'http://api\.solvemedia\.com/papi/challenge\.script\?k=(.*?)"' @@ -138,12 +138,12 @@ class RapidgatorNet(SimpleHoster): self.parseError("Download link") def getCaptcha(self): - m = re.search(self.ADSCAPTCHA_SRC_PATTERN, self.html) + m = re.search(self.ADSCAPTCHA_PATTERN, self.html) if m: captcha_key = m.group(1) captcha = AdsCaptcha(self) else: - m = re.search(self.RECAPTCHA_KEY_PATTERN, self.html) + m = re.search(self.RECAPTCHA_PATTERN, self.html) if m: captcha_key = m.group(1) captcha = ReCaptcha(self) diff --git a/pyload/plugins/hoster/RyushareCom.py b/pyload/plugins/hoster/RyushareCom.py index 9641bf6e5..bd264f087 100644 --- a/pyload/plugins/hoster/RyushareCom.py +++ b/pyload/plugins/hoster/RyushareCom.py @@ -26,7 +26,6 @@ class RyushareCom(XFileSharingPro): WAIT_PATTERN = r'You have to wait ((?P<hour>\d+) hour[s]?, )?((?P<min>\d+) minute[s], )?(?P<sec>\d+) second[s]' LINK_PATTERN = r'<a href="([^"]+)">Click here to download<' - SOLVEMEDIA_PATTERN = r'http:\/\/api\.solvemedia\.com\/papi\/challenge\.script\?k=(.*?)"' def getDownloadLink(self): @@ -57,13 +56,13 @@ class RyushareCom(XFileSharingPro): self.retry() for _ in xrange(5): - m = re.search(self.SOLVEMEDIA_PATTERN, self.html) - if m is None: - self.parseError("Error parsing captcha") - - captchaKey = m.group(1) captcha = SolveMedia(self) - challenge, response = captcha.challenge(captchaKey) + + captcha_key = captcha.detect_key() + if captcha_key is None: + self.parseError("SolveMedia key not found") + + challenge, response = captcha.challenge(captcha_key) inputs['adcopy_challenge'] = challenge inputs['adcopy_response'] = response diff --git a/pyload/plugins/hoster/SecureUploadEu.py b/pyload/plugins/hoster/SecureUploadEu.py index afe839f51..b3b7d8ddc 100644 --- a/pyload/plugins/hoster/SecureUploadEu.py +++ b/pyload/plugins/hoster/SecureUploadEu.py @@ -18,7 +18,6 @@ class SecureUploadEu(XFileSharingPro): HOSTER_NAME = "secureupload.eu" FILE_INFO_PATTERN = r'<h3>Downloading (?P<N>[^<]+) \((?P<S>[^<]+)\)</h3>' - OFFLINE_PATTERN = r'The file was removed|File Not Found' getInfo = create_getInfo(SecureUploadEu) diff --git a/pyload/plugins/hoster/TurbobitNet.py b/pyload/plugins/hoster/TurbobitNet.py index 9a6b26c97..5dd01fad5 100644 --- a/pyload/plugins/hoster/TurbobitNet.py +++ b/pyload/plugins/hoster/TurbobitNet.py @@ -36,8 +36,8 @@ class TurbobitNet(SimpleHoster): LINK_PATTERN = r'(?P<url>/download/redirect/[^"\']+)' LIMIT_WAIT_PATTERN = r"<div id='timeout'>(\d+)<" - CAPTCHA_KEY_PATTERN = r'src="http://api\.recaptcha\.net/challenge\?k=([^"]+)"' - CAPTCHA_SRC_PATTERN = r'<img alt="Captcha" src="(.+?)"' + + CAPTCHA_URL_PATTERN = r'<img alt="Captcha" src="(.+?)"' def handleFree(self): @@ -71,12 +71,13 @@ class TurbobitNet(SimpleHoster): if inputs['captcha_type'] == 'recaptcha': recaptcha = ReCaptcha(self) - m = re.search(self.CAPTCHA_KEY_PATTERN, self.html) - captcha_key = m.group(1) if m else '6LcTGLoSAAAAAHCWY9TTIrQfjUlxu6kZlTYP50_c' - inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge( - captcha_key) + captcha_key = recaptcha.detect_key() + if captcha_key is None: + self.parseError("ReCaptcha captcha key not found") + + inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge(captcha_key) else: - m = re.search(self.CAPTCHA_SRC_PATTERN, self.html) + m = re.search(self.CAPTCHA_URL_PATTERN, self.html) if m is None: self.parseError('captcha') captcha_url = m.group(1) diff --git a/pyload/plugins/hoster/UpstoreNet.py b/pyload/plugins/hoster/UpstoreNet.py index d812d292d..e1ec93b99 100644 --- a/pyload/plugins/hoster/UpstoreNet.py +++ b/pyload/plugins/hoster/UpstoreNet.py @@ -39,9 +39,9 @@ class UpstoreNet(SimpleHoster): # STAGE 2: solv captcha and wait # first get the infos we need: recaptcha key and wait time recaptcha = ReCaptcha(self) - if not recaptcha.detect_key(self.html): - self.parseError("could not find recaptcha pattern") - self.logDebug("Using captcha key " + recaptcha.recaptcha_key) + if recaptcha.detect_key() is None: + self.parseError("ReCaptcha key not found") + self.logDebug("Using captcha key " + recaptcha.key) # try the captcha 5 times for i in xrange(5): m = re.search(self.WAIT_PATTERN, self.html) diff --git a/pyload/plugins/hoster/UptoboxCom.py b/pyload/plugins/hoster/UptoboxCom.py index 5ef2ad69b..d07aeda97 100644 --- a/pyload/plugins/hoster/UptoboxCom.py +++ b/pyload/plugins/hoster/UptoboxCom.py @@ -21,7 +21,6 @@ class UptoboxCom(XFileSharingPro): FILE_INFO_PATTERN = r'"para_title">(?P<N>.+) \((?P<S>[\d.]+) (?P<U>\w+)\)' OFFLINE_PATTERN = r'>(File not found|Access Denied|404 Not Found)' - TEMP_OFFLINE_PATTERN = r'>This server is in maintenance mode' WAIT_PATTERN = r'>(\d+)</span> seconds<' LINK_PATTERN = r'"(https?://\w+\.uptobox\.com/d/.*?)"' diff --git a/pyload/plugins/hoster/VidPlayNet.py b/pyload/plugins/hoster/VidPlayNet.py index c52b43d1f..0c1247f09 100644 --- a/pyload/plugins/hoster/VidPlayNet.py +++ b/pyload/plugins/hoster/VidPlayNet.py @@ -19,7 +19,6 @@ class VidPlayNet(XFileSharingPro): HOSTER_NAME = "vidplay.net" - OFFLINE_PATTERN = r'<b>File Not Found</b><br>\s*<br>' FILE_NAME_PATTERN = r'<b>Password:</b></div>\s*<h[1-6]>(?P<N>[^<]+)</h[1-6]>' LINK_PATTERN = r'(http://([^/]*?%s|\d+\.\d+\.\d+\.\d+)(:\d+)?(/d/|(?:/files)?/\d+/\w+/)[^"\'<&]+)' % HOSTER_NAME diff --git a/pyload/plugins/internal/CaptchaService.py b/pyload/plugins/internal/CaptchaService.py index 26482379d..b2fba0652 100644 --- a/pyload/plugins/internal/CaptchaService.py +++ b/pyload/plugins/internal/CaptchaService.py @@ -7,96 +7,204 @@ from random import random class CaptchaService: __name__ = "CaptchaService" - __version__ = "0.06" + __version__ = "0.09" - __description__ = """Captcha service plugin""" + __description__ = """Base captcha service plugin""" __author_name__ = "pyLoad Team" __author_mail__ = "admin@pyload.org" + KEY_PATTERN = None + + key = None + def __init__(self, plugin): self.plugin = plugin -class ReCaptcha: - RECAPTCHA_KEY_PATTERN = r"https?://(?:www\.)?google\.com/recaptcha/api/challenge\?k=(?P<key>\w+)" - RECAPTCHA_KEY_AJAX_PATTERN = r"Recaptcha\.create\s*\(\s*[\"'](?P<key>\w+)[\"']\s*," + def detect_key(self, html=None): + if not html: + if hasattr(self.plugin, "html") and self.plugin.html: + html = self.plugin.html + else: + errmsg = "%s html missing" % self.__name__ + self.plugin.fail(errmsg) + raise TypeError(errmsg) - recaptcha_key = None + m = re.search(self.KEY_PATTERN, html) + if m: + self.key = m.group("KEY") + self.plugin.logDebug("%s key: %s" % (self.__name__, self.key)) + return self.key + else: + self.plugin.logDebug("%s key not found" % self.__name__) + return None - def __init__(self, plugin): - self.plugin = plugin + def challenge(self, key=None): + raise NotImplementedError + + + def result(self, server, challenge): + raise NotImplementedError + +class ReCaptcha(CaptchaService): + __name__ = "ReCaptcha" + __version__ = "0.02" - def detect_key(self, html): - m = re.search(self.RECAPTCHA_KEY_PATTERN, html) + __description__ = """ReCaptcha captcha service plugin""" + __author_name__ = "pyLoad Team" + __author_mail__ = "admin@pyload.org" + + + KEY_PATTERN = r"https?://(?:www\.)?google\.com/recaptcha/api/challenge\?k=(?P<KEY>\w+?)" + KEY_AJAX_PATTERN = r"Recaptcha\.create\s*\(\s*[\"'](?P<KEY>\w+)[\"']\s*," + + + def detect_key(self, html=None): + if not html: + if hasattr(self.plugin, "html") and self.plugin.html: + html = self.plugin.html + else: + errmsg = "ReCaptcha html missing" + self.plugin.fail(errmsg) + raise TypeError(errmsg) + + m = re.search(self.KEY_PATTERN, html) if m is None: - m = re.search(self.RECAPTCHA_KEY_AJAX_PATTERN, html) + m = re.search(self.KEY_AJAX_PATTERN, html) if m: - self.recaptcha_key = m.group('key') - return self.recaptcha_key + self.key = m.group("KEY") + self.plugin.logDebug("ReCaptcha key: %s" % self.key) + return self.key else: + self.plugin.logDebug("ReCaptcha key not found") return None def challenge(self, key=None): if not key: - if self.recaptcha_key: - key = self.recaptcha_key + if self.key: + key = self.key else: - raise TypeError("ReCaptcha key not found") + errmsg = "ReCaptcha key missing" + self.plugin.fail(errmsg) + raise TypeError(errmsg) - js = self.plugin.req.load("http://www.google.com/recaptcha/api/challenge", get={"k": key}, cookies=True) + js = self.plugin.req.load("http://www.google.com/recaptcha/api/challenge", get={'k': key}, cookies=True) try: - challenge = re.search("challenge : '(.*?)',", js).group(1) - server = re.search("server : '(.*?)',", js).group(1) + challenge = re.search("challenge : '(.+?)',", js).group(1) + server = re.search("server : '(.+?)',", js).group(1) except: - self.plugin.fail("recaptcha error") + self.plugin.parseError("ReCaptcha challenge pattern not found") + result = self.result(server, challenge) return challenge, result def result(self, server, challenge): - return self.plugin.decryptCaptcha("%simage" % server, get={"c": challenge}, + return self.plugin.decryptCaptcha("%simage" % server, get={'c': challenge}, cookies=True, forceUser=True, imgtype="jpg") class AdsCaptcha(CaptchaService): + __name__ = "AdsCaptcha" + __version__ = "0.02" + + __description__ = """AdsCaptcha captcha service plugin""" + __author_name__ = "pyLoad Team" + __author_mail__ = "admin@pyload.org" + - def challenge(self, src): - js = self.plugin.req.load(src, cookies=True) + ID_PATTERN = r'http://api\.adscaptcha\.com/Get\.aspx\?[^"\']*CaptchaId=(?P<ID>\d+)' + KEY_PATTERN = r'http://api\.adscaptcha\.com/Get\.aspx\?[^"\']*PublicKey=(?P<KEY>[\w-]+)' + + + def detect_key(self, html=None): + if not html: + if hasattr(self.plugin, "html") and self.plugin.html: + html = self.plugin.html + else: + errmsg = "AdsCaptcha html missing" + self.plugin.fail(errmsg) + raise TypeError(errmsg) + + m = re.search(self.ID_PATTERN, html) + n = re.search(self.KEY_PATTERN, html) + if m and n: + self.key = (m.group("ID"), m.group("KEY")) + self.plugin.logDebug("AdsCaptcha id|key: %s | %s" % self.key) + return self.key + else: + self.plugin.logDebug("AdsCaptcha id or key not found") + return None + + + def challenge(self, key=None): #: key is tuple(CaptchaId, PublicKey) + if not key: + if self.key: + key = self.key + else: + errmsg = "AdsCaptcha key missing" + self.plugin.fail(errmsg) + raise TypeError(errmsg) + + CaptchaId, PublicKey = key + + js = self.plugin.req.load("http://api.adscaptcha.com/Get.aspx", get={'CaptchaId': CaptchaId, 'PublicKey': PublicKey}, cookies=True) try: - challenge = re.search("challenge: '(.*?)',", js).group(1) - server = re.search("server: '(.*?)',", js).group(1) + challenge = re.search("challenge: '(.+?)',", js).group(1) + server = re.search("server: '(.+?)',", js).group(1) except: - self.plugin.fail("adscaptcha error") + self.plugin.parseError("AdsCaptcha challenge pattern not found") + 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()}, + return self.plugin.decryptCaptcha("%sChallenge.aspx" % server, get={'cid': challenge, 'dummy': random()}, cookies=True, imgtype="jpg") class SolveMedia(CaptchaService): + __name__ = "SolveMedia" + __version__ = "0.02" - def challenge(self, src): - html = self.plugin.req.load("http://api.solvemedia.com/papi/challenge.noscript?k=%s" % src, cookies=True) + __description__ = """SolveMedia captcha service plugin""" + __author_name__ = "pyLoad Team" + __author_mail__ = "admin@pyload.org" + + + KEY_PATTERN = r'http://api\.solvemedia\.com/papi/challenge\.(no)?script\?k=(?P<KEY>.+?)"' + + + def challenge(self, key=None): + if not key: + if self.key: + key = self.key + else: + errmsg = "SolveMedia key missing" + self.plugin.fail(errmsg) + raise TypeError(errmsg) + + html = self.plugin.req.load("http://api.solvemedia.com/papi/challenge.noscript", get={'k': key}, cookies=True) try: challenge = re.search(r'<input type=hidden name="adcopy_challenge" id="adcopy_challenge" value="([^"]+)">', html).group(1) + server = "http://api.solvemedia.com/papi/media" except: - self.plugin.fail("solvemedia error") - result = self.result(challenge) + self.plugin.parseError("SolveMedia challenge pattern not found") + + result = self.result(server, challenge) return challenge, result - def result(self, challenge): - return self.plugin.decryptCaptcha("http://api.solvemedia.com/papi/media?c=%s" % challenge, imgtype="gif") + def result(self, server, challenge): + return self.plugin.decryptCaptcha(server, get={'c': challenge}, imgtype="gif") diff --git a/pyload/plugins/internal/SimpleHoster.py b/pyload/plugins/internal/SimpleHoster.py index 75c6fc8e8..399430b9f 100644 --- a/pyload/plugins/internal/SimpleHoster.py +++ b/pyload/plugins/internal/SimpleHoster.py @@ -176,7 +176,7 @@ class SimpleHoster(Hoster): example: OFFLINE_PATTERN = r'File (deleted|not found)' TEMP_OFFLINE_PATTERN: Checks if the file is temporarily offline - example: TEMP_OFFLINE_PATTERN = r'Server maintainance' + example: TEMP_OFFLINE_PATTERN = r'Server (maintenance|maintainance)' PREMIUM_ONLY_PATTERN: (optional) Checks if the file can be downloaded only with a premium account example: PREMIUM_ONLY_PATTERN = r'Premium account required' diff --git a/pyload/plugins/internal/XFileSharingPro.py b/pyload/plugins/internal/XFileSharingPro.py index 212ef23ef..0dec852d4 100644 --- a/pyload/plugins/internal/XFileSharingPro.py +++ b/pyload/plugins/internal/XFileSharingPro.py @@ -21,7 +21,7 @@ class XFileSharingPro(SimpleHoster): """ __name__ = "XFileSharingPro" __type__ = "hoster" - __version__ = "0.36" + __version__ = "0.37" __pattern__ = r'^unmatchable$' @@ -40,7 +40,8 @@ class XFileSharingPro(SimpleHoster): FILE_NAME_PATTERN = r'<input type="hidden" name="fname" value="(?P<N>[^"]+)"' FILE_SIZE_PATTERN = r'You have requested .*\((?P<S>[\d\.\,]+) ?(?P<U>\w+)?\)</font>' - OFFLINE_PATTERN = r'>\w+ (Not Found|file (was|has been) removed)' + OFFLINE_PATTERN = r'>\s*\w+ (Not Found|file (was|has been) removed)' + TEMP_OFFLINE_PATTERN = r'>\s*\w+ server (is in )?(maintenance|maintainance)' WAIT_PATTERN = r'<span id="countdown_str">.*?>(\d+)</span>' @@ -48,11 +49,11 @@ class XFileSharingPro(SimpleHoster): LINK_PATTERN = None #: final download url pattern CAPTCHA_URL_PATTERN = r'(http://[^"\']+?/captchas?/[^"\']+)' - RECAPTCHA_URL_PATTERN = r'http://[^"\']+?recaptcha[^"\']+?\?k=([^"\']+)"' - CAPTCHA_DIV_PATTERN = r'>Enter code.*?<div.*?>(.*?)</div>' - SOLVEMEDIA_PATTERN = r'http:\/\/api\.solvemedia\.com\/papi\/challenge\.script\?k=(.*?)"' + CAPTCHA_DIV_PATTERN = r'>Enter code.*?<div.*?>(.+?)</div>' + RECAPTCHA_PATTERN = None + SOLVEMEDIA_PATTERN = None - ERROR_PATTERN = r'class=["\']err["\'][^>]*>(.*?)</' + ERROR_PATTERN = r'class=["\']err["\'][^>]*>(.+?)</' def setup(self): @@ -172,7 +173,7 @@ class XFileSharingPro(SimpleHoster): self.html = self.load(self.pyfile.url, post=self.getPostParameters()) m = re.search(self.LINK_PATTERN, self.html) if m is None: - self.parseError('DIRECT LINK') + self.parseError('LINK_PATTERN not found') self.startDownload(m.group(1)) @@ -193,7 +194,7 @@ class XFileSharingPro(SimpleHoster): action, inputs = self.parseHtmlForm('F1') if not inputs: - self.parseError('TEXTAREA') + self.parseError('TEXTAREA not found') self.logDebug(self.HOSTER_NAME, inputs) if inputs['st'] == 'OK': self.html = self.load(action, post=inputs) @@ -205,7 +206,7 @@ class XFileSharingPro(SimpleHoster): #get easybytez.com link for uploaded file m = re.search(self.OVR_LINK_PATTERN, self.html) if m is None: - self.parseError('DIRECT LINK (OVR)') + self.parseError('OVR_LINK_PATTERN not found') self.pyfile.url = m.group(1) header = self.load(self.pyfile.url, just_header=True) if 'location' in header: # Direct link @@ -317,35 +318,42 @@ class XFileSharingPro(SimpleHoster): def handleCaptcha(self, inputs): - m = re.search(self.RECAPTCHA_URL_PATTERN, self.html) + m = re.search(self.CAPTCHA_URL_PATTERN, self.html) if m: - recaptcha_key = unquote(m.group(1)) - self.logDebug("RECAPTCHA KEY: %s" % recaptcha_key) - recaptcha = ReCaptcha(self) - inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge(recaptcha_key) + captcha_url = m.group(1) + inputs['code'] = self.decryptCaptcha(captcha_url) return 1 - else: - m = re.search(self.CAPTCHA_URL_PATTERN, self.html) - if m: - captcha_url = m.group(1) - inputs['code'] = self.decryptCaptcha(captcha_url) - return 2 - else: - m = re.search(self.CAPTCHA_DIV_PATTERN, self.html, re.DOTALL) - if m: - captcha_div = m.group(1) - self.logDebug(captcha_div) - numerals = re.findall(r'<span.*?padding-left\s*:\s*(\d+).*?>(\d)</span>', html_unescape(captcha_div)) - inputs['code'] = "".join([a[1] for a in sorted(numerals, key=lambda num: int(num[0]))]) - self.logDebug("CAPTCHA", inputs['code'], numerals) - return 3 - else: - m = re.search(self.SOLVEMEDIA_PATTERN, self.html) - if m: - captcha_key = m.group(1) - captcha = SolveMedia(self) - inputs['adcopy_challenge'], inputs['adcopy_response'] = captcha.challenge(captcha_key) - return 4 + + m = re.search(self.CAPTCHA_DIV_PATTERN, self.html, re.DOTALL) + if m: + captcha_div = m.group(1) + self.logDebug(captcha_div) + numerals = re.findall(r'<span.*?padding-left\s*:\s*(\d+).*?>(\d)</span>', html_unescape(captcha_div)) + inputs['code'] = "".join([a[1] for a in sorted(numerals, key=lambda num: int(num[0]))]) + self.logDebug("CAPTCHA", inputs['code'], numerals) + return 2 + + recaptcha = ReCaptcha(self) + try: + captcha_key = re.search(self.RECAPTCHA_PATTERN, self.html).group(1) + except: + captcha_key = recaptcha.detect_key() + + if captcha_key: + self.logDebug("RECAPTCHA KEY: %s" % captcha_key) + inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge(captcha_key) + return 3 + + solvemedia = SolveMedia(self) + try: + captcha_key = re.search(self.SOLVEMEDIA_PATTERN, self.html).group(1) + except: + captcha_key = solvemedia.detect_key() + + if captcha_key: + inputs['adcopy_challenge'], inputs['adcopy_response'] = solvemedia.challenge(captcha_key) + return 4 + return 0 diff --git a/pyload/plugins/ocr/NetloadIn.py b/pyload/plugins/ocr/NetloadIn.py index d31c30989..825fba787 100644 --- a/pyload/plugins/ocr/NetloadIn.py +++ b/pyload/plugins/ocr/NetloadIn.py @@ -2,6 +2,7 @@ from pyload.plugins.OCR import OCR + class NetloadIn(OCR): __name__ = "NetloadIn" __type__ = "ocr" |