From bf1ee80cb0905587fba0c320036b0082dfd13b3e Mon Sep 17 00:00:00 2001 From: z00nx Date: Fri, 11 Jan 2013 07:48:46 +1100 Subject: Initial CatShareNet plugin --- module/plugins/hoster/CatShareNet.py | 39 ++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 module/plugins/hoster/CatShareNet.py (limited to 'module/plugins/hoster/CatShareNet.py') diff --git a/module/plugins/hoster/CatShareNet.py b/module/plugins/hoster/CatShareNet.py new file mode 100644 index 000000000..ef77071a3 --- /dev/null +++ b/module/plugins/hoster/CatShareNet.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +import re +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.ReCaptcha import ReCaptcha + + +class CatShareNet(SimpleHoster): + __name__ = "CatShareNet" + __type__ = "hoster" + __pattern__ = r"http://(www\.)?catshare.net/\w{16}.*" + __version__ = "0.01" + __description__ = """CatShare.net Download Hoster""" + __author_name__ = ("z00nx") + __author_mail__ = ("z00nx0@gmail.com") + + FILE_INFO_PATTERN = r'

]+>(?P.*)

\s+

]+>(?P.*)

' + FILE_OFFLINE_PATTERN = r'Podany plik został usunięty' + SECONDS_PATTERN = 'var\s+count\s+=\s+(\d+);' + RECAPTCHA_KEY = "6Lfln9kSAAAAANZ9JtHSOgxUPB9qfDFeLUI_QMEy" + + def handleFree(self): + self.logDebug(self.pyfile.url) + found = re.search(self.SECONDS_PATTERN, self.html) + seconds = int(found.group(1)) + self.logDebug("Seconds found", seconds) + self.setWait(seconds + 1) + self.wait() + recaptcha = ReCaptcha(self) + challenge, code = recaptcha.challenge(self.RECAPTCHA_KEY) + post_data = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": code} + self.download(self.pyfile.url, post=post_data) + check = self.checkDownload({"html": re.compile("\A Date: Fri, 11 Jan 2013 13:51:27 +1100 Subject: Remove unneeded debugging --- module/plugins/hoster/CatShareNet.py | 1 - 1 file changed, 1 deletion(-) (limited to 'module/plugins/hoster/CatShareNet.py') diff --git a/module/plugins/hoster/CatShareNet.py b/module/plugins/hoster/CatShareNet.py index ef77071a3..431ced356 100644 --- a/module/plugins/hoster/CatShareNet.py +++ b/module/plugins/hoster/CatShareNet.py @@ -20,7 +20,6 @@ class CatShareNet(SimpleHoster): RECAPTCHA_KEY = "6Lfln9kSAAAAANZ9JtHSOgxUPB9qfDFeLUI_QMEy" def handleFree(self): - self.logDebug(self.pyfile.url) found = re.search(self.SECONDS_PATTERN, self.html) seconds = int(found.group(1)) self.logDebug("Seconds found", seconds) -- cgit v1.2.3 From 38611d80d6c1cb23d04c6fa4150d984597a2f339 Mon Sep 17 00:00:00 2001 From: z00nx Date: Fri, 11 Jan 2013 16:57:03 +1100 Subject: Fixed offline regex --- module/plugins/hoster/CatShareNet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/CatShareNet.py') diff --git a/module/plugins/hoster/CatShareNet.py b/module/plugins/hoster/CatShareNet.py index 431ced356..47063096e 100644 --- a/module/plugins/hoster/CatShareNet.py +++ b/module/plugins/hoster/CatShareNet.py @@ -15,7 +15,7 @@ class CatShareNet(SimpleHoster): __author_mail__ = ("z00nx0@gmail.com") FILE_INFO_PATTERN = r'

]+>(?P.*)

\s+

]+>(?P.*)

' - FILE_OFFLINE_PATTERN = r'Podany plik został usunięty' + FILE_OFFLINE_PATTERN = r'Podany plik zosta' SECONDS_PATTERN = 'var\s+count\s+=\s+(\d+);' RECAPTCHA_KEY = "6Lfln9kSAAAAANZ9JtHSOgxUPB9qfDFeLUI_QMEy" -- cgit v1.2.3