diff options
Diffstat (limited to 'module/plugins/crypter/LixIn.py')
| -rw-r--r-- | module/plugins/crypter/LixIn.py | 72 | 
1 files changed, 38 insertions, 34 deletions
diff --git a/module/plugins/crypter/LixIn.py b/module/plugins/crypter/LixIn.py index 619a474f2..d899d58c7 100644 --- a/module/plugins/crypter/LixIn.py +++ b/module/plugins/crypter/LixIn.py @@ -6,53 +6,57 @@ from module.plugins.Crypter import Crypter  class LixIn(Crypter): -    __name__ = "LixIn" -    __type__ = "crypter" -    __pattern__ = r'http://(www.)?lix.in/(?P<id>.*)' +    __name__    = "LixIn" +    __type__    = "crypter"      __version__ = "0.22" + +    __pattern__ = r'http://(?:www\.)?lix\.in/(?P<ID>.+)' +    __config__  = [("use_subfolder", "bool", "Save package to subfolder", True), +                   ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] +      __description__ = """Lix.in decrypter plugin""" -    __author_name__ = "spoob" -    __author_mail__ = "spoob@pyload.org" +    __license__     = "GPLv3" +    __authors__     = [("spoob", "spoob@pyload.org")] + + +    CAPTCHA_PATTERN = r'<img src="(captcha_img\.php\?.*?)"' +    SUBMIT_PATTERN = r'value=\'continue.*?\'' +    LINK_PATTERN = r'name="ifram" src="(.*?)"' -    CAPTCHA_PATTERN = '<img src="(?P<image>captcha_img.php\?.*?)"' -    SUBMIT_PATTERN = r"value='continue.*?'" -    LINK_PATTERN = r'name="ifram" src="(?P<link>.*?)"'      def decrypt(self, pyfile):          url = pyfile.url -        matches = re.match(self.__pattern__, url) -        if not matches: -            self.fail("couldn't identify file id") +        m = re.match(self.__pattern__, url) +        if m is None: +            self.error(_("Unable to identify file ID")) -        id = matches.group("id") +        id = m.group('ID')          self.logDebug("File id is %s" % id) -        self.html = self.req.load(url, decode=True) +        self.html = self.load(url, decode=True) -        matches = re.search(self.SUBMIT_PATTERN, self.html) -        if not matches: -            self.fail("link doesn't seem valid") +        m = re.search(self.SUBMIT_PATTERN, self.html) +        if m is None: +            self.error(_("Link doesn't seem valid")) -        matches = re.search(self.CAPTCHA_PATTERN, self.html) -        if matches: -            for _ in xrange(5): -                matches = re.search(self.CAPTCHA_PATTERN, self.html) -                if matches: -                    self.logDebug("trying captcha") -                    captcharesult = self.decryptCaptcha("http://lix.in/" + matches.group("image")) -                self.html = self.req.load(url, decode=True, +        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.logDebug("Trying captcha") +                    captcharesult = self.decryptCaptcha("http://lix.in/" + m.group(1)) +                self.html = self.load(url, decode=True,                                            post={"capt": captcharesult, "submit": "submit", "tiny": id})              else: -                self.logDebug("no captcha/captcha solved") +                self.logDebug("No captcha/captcha solved")          else: -            self.html = self.req.load(url, decode=True, post={"submit": "submit", "tiny": id}) +            self.html = self.load(url, decode=True, post={"submit": "submit", "tiny": id}) -        matches = re.search(self.LINK_PATTERN, self.html) -        if not matches: -            self.fail("can't find destination url") - -        new_link = matches.group("link") -        self.logDebug("Found link %s, adding to package" % new_link) - -        self.packages.append((pyfile.package().name, [new_link], pyfile.package().name)) +        m = re.search(self.LINK_PATTERN, self.html) +        if m is None: +            self.error(_("Unable to find destination url")) +        else: +            self.urls = [m.group(1)] +            self.logDebug("Found link %s, adding to package" % self.urls[0])  | 
