From c484718f06c0d9dbb5b820189a581445dec012d1 Mon Sep 17 00:00:00 2001 From: zapp-brannigan Date: Sun, 27 Jul 2014 17:36:47 +0200 Subject: [Uploadable.ch] New hoster As requested in https://github.com/pyload/pyload/issues/679 --- module/plugins/hoster/UploadableCh.py | 82 +++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 module/plugins/hoster/UploadableCh.py (limited to 'module/plugins/hoster/UploadableCh.py') diff --git a/module/plugins/hoster/UploadableCh.py b/module/plugins/hoster/UploadableCh.py new file mode 100644 index 000000000..9d44b17db --- /dev/null +++ b/module/plugins/hoster/UploadableCh.py @@ -0,0 +1,82 @@ +# -*- coding: utf-8 -*- +#Testlink: +#http://www.uploadable.ch/file/JG3nbN6fUCvh/test.txt +# +import re,time +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.ReCaptcha import ReCaptcha + +class UploadableCh(SimpleHoster): + __name__ = "UploadableCh" + __type__ = "hoster" + __pattern__ = r"https?://www.uploadable.ch/file/.*" + __version__ = "0.01" + __description__ = """uploadable.ch hoster plugin""" + __author_name__ = ("zapp-brannigan") + __author_mail__ = ("fuerst.reinje@web.de") + + FILE_INFO_PATTERN = r"""div id=\"file_name\" title=.+>(?P.+)\((?P.*) (?P[kKmMbB]|Bytes)\)<""" + RECAPTCHA_KEY = "6LdlJuwSAAAAAPJbPIoUhyqOJd7-yrah5Nhim5S3" + WAIT_PATTERN = r'data-time=\"(\d+)\" data-format' + FILE_ID = r'name=\"recaptcha_shortencode_field\" value=\"(.+)\"' + FILE_OFFLINE_PATTERN = r'

File not available

' + + def setup(self): + self.multiDL = False + self.chunkLimit = 1 + + def process(self, pyfile): + #Load website and set a cookie + self.html = self.load(pyfile.url, cookies=True, decode=True) + + # Set some vars + base_url = "http://www.uploadable.ch" + file_id = re.search(self.FILE_ID,self.html).group(1) + long_url = base_url+"/file/"+file_id+"/"+self.pyfile.name + not_so_long_url = base_url+"/file/"+file_id + self.logDebug("base_url: "+base_url) + self.logDebug("file_id: "+file_id) + self.logDebug("long_url: "+long_url) + self.logDebug("not_so_long_url: "+not_so_long_url) + + # Click the "free user" button and wait + post_data = { "downloadLink": "wait" } + a = self.load(not_so_long_url, cookies=True, post=post_data, decode=True) + self.logDebug(a) #Expected output: {"waitTime":30} + seconds = re.search(self.WAIT_PATTERN,self.html).group(1) + self.setWait(int(seconds) + 2) + self.wait() + + # Make the recaptcha appear and show it the pyload interface + post_data = { "checkDownload": "check" } + b = self.load(long_url, cookies=True, post=post_data, decode=True) + self.logDebug(b) #Expected output: {"success":"showCaptcha"} + recaptcha = ReCaptcha(self) + challenge, code = recaptcha.challenge(self.RECAPTCHA_KEY) + + # Submit the captcha solution + post_data = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": code, "recaptcha_shortencode_field": file_id} + c = self.load("http://www.uploadable.ch/checkReCaptcha.php", cookies=True, post=post_data, decode=True) + time.sleep(3) + + # Get ready for downloading + post_data = {"downloadLink": "show"} + self.download(not_so_long_url, cookies=True, post=post_data, disposition=True) + time.sleep(3) + + # Download the file + post_data = {"download": "normal"} + self.download(not_so_long_url, cookies=True, post=post_data, disposition=True) + + # Check the downloaded file + check = self.checkDownload({"wait_or_reconnect": re.compile("Please wait for"), "is_html": re.compile("")}) + if check == "wait_or_reconnect": + self.logInfo("Downloadlimit reached, please wait or reconnect") + self.setWait(60*60,True) + self.retry() + elif check == "is_html": + self.logInfo("The downloaded file is html, maybe you entered a wrong captcha") + self.retry() + +getInfo = create_getInfo(UploadableCh) + -- cgit v1.2.3 From b0d0a28d0e35a825c6dc465bcc5963d93b2e4ef4 Mon Sep 17 00:00:00 2001 From: zapp-brannigan Date: Sun, 27 Jul 2014 19:26:52 +0200 Subject: Update UploadableCh.py --- module/plugins/hoster/UploadableCh.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/UploadableCh.py') diff --git a/module/plugins/hoster/UploadableCh.py b/module/plugins/hoster/UploadableCh.py index 9d44b17db..9e7396ee8 100644 --- a/module/plugins/hoster/UploadableCh.py +++ b/module/plugins/hoster/UploadableCh.py @@ -56,12 +56,12 @@ class UploadableCh(SimpleHoster): # Submit the captcha solution post_data = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": code, "recaptcha_shortencode_field": file_id} - c = self.load("http://www.uploadable.ch/checkReCaptcha.php", cookies=True, post=post_data, decode=True) + c = self.load(base_url+"/checkReCaptcha.php", cookies=True, post=post_data, decode=True) time.sleep(3) # Get ready for downloading post_data = {"downloadLink": "show"} - self.download(not_so_long_url, cookies=True, post=post_data, disposition=True) + self.load(not_so_long_url, cookies=True, post=post_data, disposition=True) time.sleep(3) # Download the file -- cgit v1.2.3 From 43cdacabfee1a1b917f651d0b72aeae6af0b7e3b Mon Sep 17 00:00:00 2001 From: zapp-brannigan Date: Sun, 27 Jul 2014 19:31:13 +0200 Subject: Update UploadableCh.py --- module/plugins/hoster/UploadableCh.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'module/plugins/hoster/UploadableCh.py') diff --git a/module/plugins/hoster/UploadableCh.py b/module/plugins/hoster/UploadableCh.py index 9e7396ee8..421cda41e 100644 --- a/module/plugins/hoster/UploadableCh.py +++ b/module/plugins/hoster/UploadableCh.py @@ -56,7 +56,7 @@ class UploadableCh(SimpleHoster): # Submit the captcha solution post_data = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": code, "recaptcha_shortencode_field": file_id} - c = self.load(base_url+"/checkReCaptcha.php", cookies=True, post=post_data, decode=True) + self.load(base_url+"/checkReCaptcha.php", cookies=True, post=post_data, decode=True) time.sleep(3) # Get ready for downloading @@ -79,4 +79,3 @@ class UploadableCh(SimpleHoster): self.retry() getInfo = create_getInfo(UploadableCh) - -- cgit v1.2.3 From c7e11410952064fb5437c6c60c27f972ccde0aed Mon Sep 17 00:00:00 2001 From: zapp-brannigan Date: Mon, 28 Jul 2014 17:47:37 +0200 Subject: Update UploadableCh.py --- module/plugins/hoster/UploadableCh.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/UploadableCh.py') diff --git a/module/plugins/hoster/UploadableCh.py b/module/plugins/hoster/UploadableCh.py index 421cda41e..1dbf9af55 100644 --- a/module/plugins/hoster/UploadableCh.py +++ b/module/plugins/hoster/UploadableCh.py @@ -61,7 +61,7 @@ class UploadableCh(SimpleHoster): # Get ready for downloading post_data = {"downloadLink": "show"} - self.load(not_so_long_url, cookies=True, post=post_data, disposition=True) + self.load(not_so_long_url, cookies=True, post=post_data, decode=True) time.sleep(3) # Download the file -- cgit v1.2.3 From fd082ee5cdaddceb8d4977f4407838811af3a004 Mon Sep 17 00:00:00 2001 From: zapp-brannigan Date: Fri, 1 Aug 2014 18:34:14 +0200 Subject: Update UploadableCh.py --- module/plugins/hoster/UploadableCh.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'module/plugins/hoster/UploadableCh.py') diff --git a/module/plugins/hoster/UploadableCh.py b/module/plugins/hoster/UploadableCh.py index 1dbf9af55..a091a5c1b 100644 --- a/module/plugins/hoster/UploadableCh.py +++ b/module/plugins/hoster/UploadableCh.py @@ -15,7 +15,7 @@ class UploadableCh(SimpleHoster): __author_name__ = ("zapp-brannigan") __author_mail__ = ("fuerst.reinje@web.de") - FILE_INFO_PATTERN = r"""div id=\"file_name\" title=.+>(?P.+)\((?P.*) (?P[kKmMbB]|Bytes)\)<""" + FILE_INFO_PATTERN = r"""div id=\"file_name\" title=.*>(?P.+)\((?P.*) (?P[kKmMgG]?i?[bB].*)\)<""" RECAPTCHA_KEY = "6LdlJuwSAAAAAPJbPIoUhyqOJd7-yrah5Nhim5S3" WAIT_PATTERN = r'data-time=\"(\d+)\" data-format' FILE_ID = r'name=\"recaptcha_shortencode_field\" value=\"(.+)\"' @@ -34,6 +34,7 @@ class UploadableCh(SimpleHoster): file_id = re.search(self.FILE_ID,self.html).group(1) long_url = base_url+"/file/"+file_id+"/"+self.pyfile.name not_so_long_url = base_url+"/file/"+file_id + self.logDebug("filename: "+pyfile.name) self.logDebug("base_url: "+base_url) self.logDebug("file_id: "+file_id) self.logDebug("long_url: "+long_url) @@ -73,6 +74,7 @@ class UploadableCh(SimpleHoster): if check == "wait_or_reconnect": self.logInfo("Downloadlimit reached, please wait or reconnect") self.setWait(60*60,True) + self.wait() self.retry() elif check == "is_html": self.logInfo("The downloaded file is html, maybe you entered a wrong captcha") -- cgit v1.2.3 From cb6eb80875965ba1ab743ab116a861c6c5739194 Mon Sep 17 00:00:00 2001 From: zapp-brannigan Date: Thu, 4 Sep 2014 08:14:52 +0200 Subject: Update UploadableCh.py --- module/plugins/hoster/UploadableCh.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/UploadableCh.py') diff --git a/module/plugins/hoster/UploadableCh.py b/module/plugins/hoster/UploadableCh.py index a091a5c1b..05ed0247f 100644 --- a/module/plugins/hoster/UploadableCh.py +++ b/module/plugins/hoster/UploadableCh.py @@ -70,7 +70,7 @@ class UploadableCh(SimpleHoster): self.download(not_so_long_url, cookies=True, post=post_data, disposition=True) # Check the downloaded file - check = self.checkDownload({"wait_or_reconnect": re.compile("Please wait for"), "is_html": re.compile("")}) + check = self.checkDownload({"wait_or_reconnect": re.compile("Please wait for"), "is_html": re.compile("")}) if check == "wait_or_reconnect": self.logInfo("Downloadlimit reached, please wait or reconnect") self.setWait(60*60,True) -- cgit v1.2.3