diff options
| author | 2011-06-29 11:50:46 +0200 | |
|---|---|---|
| committer | 2011-06-29 11:50:46 +0200 | |
| commit | b1a2e1908f45bc6a523770ae9d10cd28cb71c2dc (patch) | |
| tree | 3fd84687b29892d2a127834c0a9a8579a972bd24 /module | |
| parent | thrift 0.7.0 from trunk, patched for low mem usage (diff) | |
| download | pyload-b1a2e1908f45bc6a523770ae9d10cd28cb71c2dc.tar.xz | |
fix #349 add captcha support
Diffstat (limited to 'module')
| -rw-r--r-- | module/plugins/crypter/LixIn.py | 61 | 
1 files changed, 44 insertions, 17 deletions
| diff --git a/module/plugins/crypter/LixIn.py b/module/plugins/crypter/LixIn.py index 168be2c27..b9fd28a34 100644 --- a/module/plugins/crypter/LixIn.py +++ b/module/plugins/crypter/LixIn.py @@ -8,27 +8,54 @@ from module.plugins.Crypter import Crypter  class LixIn(Crypter):      __name__ = "LixIn"      __type__ = "container" -    __pattern__ = r"http://(www.)?lix.in/" -    __version__ = "0.1" +    __pattern__ = r"http://(www.)?lix.in/(?P<id>.*)" +    __version__ = "0.2"      __description__ = """Lix.in Container Plugin"""      __author_name__ = ("spoob")      __author_mail__ = ("spoob@pyload.org") +     +    CAPTCHA_PATTERN='<img src="(?P<image>captcha_img.php\?PHPSESSID=.*?)"' +    SUBMIT_PATTERN=r"value='continue .*?'" +    LINK_PATTERN=r'name="ifram" src="(?P<link>.*?)"' +     -    def __init__(self, parent): -        Crypter.__init__(self, parent) -        self.parent = parent -        self.html = None +    def decrypt(self, pyfile): +        url = pyfile.url +         +        matches = re.search(self.__pattern__,url) +        if not matches: +            self.fail("couldn't identify file id") +             +        id = matches.group("id") +        self.logDebug("File id is %s" % id) +         +        self.html = self.req.load(url, decode=True) +         +        matches = re.search(self.SUBMIT_PATTERN,self.html) +        if not matches: +	    self.fail("link doesn't seem valid") -    def file_exists(self): -        """ returns True or False -        """ -        return True +        matches = re.search(self.CAPTCHA_PATTERN, self.html) +        if matches: +            for i in range(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, post={"capt" : captcharesult, "submit":"submit","tiny":id}) +	        else: +	            self.logDebug("no captcha/captcha solved") +	            break +	else: +            self.html = self.req.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") -    def proceed(self, url, location): -        url = self.parent.url -        self.html = self.req.load(url) -        new_link = "" -        if not re.search("captcha_img.php", self.html): -            new_link = re.search(r".*<iframe  name=\"ifram\" src=\"(.*)\" marginwidth=\"0\".*", self.req.load(url, post={"submit" : "continue"})).group(1) +        new_link = matches.group("link") +        self.logDebug("Found link %s, adding to package" % new_link) -        self.links = [new_link] +        self.packages.append((self.pyfile.package().name, [new_link], self.pyfile.package().name)) +           
\ No newline at end of file | 
