diff options
author | Walter Purcaro <vuolter@gmail.com> | 2015-02-16 10:46:28 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2015-02-16 10:46:28 +0100 |
commit | ce1c2b6b05c08b669357947e61ae40efce7fc50f (patch) | |
tree | 0b5f7996960cf35c4eface53a89eba18a37519b7 /module/plugins/crypter/SafelinkingNet.py | |
parent | Fix filename case (diff) | |
download | pyload-ce1c2b6b05c08b669357947e61ae40efce7fc50f.tar.xz |
module temp
Diffstat (limited to 'module/plugins/crypter/SafelinkingNet.py')
-rw-r--r-- | module/plugins/crypter/SafelinkingNet.py | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/module/plugins/crypter/SafelinkingNet.py b/module/plugins/crypter/SafelinkingNet.py new file mode 100644 index 000000000..c466d8bb6 --- /dev/null +++ b/module/plugins/crypter/SafelinkingNet.py @@ -0,0 +1,79 @@ +# -*- coding: utf-8 -*- + +import re + +from BeautifulSoup import BeautifulSoup + +from pyload.utils import json_loads +from pyload.plugin.Crypter import Crypter +from pyload.plugin.internal.captcha import SolveMedia + + +class SafelinkingNet(Crypter): + __name__ = "SafelinkingNet" + __type__ = "crypter" + __version__ = "0.11" + + __pattern__ = r'https?://(?:www\.)?safelinking\.net/([pd])/\w+' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + + __description__ = """Safelinking.net decrypter plugin""" + __license__ = "GPLv3" + __authors__ = [("quareevo", "quareevo@arcor.de")] + + + SOLVEMEDIA_PATTERN = "solvemediaApiKey = '([\w.-]+)';" + + + def decrypt(self, pyfile): + url = pyfile.url + + if re.match(self.__pattern__, url).group(1) == "d": + + header = self.load(url, just_header=True) + if 'location' in header: + self.urls = [header['location']] + else: + self.error(_("Couldn't find forwarded Link")) + + else: + postData = {"post-protect": "1"} + + if "link-password" in self.html: + postData['link-password'] = self.getPassword() + + 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")) + + challenge, response = captcha.challenge(captchaKey) + postData['adcopy_challenge'] = challenge + postData['adcopy_response'] = response + + 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 + + pyfile.package().password = "" + soup = BeautifulSoup(self.html) + scripts = soup.findAll("script") + for s in scripts: + if "d_links" in s.text: + break + m = re.search('d_links":(\[.*?\])', s.text) + if m: + linkDict = json_loads(m.group(1)) + for link in linkDict: + if not "http://" in link['full']: + self.urls.append("https://safelinking.net/d/" + link['full']) + else: + self.urls.append(link['full']) |