diff options
author | jansohn <jansohn@users.noreply.github.com> | 2015-10-02 10:09:26 +0200 |
---|---|---|
committer | jansohn <jansohn@users.noreply.github.com> | 2015-10-02 10:09:26 +0200 |
commit | 3a08656c5665f4b8db98744fb323e64b8630e084 (patch) | |
tree | 28f9f62ffc57888b76ca32540dbf5af3a4cfc8d0 /module/plugins/crypter | |
parent | Merge pull request #1 from pyload/stable (diff) | |
parent | [Account] Improve parse_traffic method + code cosmetics (diff) | |
download | pyload-3a08656c5665f4b8db98744fb323e64b8630e084.tar.xz |
Merge pull request #2 from pyload/stable
sync with stable
Diffstat (limited to 'module/plugins/crypter')
26 files changed, 255 insertions, 196 deletions
diff --git a/module/plugins/crypter/ChipDe.py b/module/plugins/crypter/ChipDe.py index 3604635e5..8d823d88d 100644 --- a/module/plugins/crypter/ChipDe.py +++ b/module/plugins/crypter/ChipDe.py @@ -23,8 +23,10 @@ class ChipDe(Crypter): self.html = self.load(pyfile.url) try: f = re.search(r'"(http://video\.chip\.de/.+)"', self.html) + except Exception: self.fail(_("Failed to find the URL")) + else: self.urls = [f.group(1)] self.log_debug("The file URL is %s" % self.urls[0]) diff --git a/module/plugins/crypter/CloudzillaToFolder.py b/module/plugins/crypter/CloudzillaToFolder.py index 09b4d4c08..dc0cdfef2 100644 --- a/module/plugins/crypter/CloudzillaToFolder.py +++ b/module/plugins/crypter/CloudzillaToFolder.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- import re -import urlparse from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo @@ -9,7 +8,7 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo class CloudzillaToFolder(SimpleHoster): __name__ = "CloudzillaToFolder" __type__ = "crypter" - __version__ = "0.03" + __version__ = "0.04" __status__ = "testing" __pattern__ = r'http://(?:www\.)?cloudzilla\.to/share/folder/(?P<ID>[\w^_]+)' @@ -29,11 +28,11 @@ class CloudzillaToFolder(SimpleHoster): def check_errors(self): m = re.search(self.PASSWORD_PATTERN, self.html) - if m: + if m is not None: self.html = self.load(self.pyfile.url, get={'key': self.get_password()}) if re.search(self.PASSWORD_PATTERN, self.html): - self.retry(reason="Wrong password") + self.retry(msg="Wrong password") getInfo = create_getInfo(CloudzillaToFolder) diff --git a/module/plugins/crypter/Dereferer.py b/module/plugins/crypter/Dereferer.py index 9051abcc2..8ecc635ec 100644 --- a/module/plugins/crypter/Dereferer.py +++ b/module/plugins/crypter/Dereferer.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter class Dereferer(SimpleCrypter): __name__ = "Dereferer" __type__ = "crypter" - __version__ = "0.18" + __version__ = "0.19" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(?:\w+\.)*?(?P<DOMAIN>(?:[\d.]+|[\w\-]{3,}(?:\.[a-zA-Z]{2,}){1,2})(?:\:\d+)?)/.*?(?P<LINK>(?:ht|f)tps?://.+)' @@ -20,12 +20,12 @@ class Dereferer(SimpleCrypter): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_DOMAIN = None - HOSTER_NAME = None + PLUGIN_DOMAIN = None + PLUGIN_NAME = None def _log(self, level, plugintype, pluginname, messages): - return super(Dereferer, self)._log(level, plugintype, pluginname, (self.HOSTER_NAME,) + messages) + return super(Dereferer, self)._log(level, plugintype, pluginname, (self.PLUGIN_NAME,) + messages) def init(self): @@ -33,9 +33,9 @@ class Dereferer(SimpleCrypter): self.__pattern__ = self.pyload.pluginManager.crypterPlugins[self.__name__]['pattern'] #@TODO: Recheck in 0.4.10 - self.HOSTER_DOMAIN = re.match(self.__pattern__, self.pyfile.url).group("DOMAIN").lower() - self.HOSTER_NAME = "".join(part.capitalize() for part in re.split(r'(\.|\d+)', self.HOSTER_DOMAIN) if part != '.') + self.PLUGIN_DOMAIN = re.match(self.__pattern__, self.pyfile.url).group("DOMAIN").lower() + self.PLUGIN_NAME = "".join(part.capitalize() for part in re.split(r'(\.|\d+)', self.PLUGIN_DOMAIN) if part != '.') def get_links(self): - return [re.match(self.__pattern__, self.pyfile.url).group('LINK').strip()] + return [re.match(self.__pattern__, self.pyfile.url).group('LINK')] diff --git a/module/plugins/crypter/DevhostStFolder.py b/module/plugins/crypter/DevhostStFolder.py index 8340adeb8..6c50c8480 100644 --- a/module/plugins/crypter/DevhostStFolder.py +++ b/module/plugins/crypter/DevhostStFolder.py @@ -42,7 +42,7 @@ class DevhostStFolder(SimpleCrypter): p = r'href="(.+?)">Back to \w+<' m = re.search(p, self.html) - html = self.load(urlparse.urljoin("http://d-h.st", m.group(1)), + html = self.load(urlparse.urljoin("http://d-h.st/", m.group(1)), cookies=False) p = '\?fld_id=%s.*?">(.+?)<' % self.info['pattern']['ID'] diff --git a/module/plugins/crypter/DlProtectCom.py b/module/plugins/crypter/DlProtectCom.py index 0c776ac61..ac45ee4c3 100644 --- a/module/plugins/crypter/DlProtectCom.py +++ b/module/plugins/crypter/DlProtectCom.py @@ -53,7 +53,7 @@ class DlProtectCom(SimpleCrypter): if "Security Code" in self.html: m = re.search(r'/captcha\.php\?key=(.+?)"', self.html) - if m: + if m is not None: captcha_code = self.captcha.decrypt("http://www.dl-protect.com/captcha.php?key=" + m.group(1), input_type="gif") post_req['secure'] = captcha_code diff --git a/module/plugins/crypter/EmbeduploadCom.py b/module/plugins/crypter/EmbeduploadCom.py index 341b3e315..e4a9387ae 100644 --- a/module/plugins/crypter/EmbeduploadCom.py +++ b/module/plugins/crypter/EmbeduploadCom.py @@ -30,7 +30,7 @@ class EmbeduploadCom(Crypter): tmp_links = [] m = re.findall(self.LINK_PATTERN, self.html) - if m: + if m is not None: prefered_set = set(self.get_config('preferedHoster').split('|')) prefered_set = map(lambda s: s.lower().split('.')[0], prefered_set) diff --git a/module/plugins/crypter/FilecryptCc.py b/module/plugins/crypter/FilecryptCc.py index 9f4ad69aa..bb9aee1d7 100644 --- a/module/plugins/crypter/FilecryptCc.py +++ b/module/plugins/crypter/FilecryptCc.py @@ -11,28 +11,33 @@ from Crypto.Cipher import AES from module.plugins.internal.Crypter import Crypter from module.plugins.captcha.ReCaptcha import ReCaptcha +from module.plugins.captcha.SolveMedia import SolveMedia class FilecryptCc(Crypter): __name__ = "FilecryptCc" __type__ = "crypter" - __version__ = "0.18" + __version__ = "0.20" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?filecrypt\.cc/Container/\w+' __description__ = """Filecrypt.cc decrypter plugin""" __license__ = "GPLv3" - __authors__ = [("zapp-brannigan", "")] + __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de"), + ("GammaC0de" , None )] # URL_REPLACEMENTS = [(r'.html$', ""), (r'$', ".html")] #@TODO: Extend SimpleCrypter - DLC_LINK_PATTERN = r'<button class="dlcdownload" type="button" title="Download \*.dlc" onclick="DownloadDLC\(\'(.+)\'\);"><i></i><span>dlc<' + DLC_LINK_PATTERN = r'onclick="DownloadDLC\(\'(.+)\'\);">' WEBLINK_PATTERN = r"openLink.?'([\w_-]*)'," - CAPTCHA_PATTERN = r'<img id="nc" src="(.+?)"' - CIRCLE_CAPTCHA_PATTERN = r'<input type="image" src="(.+?)"' + CAPTCHA_PATTERN = r'class="safety">Sicherheitsabfrage<' + INTERNAL_CAPTCHA_PATTERN = r'<img id="nc" src="(.+?)"' + CIRCLE_CAPTCHA_PATTERN = r'<input type="image" src="(.+?)"' + KEY_CAPTCHA_PATTERN = r"<script language=JavaScript src='(http://backs\.keycaptcha\.com/swfs/cap\.js)'" + SOLVE_MEDIA_PATTERN = r'<script type="text/javascript" src="(http://api\.solvemedia\.com/papi/challenge.+?)"' MIRROR_PAGE_PATTERN = r'"[\w]*" href="(https?://(?:www\.)?filecrypt.cc/Container/\w+\.html\?mirror=\d+)">' @@ -43,7 +48,6 @@ class FilecryptCc(Crypter): def decrypt(self, pyfile): self.html = self.load(pyfile.url) - self.base_url = self.pyfile.url.split("Container")[0] if "content notfound" in self.html: #@NOTE: "content notfound" is NOT a typo self.offline() @@ -86,62 +90,93 @@ class FilecryptCc(Crypter): def handle_captcha(self): - m = re.search(self.CAPTCHA_PATTERN, self.html) - m2 = re.search(self.CIRCLE_CAPTCHA_PATTERN, self.html) + if re.search(self.CAPTCHA_PATTERN, self.html): + m1 = re.search(self.INTERNAL_CAPTCHA_PATTERN, self.html) + m2 = re.search(self.CIRCLE_CAPTCHA_PATTERN, self.html) + m3 = re.search(self.SOLVE_MEDIA_PATTERN, self.html) + m4 = re.search(self.KEY_CAPTCHA_PATTERN, self.html) - if m: #: Normal captcha - self.log_debug("Captcha-URL: %s" % m.group(1)) + if m1: #: Normal captcha + self.log_debug("Internal Captcha URL: %s" % urlparse.urljoin(self.pyfile.url, m1.group(1))) - captcha_code = self.captcha.decrypt(urlparse.urljoin(self.base_url, m.group(1)), - input_type="gif") + captcha_code = self.captcha.decrypt(urlparse.urljoin(self.pyfile.url, m1.group(1)), + ref=True, input_type="gif") - self.site_with_links = self.load(self.pyfile.url, - post={'recaptcha_response_field': captcha_code}) - elif m2: #: Circle captcha - self.log_debug("Captcha-URL: %s" % m2.group(1)) + self.site_with_links = self.load(self.pyfile.url, + post={'recaptcha_response_field': captcha_code}) - captcha_code = self.captcha.decrypt('%s%s?c=abc' %(self.base_url, m2.group(1)), - output_type='positional') + elif m2: #: Circle captcha + self.log_debug("Circle Captcha URL: %s" % urlparse.urljoin(self.pyfile.url, m2.group(1))) - self.site_with_links = self.load(self.pyfile.url, - post={'button.x': captcha_code[0], 'button.y': captcha_code[1]}) + captcha_code = self.captcha.decrypt(urlparse.urljoin(self.pyfile.url, m2.group(1)), + input_type="png", output_type='positional') - else: - recaptcha = ReCaptcha(self) - captcha_key = recaptcha.detect_key() + self.site_with_links = self.load(self.pyfile.url, + post={'button.x': captcha_code[0], + 'button.y': captcha_code[1]}) + + elif m3: #: Solvemedia captcha + self.log_debug("Solvemedia Captcha URL: %s" % urlparse.urljoin(self.pyfile.url, m3.group(1))) + + solvemedia = SolveMedia(self) + captcha_key = solvemedia.detect_key() + + if captcha_key: + response, challenge = solvemedia.challenge(captcha_key) + self.site_with_links = self.load(self.pyfile.url, + post={'adcopy_response' : response, + 'adcopy_challenge' : challenge}) + + elif m4: #: Keycaptcha captcha + self.log_debug("Keycaptcha Captcha URL: %s unsupported, retrying" % m4.group(1)) + self.retry() - if captcha_key: - response, challenge = recaptcha.challenge(captcha_key) - self.site_with_links = self.load(self.pyfile.url, - post={'g-recaptcha-response': response}) else: - self.log_info(_("No captcha found")) - self.site_with_links = self.html + recaptcha = ReCaptcha(self) + captcha_key = recaptcha.detect_key() + + if captcha_key: + try: + response, challenge = recaptcha.challenge(captcha_key) + + except Exception: + self.retry_captcha() + + self.site_with_links = self.load(self.pyfile.url, + post={'g-recaptcha-response': response}) + else: + self.log_info(_("Unknown captcha found, retrying")) + self.retry() + + if re.search(self.CAPTCHA_PATTERN, self.site_with_links): + self.retry_captcha() + + else: + self.log_info(_("No captcha found")) + self.site_with_links = self.html - if "recaptcha_image" in self.site_with_links or "data-sitekey" in self.site_with_links: - self.captcha.invalid() - self.retry() def handle_dlc_container(self): - dlc = re.findall(self.DLC_LINK_PATTERN, self.site_with_links) + dlcs = re.findall(self.DLC_LINK_PATTERN, self.site_with_links) - if not dlc: + if not dlcs: return - for i in dlc: - self.links.append("%s/DLC/%s.dlc" % (self.base_url, i)) + for _dlc in dlcs: + self.links.append(urlparse.urljoin(self.pyfile.url, "/DLC/%s.dlc" % _dlc)) def handle_weblinks(self): try: - weblinks = re.findall(self.WEBLINK_PATTERN, self.site_with_links) + links = re.findall(self.WEBLINK_PATTERN, self.site_with_links) - for link in weblinks: - res = self.load("%s/Link/%s.html" % (self.base_url, link)) + for _link in links: + res = self.load(urlparse.urljoin(self.pyfile.url, "/Link/%s.html" % _link)) link2 = re.search('<iframe noresize src="(.*)"></iframe>', res) - res2 = self.load(link2.group(1), just_header=True) - self.links.append(res2['location']) + if link2: + res2 = self.load(link2.group(1), just_header=True) + self.links.append(res2['location']) except Exception, e: self.log_debug("Error decrypting weblinks: %s" % e) diff --git a/module/plugins/crypter/FreakhareComFolder.py b/module/plugins/crypter/FreakhareComFolder.py index f7f1946f4..e939fe467 100644 --- a/module/plugins/crypter/FreakhareComFolder.py +++ b/module/plugins/crypter/FreakhareComFolder.py @@ -29,7 +29,7 @@ class FreakhareComFolder(SimpleCrypter): def load_page(self, page_n): if not hasattr(self, 'f_id') and not hasattr(self, 'f_md5'): m = re.search(r'http://freakshare.com/\?x=folder&f_id=(\d+)&f_md5=(\w+)', self.html) - if m: + if m is not None: self.f_id = m.group(1) self.f_md5 = m.group(2) return self.load('http://freakshare.com/', get={'x': 'folder', diff --git a/module/plugins/crypter/Go4UpCom.py b/module/plugins/crypter/Go4UpCom.py index 026982014..2d423a1a9 100644..100755 --- a/module/plugins/crypter/Go4UpCom.py +++ b/module/plugins/crypter/Go4UpCom.py @@ -4,18 +4,20 @@ import re import urlparse from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +import json class Go4UpCom(SimpleCrypter): __name__ = "Go4UpCom" __type__ = "crypter" - __version__ = "0.13" + __version__ = "0.14" __status__ = "testing" __pattern__ = r'http://go4up\.com/(dl/\w{12}|rd/\w{12}/\d+)' __config__ = [("use_premium" , "bool", "Use premium account if available" , True), ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] + ("subfolder_per_pack", "bool", "Create a subfolder for each package", True), + ("preferred_hoster" , "int" , "Id of preferred hoster or 0 for all", 0)] __description__ = """Go4Up.com decrypter plugin""" __license__ = "GPLv3" @@ -32,19 +34,20 @@ class Go4UpCom(SimpleCrypter): def get_links(self): links = [] - - m = re.search(r'(/download/gethosts/.+?)"', self.html) - if m: - self.html = self.load(urlparse.urljoin("http://go4up.com/", m.group(1))) - pages = [self.load(url) for url in re.findall(self.LINK_PATTERN, self.html)] - else: - pages = [self.html] - - for html in pages: - try: - links.append(re.search(r'<b><a href="(.+?)"', html).group(1)) - except Exception: - continue + preference = self.get_config("preferred_hoster") + + hosterslink_re = re.search(r'(/download/gethosts/.+?)"', self.html) + if hosterslink_re: + hosters = self.load(urlparse.urljoin("http://go4up.com/", hosterslink_re.group(1))) + for hoster in json.loads(hosters): + if preference != 0 and preference != int(hoster["hostId"]): + continue + pagelink_re = re.search(self.LINK_PATTERN, hoster["link"]) + if pagelink_re: + page = self.load(pagelink_re.group(1)) + link_re = re.search(r'<b><a href="(.+?)"', page) + if link_re: + links.append(link_re.group(1)) return links diff --git a/module/plugins/crypter/GoogledriveComFolder.py b/module/plugins/crypter/GoogledriveComFolder.py index 88c7ebab2..e7a5bae2c 100644 --- a/module/plugins/crypter/GoogledriveComFolder.py +++ b/module/plugins/crypter/GoogledriveComFolder.py @@ -6,11 +6,11 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo class GoogledriveComFolder(SimpleCrypter): __name__ = "GoogledriveCom" __type__ = "crypter" - __version__ = "0.02" + __version__ = "0.03" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?drive\.google\.com/folderview\?.*id=\w+' - __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), #: Overrides pyload.config['general']['folder_per_package'] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] __description__ = """Drive.google.com folder decrypter plugin""" diff --git a/module/plugins/crypter/LinkCryptWs.py b/module/plugins/crypter/LinkCryptWs.py index af13f55f6..d61c9d3dd 100644 --- a/module/plugins/crypter/LinkCryptWs.py +++ b/module/plugins/crypter/LinkCryptWs.py @@ -14,7 +14,7 @@ from module.utils import html_unescape class LinkCryptWs(Crypter): __name__ = "LinkCryptWs" __type__ = "crypter" - __version__ = "0.10" + __version__ = "0.12" __status__ = "testing" __pattern__ = r'http://(?:www\.)?linkcrypt\.ws/(dir|container)/(?P<ID>\w+)' @@ -31,7 +31,6 @@ class LinkCryptWs(Crypter): def setup(self): - self.captcha = False self.links = [] self.sources = ['cnl', 'web', 'dlc', 'rsdf', 'ccf'] @@ -45,6 +44,7 @@ class LinkCryptWs(Crypter): #: Request package self.req.http.c.setopt(pycurl.USERAGENT, "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko") #: Better chance to not get those key-captchas self.html = self.load(self.pyfile.url) + self.html = self.load(self.pyfile.url) def decrypt(self, pyfile): @@ -60,7 +60,6 @@ class LinkCryptWs(Crypter): self.retry(8, 15, _("Can't handle Key-Captcha")) if self.is_captcha_protected(): - self.captcha = True self.unlock_captcha_protection() self.handle_captcha_errors() @@ -154,23 +153,21 @@ class LinkCryptWs(Crypter): unrarpw = sitein[indexi:indexe] - if not (unrarpw == "Password" or "Dateipasswort") : + if unrarpw not in ("Password", "Dateipasswort"): self.log_debug("File password set to: [%s]"% unrarpw) self.pyfile.package().password = unrarpw def handle_errors(self): if self.is_password_protected(): - self.fail(_("Incorrect password")) + self.fail(_("Wrong password")) def handle_captcha_errors(self): - if self.captcha: - if "Your choice was wrong!" in self.html: - self.captcha.invalid() - self.retry() - else: - self.captcha.correct() + if "Your choice was wrong" in self.html: + self.retry_captcha() + else: + self.captcha.correct() def handle_link_source(self, type): @@ -246,7 +243,7 @@ class LinkCryptWs(Crypter): if not clink: continue - self.log_debug("clink avaible") + self.log_debug("clink found") package_name, folder_name = self.get_package_info() self.log_debug("Added package with name %s.%s and container link %s" %( package_name, type, clink.group(1))) @@ -268,13 +265,14 @@ class LinkCryptWs(Crypter): break if cnl_line: - self.log_debug("cnl_line gefunden") + self.log_debug("cnl_line found") try: cnl_section = self.handle_javascript(cnl_line) (vcrypted, vjk) = self._get_cipher_params(cnl_section) for (crypted, jk) in zip(vcrypted, vjk): package_links.extend(self._get_links(crypted, jk)) + except Exception: self.log_error(_("Unable to decrypt CNL links (JS Error) try to get over links")) return self.handle_web_links() diff --git a/module/plugins/crypter/LinkdecrypterCom.py b/module/plugins/crypter/LinkdecrypterCom.py index d8812dbd5..c16ec0b6e 100644 --- a/module/plugins/crypter/LinkdecrypterCom.py +++ b/module/plugins/crypter/LinkdecrypterCom.py @@ -8,7 +8,7 @@ from module.plugins.internal.MultiCrypter import MultiCrypter class LinkdecrypterCom(MultiCrypter): __name__ = "LinkdecrypterCom" __type__ = "crypter" - __version__ = "0.32" + __version__ = "0.33" __status__ = "testing" __pattern__ = r'^unmatchable$' @@ -28,7 +28,6 @@ class LinkdecrypterCom(MultiCrypter): def setup(self): - self.password = self.get_password() self.req.setOption("timeout", 300) @@ -40,11 +39,11 @@ class LinkdecrypterCom(MultiCrypter): while retries: m = re.search(self.TEXTAREA_PATTERN, self.html, re.S) - if m: + if m is not None: self.urls = [x for x in m.group(1).splitlines() if '[LINK-ERROR]' not in x] m = re.search(self.CAPTCHA_PATTERN, self.html) - if m: + if m is not None: captcha_url = 'http://linkdecrypter.com/' + m.group(1) result_type = "positional" if "getPos" in m.group(2) else "textual" @@ -61,7 +60,8 @@ class LinkdecrypterCom(MultiCrypter): elif self.PASSWORD_PATTERN in self.html: if self.password: self.log_info(_("Password protected link")) - self.html = self.load('http://linkdecrypter.com/', post={'password': self.password}) + self.html = self.load('http://linkdecrypter.com/', + post={'password': self.get_password()}) else: self.fail(_("Missing password")) diff --git a/module/plugins/crypter/LixIn.py b/module/plugins/crypter/LixIn.py index 2d26564e8..ecc92a8d3 100644 --- a/module/plugins/crypter/LixIn.py +++ b/module/plugins/crypter/LixIn.py @@ -43,16 +43,13 @@ class LixIn(Crypter): self.error(_("Link doesn't seem valid")) m = re.search(self.CAPTCHA_PATTERN, self.html) - if m: - for _i in xrange(5): - m = re.search(self.CAPTCHA_PATTERN, self.html) - if m: - self.log_debug("Trying captcha") - captcharesult = self.captcha.decrypt(urlparse.urljoin("http://lix.in/", m.group(1))) - self.html = self.load(url, - post={'capt': captcharesult, 'submit': "submit", 'tiny': id}) - else: - self.log_debug("No captcha/captcha solved") + if m is not None: + captcharesult = self.captcha.decrypt(urlparse.urljoin("http://lix.in/", m.group(1))) + self.html = self.load(url, post={'capt': captcharesult, 'submit': "submit", 'tiny': id}) + + if re.search(self.CAPTCHA_PATTERN, self.html): + self.fail(_("No captcha solved")) + else: self.html = self.load(url, post={'submit': "submit", 'tiny': id}) diff --git a/module/plugins/crypter/MediafireComFolder.py b/module/plugins/crypter/MediafireComFolder.py index 81d880725..f90bc04ea 100644 --- a/module/plugins/crypter/MediafireComFolder.py +++ b/module/plugins/crypter/MediafireComFolder.py @@ -33,13 +33,13 @@ class MediafireComFolder(Crypter): #: Load and parse html html = self.load(pyfile.url) m = re.search(self.LINK_PATTERN, html) - if m: + if m is not None: #: File page self.urls.append("http://www.mediafire.com/file/%s" % m.group(1)) else: #: Folder page m = re.search(self.FOLDER_KEY_PATTERN, html) - if m: + if m is not None: folder_key = m.group(1) self.log_debug("FOLDER KEY: %s" % folder_key) diff --git a/module/plugins/crypter/MultiUpOrg.py b/module/plugins/crypter/MultiUpOrg.py index b4326b679..fb228c3cd 100644 --- a/module/plugins/crypter/MultiUpOrg.py +++ b/module/plugins/crypter/MultiUpOrg.py @@ -9,10 +9,10 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo class MultiUpOrg(SimpleCrypter): __name__ = "MultiUpOrg" __type__ = "crypter" - __version__ = "0.04" + __version__ = "0.05" __status__ = "testing" - __pattern__ = r'http://(?:www\.)?multiup\.org/(en|fr)/(?P<TYPE>project|download|miror)/\w+(/\w+)?' + __pattern__ = r'http://(?:www\.)?multiup\.org/(en|fr)/(?P<TYPE>project|download|mirror)/\w+(/\w+)?' __config__ = [("use_premium" , "bool", "Use premium account if available" , True), ("use_subfolder" , "bool", "Save package to subfolder" , True), ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] @@ -34,8 +34,8 @@ class MultiUpOrg(SimpleCrypter): pattern = r'style="width:97%;text-align:left".*\n.*href="(.*)"' if m_type == "download": dl_pattern = r'href="(.*)">.*\n.*<h5>DOWNLOAD</h5>' - miror_page = urlparse.urljoin("http://www.multiup.org", re.search(dl_pattern, self.html).group(1)) - self.html = self.load(miror_page) + mirror_page = urlparse.urljoin("http://www.multiup.org/", re.search(dl_pattern, self.html).group(1)) + self.html = self.load(mirror_page) return re.findall(pattern, self.html) diff --git a/module/plugins/crypter/MultiloadCz.py b/module/plugins/crypter/MultiloadCz.py index d9b6236be..72e9b3a8b 100644 --- a/module/plugins/crypter/MultiloadCz.py +++ b/module/plugins/crypter/MultiloadCz.py @@ -30,11 +30,11 @@ class MultiloadCz(Crypter): if re.match(self.__pattern__, pyfile.url).group(1) == "slozka": m = re.search(self.FOLDER_PATTERN, self.html) - if m: + if m is not None: self.urls.extend(m.group(1).split()) else: m = re.findall(self.LINK_PATTERN, self.html) - if m: + if m is not None: prefered_set = set(self.get_config('usedHoster').split('|')) self.urls.extend(x[1] for x in m if x[0] in prefered_set) diff --git a/module/plugins/crypter/NCryptIn.py b/module/plugins/crypter/NCryptIn.py index d483be323..dddffbbf2 100644 --- a/module/plugins/crypter/NCryptIn.py +++ b/module/plugins/crypter/NCryptIn.py @@ -121,7 +121,7 @@ class NCryptIn(Crypter): def get_package_info(self): m = re.search(self.NAME_PATTERN, self.html) - if m: + if m is not None: name = folder = m.group('N').strip() self.log_debug("Found name [%s] and folder [%s] in package info" % (name, folder)) else: @@ -177,13 +177,11 @@ class NCryptIn(Crypter): def handle_errors(self): if self.protection_type == "password": if "This password is invalid!" in self.cleaned_html: - self.log_debug("Incorrect password, please set right password on 'Edit package' form and retry") - self.fail(_("Incorrect password, please set right password on 'Edit package' form and retry")) + self.fail(_("Wrong password")) if self.protection_type == "captcha": - if "The securitycheck was wrong!" in self.cleaned_html: - self.captcha.invalid() - self.retry() + if "The securitycheck was wrong" in self.cleaned_html: + self.retry_captcha() else: self.captcha.correct() @@ -229,6 +227,7 @@ class NCryptIn(Crypter): (vcrypted, vjk) = self._get_cipher_params() for (crypted, jk) in zip(vcrypted, vjk): package_links.extend(self._get_links(crypted, jk)) + except Exception: self.fail(_("Unable to decrypt CNL2 links")) @@ -270,6 +269,7 @@ class NCryptIn(Crypter): url = link.replace("link-", "frame-") link = self.load(url, just_header=True)['location'] return link + except Exception, detail: self.log_debug("Error decrypting link %s, %s" % (link, detail)) diff --git a/module/plugins/crypter/RelinkUs.py b/module/plugins/crypter/RelinkUs.py index b3c13db5d..6d8383fee 100644 --- a/module/plugins/crypter/RelinkUs.py +++ b/module/plugins/crypter/RelinkUs.py @@ -154,7 +154,7 @@ class RelinkUs(Crypter): #: Try to get info from web m = re.search(self.FILE_TITLE_REGEX, self.html) - if m: + if m is not None: title = m.group(1).strip() if not self.FILE_NOTITLE in title: name = folder = title @@ -172,14 +172,11 @@ class RelinkUs(Crypter): def handle_errors(self): if self.PASSWORD_ERROR_ROKEN in self.html: - msg = "Incorrect password, please set right password on 'Edit package' form and retry" - self.log_debug(msg) - self.fail(_(msg)) + self.fail(_("Wrong password")) if self.captcha: if self.CAPTCHA_ERROR_ROKEN in self.html: - self.captcha.invalid() - self.retry() + self.retry_captcha() else: self.captcha.correct() @@ -199,14 +196,16 @@ class RelinkUs(Crypter): self.log_debug("Search for CNL2 links") package_links = [] m = re.search(self.CNL2_FORM_REGEX, self.html, re.S) - if m: + if m is not None: cnl2_form = m.group(1) try: (vcrypted, vjk) = self._get_cipher_params(cnl2_form) for (crypted, jk) in zip(vcrypted, vjk): package_links.extend(self._get_links(crypted, jk)) + except Exception: self.log_debug("Unable to decrypt CNL2 links") + return package_links @@ -214,7 +213,7 @@ class RelinkUs(Crypter): self.log_debug("Search for DLC links") package_links = [] m = re.search(self.DLC_LINK_REGEX, self.html) - if m: + if m is not None: container_url = self.DLC_DOWNLOAD_URL + "?id=%s&dlc=1" % self.fileid self.log_debug("Downloading DLC container link [%s]" % container_url) try: diff --git a/module/plugins/crypter/SafelinkingNet.py b/module/plugins/crypter/SafelinkingNet.py index e2b8471ab..29e1cce4f 100644 --- a/module/plugins/crypter/SafelinkingNet.py +++ b/module/plugins/crypter/SafelinkingNet.py @@ -47,24 +47,25 @@ class SafelinkingNet(Crypter): postData['link-password'] = self.get_password() if "altcaptcha" in self.html: - for _i in xrange(5): - m = re.search(self.SOLVEMEDIA_PATTERN, self.html) - if m: - captchaKey = m.group(1) - captcha = SolveMedia(self) - captchaProvider = "Solvemedia" - else: - self.fail(_("Error parsing captcha")) + m = re.search(self.SOLVEMEDIA_PATTERN, self.html) + if m is not None: + captchaKey = m.group(1) + captcha = SolveMedia(self) + captchaProvider = "Solvemedia" + else: + self.fail(_("Error parsing captcha")) + + response, challenge = captcha.challenge(captchaKey) + postData['adcopy_challenge'] = challenge + postData['adcopy_response'] = response + + self.html = self.load(url, post=postData) - response, challenge = captcha.challenge(captchaKey) - postData['adcopy_challenge'] = challenge - postData['adcopy_response'] = response + if "The CAPTCHA code you entered was wrong" in self.html: + self.retry_captcha() - self.html = self.load(url, post=postData) - if "The password you entered was incorrect" in self.html: - self.fail(_("Incorrect Password")) - if not "The CAPTCHA code you entered was wrong" in self.html: - break + if "The password you entered was incorrect" in self.html: + self.fail(_("Wrong password")) pyfile.package().password = "" soup = BeautifulSoup.BeautifulSoup(self.html) @@ -73,7 +74,7 @@ class SafelinkingNet(Crypter): if "d_links" in s.text: break m = re.search('d_links":(\[.*?\])', s.text) - if m: + if m is not None: linkDict = json_loads(m.group(1)) for link in linkDict: if not "http://" in link['full']: diff --git a/module/plugins/crypter/SexuriaCom.py b/module/plugins/crypter/SexuriaCom.py index 7942d5e42..24a5060b9 100644 --- a/module/plugins/crypter/SexuriaCom.py +++ b/module/plugins/crypter/SexuriaCom.py @@ -1,25 +1,23 @@ # -*- coding: utf-8 -*- import re - from module.plugins.internal.Crypter import Crypter - class SexuriaCom(Crypter): __name__ = "SexuriaCom" __type__ = "crypter" - __version__ = "0.04" + __version__ = "0.10" __status__ = "testing" __pattern__ = r'http://(?:www\.)?sexuria\.com/(v1/)?(Pornos_Kostenlos_.+?_(\d+)\.html|dl_links_\d+_\d+\.html|id=\d+\&part=\d+\&link=\d+)' - __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Sexuria.com decrypter plugin""" __license__ = "GPLv3" __authors__ = [("NETHead", "NETHead.AT.gmx.DOT.net")] - + #: Constants PATTERN_SUPPORTED_MAIN = r'http://(www\.)?sexuria\.com/(v1/)?Pornos_Kostenlos_.+?_(\d+)\.html' PATTERN_SUPPORTED_CRYPT = r'http://(www\.)?sexuria\.com/(v1/)?dl_links_\d+_(?P<ID>\d+)\.html' PATTERN_SUPPORTED_REDIRECT = r'http://(www\.)?sexuria\.com/out\.php\?id=(?P<ID>\d+)\&part=\d+\&link=\d+' @@ -27,15 +25,17 @@ class SexuriaCom(Crypter): PATTERN_PASSWORD = r'<strong>Passwort: </strong></div></td>.*?bgcolor="#EFEFEF">(?P<PWD>.*?)</td>' PATTERN_DL_LINK_PAGE = r'"(dl_links_\d+_\d+\.html)"' PATTERN_REDIRECT_LINKS = r'value="(http://sexuria\.com/out\.php\?id=\d+\&part=\d+\&link=\d+)" readonly' - + LIST_PWDIGNORE = ["Kein Passwort", "-"] def decrypt(self, pyfile): #: Init self.pyfile = pyfile self.package = pyfile.package() - #: Get package links + #: Decrypt and add links package_name, self.links, folder_name, package_pwd = self.decrypt_links(self.pyfile.url) + if package_pwd: + self.pyfile.package().password = package_pwd self.packages = [(package_name, self.links, folder_name)] @@ -62,34 +62,45 @@ class SexuriaCom(Crypter): #: Extract info from main file id = re.search(self.PATTERN_SUPPORTED_CRYPT, url, re.I).group('ID') html = self.load("http://sexuria.com/v1/Pornos_Kostenlos_info_%s.html" % id) + #: Webpage title / Package name + titledata = re.search(self.PATTERN_TITLE, html, re.I) + if not titledata: + self.log_warning("No title data found, has site changed?") + else: + title = titledata.group('TITLE').strip() + if title: + name = folder = title + self.log_debug("Package info found, name [%s] and folder [%s]" % (name, folder)) + #: Password + pwddata = re.search(self.PATTERN_PASSWORD, html, re.I | re.S) + if not pwddata: + self.log_warning("No password data found, has site changed?") + else: + pwd = pwddata.group('PWD').strip() + if pwd and not (pwd in self.LIST_PWDIGNORE): + password = pwd + self.log_debug("Package info found, password [%s]" % password) - title = re.search(self.PATTERN_TITLE, html, re.I).group('TITLE').strip() - if title: - name = folder = title - self.log_debug("Package info found, name [%s] and folder [%s]" % (name, folder)) - - pwd = re.search(self.PATTERN_PASSWORD, html, re.I | re.S).group('PWD') - if pwd and pwd not in ("Kein Passwort", "-"): - password = pwd.strip() - self.log_debug("Password info [%s] found" % password) - - #: Process link (dl_link) + #: Process links (dl_link) html = self.load(url) links = re.findall(self.PATTERN_REDIRECT_LINKS, html, re.I) - if len(links) == 0: + if not links: self.log_error(_("Broken for link: %s") % link) else: for link in links: link = link.replace("http://sexuria.com/", "http://www.sexuria.com/") finallink = self.load(link, just_header=True)['location'] - if not finallink or "sexuria.com/" in finallink: + if not finallink or ("sexuria.com/" in finallink): self.log_error(_("Broken for link: %s") % link) else: linklist.append(finallink) - #: Debug log - self.log_debug("%d supported links" % len(linklist)) - for i, link in enumerate(linklist): - self.log_debug("Supported link %d, %s" % (i + 1, link)) + #: Log result + if not linklist: + self.fail(_("Unable to extract links (maybe plugin out of date?)")) + else: + for i, link in enumerate(linklist): + self.log_debug("Supported link %d/%d: %s" % (i+1, len(linklist), link)) + #: All done, return to caller return name, linklist, folder, password diff --git a/module/plugins/crypter/ShSt.py b/module/plugins/crypter/ShSt.py index 754bc542c..43cc4e779 100644 --- a/module/plugins/crypter/ShSt.py +++ b/module/plugins/crypter/ShSt.py @@ -9,7 +9,7 @@ import re class ShSt(Crypter): __name__ = "ShSt" __type__ = "crypter" - __version__ = "0.04" + __version__ = "0.05" __status__ = "testing" __pattern__ = r'http://sh\.st/\w+' @@ -19,7 +19,7 @@ class ShSt(Crypter): __authors__ = [("Frederik Möllers", "fred-public@posteo.de")] - NAME_PATTERN = r'<title>(?P<N>.+?) - .+</title>' + NAME_PATTERN = r'<title>(?P<N>.+?) -' def decrypt(self, pyfile): diff --git a/module/plugins/crypter/ShareLinksBiz.py b/module/plugins/crypter/ShareLinksBiz.py index 6fbe59b38..e372d7c6a 100644 --- a/module/plugins/crypter/ShareLinksBiz.py +++ b/module/plugins/crypter/ShareLinksBiz.py @@ -10,7 +10,7 @@ from module.plugins.internal.Crypter import Crypter class ShareLinksBiz(Crypter): __name__ = "ShareLinksBiz" __type__ = "crypter" - __version__ = "1.16" + __version__ = "1.18" __status__ = "testing" __pattern__ = r'http://(?:www\.)?(share-links|s2l)\.biz/(?P<ID>_?\w+)' @@ -66,10 +66,18 @@ class ShareLinksBiz(Crypter): def init_file(self, pyfile): url = pyfile.url + if 's2l.biz' in url: url = self.load(url, just_header=True)['location'] - self.base_url = "http://www.%s.biz" % re.match(self.__pattern__, url).group(1) - self.file_id = re.match(self.__pattern__, url).group('ID') + + if re.match(self.__pattern__, url): + self.base_url = "http://www.%s.biz" % re.match(self.__pattern__, url).group(1) + self.file_id = re.match(self.__pattern__, url).group('ID') + + else: + self.log_debug("Could not initialize, URL [%s] does not match pattern [%s]" % (url, self.__pattern__)) + self.fail(_("Unsupported download link")) + self.package = pyfile.package() @@ -77,7 +85,8 @@ class ShareLinksBiz(Crypter): if "No usable content was found" in self.html: self.log_debug("File not found") return False - return True + else: + return True def is_password_protected(self): @@ -114,7 +123,11 @@ class ShareLinksBiz(Crypter): self.log_debug("Captcha map with [%d] positions" % len(captchaMap.keys())) #: Request user for captcha coords - m = re.search(r'<img src="/captcha.gif\?d=(.*?)&PHPSESSID=(.*?)&legend=1"', self.html) + m = re.search(r'<img src="/captcha.gif\?d=(.+?)&PHPSESSID=(.+?)&legend=1"', self.html) + if not m: + self.log_debug("Captcha url data not found, maybe plugin out of date?") + self.fail(_("Captcha url data not found")) + captchaUrl = self.base_url + '/captcha.gif?d=%s&PHPSESSID=%s' % (m.group(1), m.group(2)) self.log_debug("Waiting user for correct position") coords = self.captcha.decrypt(captchaUrl, input_type="gif", output_type='positional') @@ -123,8 +136,8 @@ class ShareLinksBiz(Crypter): #: Resolve captcha href = self._resolve_coords(coords, captchaMap) if href is None: - self.captcha.invalid() - self.retry(wait_time=5) + self.retry_captcha(wait=5) + url = self.base_url + href self.html = self.load(url) @@ -148,13 +161,11 @@ class ShareLinksBiz(Crypter): def handle_errors(self): if "The inserted password was wrong" in self.html: - self.log_debug("Incorrect password, please set right password on 'Edit package' form and retry") - self.fail(_("Incorrect password, please set right password on 'Edit package' form and retry")) + self.fail(_("Wrong password")) if self.captcha: if "Your choice was wrong" in self.html: - self.captcha.invalid() - self.retry(wait_time=5) + self.retry_captcha(wait=5) else: self.captcha.correct() @@ -165,7 +176,7 @@ class ShareLinksBiz(Crypter): #: Extract from web package header title_re = r'<h2><img.*?/>(.*)</h2>' m = re.search(title_re, self.html, re.S) - if m: + if m is not None: title = m.group(1).strip() if 'unnamed' not in title: name = folder = title @@ -209,8 +220,10 @@ class ShareLinksBiz(Crypter): self.log_debug("JsEngine returns value [%s] for redirection link" % dlLink) package_links.append(dlLink) + except Exception, detail: self.log_debug("Error decrypting Web link [%s], %s" % (ID, detail)) + return package_links @@ -235,8 +248,10 @@ class ShareLinksBiz(Crypter): try: (crypted, jk) = self._get_cipher_params() package_links.extend(self._get_links(crypted, jk)) + except Exception: self.fail(_("Unable to decrypt CNL2 links")) + return package_links diff --git a/module/plugins/crypter/TNTVillageScambioeticoOrg.py b/module/plugins/crypter/TNTVillageScambioeticoOrg.py index 6ba1ee19b..e85a8fbb7 100644 --- a/module/plugins/crypter/TNTVillageScambioeticoOrg.py +++ b/module/plugins/crypter/TNTVillageScambioeticoOrg.py @@ -6,11 +6,11 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo class TNTVillageScambioeticoOrg(SimpleCrypter): __name__ = "TNTVillageScambioeticoOrg" __type__ = "crypter" - __version__ = "0.02" + __version__ = "0.03" __status__ = "testing" __pattern__ = r'http://(?:www\.)?forum\.tntvillage\.scambioetico\.org/index\.php\?.*showtopic=\d+' - __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), #: Overrides pyload.config['general']['folder_per_package'] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] __description__ = """TNTVillage.scambioetico.org decrypter plugin""" diff --git a/module/plugins/crypter/UlozToFolder.py b/module/plugins/crypter/UlozToFolder.py index 19569ef31..f2d0e7c17 100644 --- a/module/plugins/crypter/UlozToFolder.py +++ b/module/plugins/crypter/UlozToFolder.py @@ -36,7 +36,7 @@ class UlozToFolder(Crypter): new_links.extend(re.findall(self.LINK_PATTERN, m.group(1))) m = re.search(self.NEXT_PAGE_PATTERN, html) - if m: + if m is not None: html = self.load("http://ulozto.net/" + m.group(1)) else: break diff --git a/module/plugins/crypter/UploadedToFolder.py b/module/plugins/crypter/UploadedToFolder.py index 381d744fe..53fb5e4b9 100644 --- a/module/plugins/crypter/UploadedToFolder.py +++ b/module/plugins/crypter/UploadedToFolder.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- import re -import urlparse from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo diff --git a/module/plugins/crypter/XFileSharingProFolder.py b/module/plugins/crypter/XFileSharingProFolder.py index 584cc7668..f693698bc 100644 --- a/module/plugins/crypter/XFileSharingProFolder.py +++ b/module/plugins/crypter/XFileSharingProFolder.py @@ -8,7 +8,7 @@ from module.plugins.internal.XFSCrypter import XFSCrypter, create_getInfo class XFileSharingProFolder(XFSCrypter): __name__ = "XFileSharingProFolder" __type__ = "crypter" - __version__ = "0.13" + __version__ = "0.14" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(?:\w+\.)*?(?P<DOMAIN>(?:[\d.]+|[\w\-^_]{3,}(?:\.[a-zA-Z]{2,}){1,2})(?:\:\d+)?)/(?:user|folder)s?/\w+' @@ -23,7 +23,7 @@ class XFileSharingProFolder(XFSCrypter): def _log(self, level, plugintype, pluginname, messages): return super(XFileSharingProFolder, self)._log(level, plugintype, - "%s: %s" % (pluginname, self.HOSTER_NAME), + "%s: %s" % (pluginname, self.PLUGIN_NAME), messages) @@ -32,18 +32,18 @@ class XFileSharingProFolder(XFSCrypter): self.__pattern__ = self.pyload.pluginManager.crypterPlugins[self.__name__]['pattern'] - self.HOSTER_DOMAIN = re.match(self.__pattern__, self.pyfile.url).group("DOMAIN").lower() - self.HOSTER_NAME = "".join(part.capitalize() for part in re.split(r'(\.|\d+|\-)', self.HOSTER_DOMAIN) if part != '.') + self.PLUGIN_DOMAIN = re.match(self.__pattern__, self.pyfile.url).group("DOMAIN").lower() + self.PLUGIN_NAME = "".join(part.capitalize() for part in re.split(r'(\.|\d+|\-)', self.PLUGIN_DOMAIN) if part != '.') def _setup(self): - account_name = self.__name__ if self.account.HOSTER_DOMAIN is None else self.HOSTER_NAME + account_name = self.__name__ if self.account.PLUGIN_DOMAIN is None else self.PLUGIN_NAME self.chunk_limit = 1 self.multiDL = True if self.account: - self.req = self.pyload.requestFactory.getRequest(accountname, self.user) - self.premium = self.account.is_premium(self.user) + self.req = self.pyload.requestFactory.getRequest(accountname, self.account.user) + self.premium = self.account.premium self.resume_download = self.premium else: self.req = self.pyload.requestFactory.getRequest(account_name) @@ -56,19 +56,19 @@ class XFileSharingProFolder(XFSCrypter): self.req.close() if not self.account: - self.account = self.pyload.accountManager.getAccountPlugin(self.HOSTER_NAME) + self.account = self.pyload.accountManager.getAccountPlugin(self.PLUGIN_NAME) if not self.account: self.account = self.pyload.accountManager.getAccountPlugin(self.__name__) if self.account: - if not self.account.HOSTER_DOMAIN: - self.account.HOSTER_DOMAIN = self.HOSTER_DOMAIN + if not self.account.PLUGIN_DOMAIN: + self.account.PLUGIN_DOMAIN = self.PLUGIN_DOMAIN - if not self.user: - self.user = self.account.select()[0] + if not self.account.user: #@TODO: Move to `Account` in 0.4.10 + self.account.user = self.account.select()[0] - if not self.user or not self.account.is_logged(self.user, True): + if not self.account.logged: self.account = False |