diff options
| author | 2013-04-04 20:55:09 +0200 | |
|---|---|---|
| committer | 2013-04-04 20:55:09 +0200 | |
| commit | 0f984f7e3fea8d7fb111543a23e0f7f617c1a63c (patch) | |
| tree | 910ebb791fc35911181fed7c83cad05aea8451ed /module/plugins/hoster | |
| parent | DebridItaliaCom: + ability to detect offline files. (diff) | |
| download | pyload-0f984f7e3fea8d7fb111543a23e0f7f617c1a63c.tar.xz | |
PutlockerCom: code optimized and cleaned up
Diffstat (limited to 'module/plugins/hoster')
| -rw-r--r-- | module/plugins/hoster/PutlockerCom.py | 77 | 
1 files changed, 38 insertions, 39 deletions
| diff --git a/module/plugins/hoster/PutlockerCom.py b/module/plugins/hoster/PutlockerCom.py index e98e4d332..043adcb06 100644 --- a/module/plugins/hoster/PutlockerCom.py +++ b/module/plugins/hoster/PutlockerCom.py @@ -28,7 +28,7 @@ class PutlockerCom(SimpleHoster):      __name__ = "PutlockerCom"      __type__ = "hoster"      __pattern__ = r'http://(www\.)?putlocker\.com/(file|embed)/[A-Z0-9]+' -    __version__ = "0.22" +    __version__ = "0.23"      __description__ = """Putlocker.Com"""      __author_name__ = ("jeix", "stickell")      __author_mail__ = ("l.stickell@yahoo.it") @@ -39,43 +39,42 @@ class PutlockerCom(SimpleHoster):      def handleFree(self):          self.html = self.load(self.pyfile.url, decode=True) -        self.link = self._getLink() -        if not self.link.startswith('http://'): -            self.link = "http://www.putlocker.com" + self.link -        self.download(self.link, disposition=True) +        link = self._getLink() +        if not link.startswith('http://'): +            link = "http://www.putlocker.com" + link +        self.download(link, disposition=True)      def _getLink(self): -        self.hash = re.search("<input type=\"hidden\" value=\"([a-z0-9]+)\" name=\"hash\">", self.html) -        # if self.hash is None: -        # self.fail("%s: Plugin broken." % self.__name__) - -        self.param = "hash=" + self.hash.group(1) + "&confirm=Continue+as+Free+User" -        self.html2 = self.load(self.pyfile.url, post=self.param) -        if ">You have exceeded the daily stream limit for your country\\. You can wait until tomorrow" in self.html2 or "(>This content server has been temporarily disabled for upgrades|Try again soon\\. You can still download it below\\.<)" in self.html2: -            self.waittime = 2 * 60 * 60 -            self.retry(wait_time=self.waittime, reason="Waiting %s seconds" % self.waittime) - -        self.link = re.search( -            "<a href=\"/gopro\\.php\">Tired of ads and waiting\\? Go Pro\\!</a>[\t\n\rn ]+</div>[\t\n\rn ]+<a href=\"(/.*?)\"", -            self.html2) -        if self.link is None: -            self.link = re.search("\"(/get_file\\.php\\?download=[A-Z0-9]+\\&key=[a-z0-9]+)\"", self.html2) - -        if self.link is None: -            self.link = re.search("\"(/get_file\\.php\\?download=[A-Z0-9]+\\&key=[a-z0-9]+&original=1)\"", self.html2) - -        if self.link is None: -            self.link = re.search("\"(/get_file\\.php\\?id=[A-Z0-9]+\\&key=[A-Za-z0-9=]+\\&original=1)\"", self.html2) - -        if self.link is None: -            self.link = re.search("playlist: \\'(/get_file\\.php\\?stream=[A-Za-z0-9=]+)\\'", self.html2) -            if not self.link is None: -                self.html3 = self.load("http://www.putlocker.com" + self.link.group(1)) -                self.link = re.search("media:content url=\"(http://.*?)\"", self.html3) -                if self.link is None: -                    self.link = re.search("\"(http://media\\-b\\d+\\.putlocker\\.com/download/\\d+/.*?)\"", self.html3) - -                    # if link is None: -                    # self.fail("%s: Plugin broken." % self.__name__) - -        return self.link.group(1).replace("&", "&") +        hash_data = re.search(r'<input type="hidden" value="([a-z0-9]+)" name="hash">', self.html) +        if not hash_data: +            self.parseError('Unable to detect hash') + +        post_data = {"hash": hash_data.group(1), "confirm": "Continue+as+Free+User"} +        self.html = self.load(self.pyfile.url, post=post_data) +        if ">You have exceeded the daily stream limit for your country\\. You can wait until tomorrow" in self.html or \ +                        "(>This content server has been temporarily disabled for upgrades|Try again soon\\. You can still download it below\\.<)" in self.html: +            self.retry(wait_time=2 * 60 * 60, reason="Download limit exceeded or server disabled") + +        link = re.search(r'(/get_file\.php\?id=[A-Z0-9]+&key=[A-Za-z0-9=]+&original=1)', self.html) +        if not link: +            link = re.search(r"(/get_file\.php\?download=[A-Z0-9]+&key=[a-z0-9]+)", self.html) + +        if not link: +            link = re.search(r"(/get_file\.php\?download=[A-Z0-9]+&key=[a-z0-9]+&original=1)", self.html) + +        if not link: +            link = re.search( +                r'<a href="/gopro\.php">Tired of ads and waiting\? Go Pro!</a>[\t\n\rn ]+</div>[\t\n\rn ]+<a href="(/.*?)"', +                self.html) + +        if not link: +            link = re.search(r"playlist: '(/get_file\.php\?stream=[A-Za-z0-9=]+)'", self.html) +            if link: +                self.html = self.load("http://www.putlocker.com" + link.group(1)) +                link = re.search(r'media:content url="(http://.*?)"', self.html) +                if not link: +                    link = re.search("\"(http://media\\-b\\d+\\.putlocker\\.com/download/\\d+/.*?)\"", self.html) +            else: +                self.parseError('Unable to detect a download link') + +        return link.group(1).replace("&", "&") | 
