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') 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') 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') 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') 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') 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 6358c74165e54a86d28c1d0bde8fc1a7a13e9830 Mon Sep 17 00:00:00 2001 From: zapp-brannigan Date: Sat, 2 Aug 2014 12:33:05 +0200 Subject: [kingfiles.net] New hoster As requested in https://github.com/pyload/pyload/issues/510 --- module/plugins/hoster/KingfilesNet.py | 63 +++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 module/plugins/hoster/KingfilesNet.py (limited to 'module/plugins') diff --git a/module/plugins/hoster/KingfilesNet.py b/module/plugins/hoster/KingfilesNet.py new file mode 100644 index 000000000..62ba6a225 --- /dev/null +++ b/module/plugins/hoster/KingfilesNet.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +# Testlink: http://www.kingfiles.net/zcegm9nkh2n1/test.dd + +import re +from module.plugins.internal.CaptchaService import SolveMedia +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + +class KingfilesNet(SimpleHoster): + __name__ = "KingfilesNet" + __type__ = "hoster" + __pattern__ = r'https?://(www\.)?kingfiles.net/.+' + __version__ = "0.01" + __description__ = """KingfilesNet hoster plugin (free-user)""" + __author_name__ = ("zapp-brannigan") + __author_mail__ = ("fuerst.reinje@web.de") + + FILE_NAME_PATTERN = r'.+)\">' + FILE_SIZE_PATTERN = r'>Size: (?P.+) (?P[kKmMgG]?i?[bB])<' + OFFLINE_PATTERN = r'No such file with this filename' + FILE_ID_PATTERN = r'' + RANDOM_PATTERN = r'type=\"hidden\" name=\"rand\" value=\"(.+)\">' + DOWNLOAD_URL_PATTERN = r'var download_url = \'(.+)\';' + SOLVEMEDIA_PATTERN = r'src=\"http://api.solvemedia.com/papi/challenge.script\?k=(.+)\">' + + def setup(self): + self.multiDL = False + self.chunkLimit = 1 + + def process(self,pyfile): + #Load main page and find file-id + a = self.load(pyfile.url, cookies=True, decode=True) + file_id = re.search(self.FILE_ID_PATTERN, a).group(1) + self.logDebug("file_id: "+file_id) + + #Click the free user button + post_data = { "op": "download1", "usr_login": "", "id": file_id, "fname": pyfile.name, "referer": "", "method_free": "+" } + b = self.load(pyfile.url, post=post_data, cookies=True, decode=True) + + #Do the captcha stuff + captcha_key = re.search(self.SOLVEMEDIA_PATTERN, b).group(1) + if not captcha_key: + self.fail("Can not find captcha_key, maybe the plugin is out of date") + self.logDebug("captcha_key: "+captcha_key) + rand = re.search(self.RANDOM_PATTERN, b).group(1) + if not rand: + self.fail("Can not find random string, maybe the plugin is out of date") + self.logDebug("random string: "+rand) + solvemedia = SolveMedia(self) + captcha_challenge, captcha_response = solvemedia.challenge(captcha_key) + + #Make the downloadlink appear and load the file + post_data = { "op": "download2", "id": file_id, "rand": rand, "referer": pyfile.url, "method_free": "+", "method_premium": "", "adcopy_response": captcha_response, "adcopy_challenge": captcha_challenge, "down_direct": "1" } + c = self.load(pyfile.url, post=post_data, cookies=True, decode=True) + dl_url = re.search(self.DOWNLOAD_URL_PATTERN, c).group(1) + if not dl_url: + self.fail("Can not find download-url, maybe the plugin is out of date") + self.logDebug("Downloadurl: "+dl_url) + self.download(dl_url, cookies=True, disposition=True) + check = self.checkDownload({"is_html": re.compile("")}) + if check == "is_html": + self.fail("The downloaded file is html, something went wrong. Maybe the plugin is out of date") + +getInfo = create_getInfo(KingfilesNet) -- cgit v1.2.3 From 4cb72cf52d8ba79ce178ee7b0e28c12a31d6b178 Mon Sep 17 00:00:00 2001 From: zapp-brannigan Date: Sat, 2 Aug 2014 12:38:07 +0200 Subject: Delete KingfilesNet.py --- module/plugins/hoster/KingfilesNet.py | 63 ----------------------------------- 1 file changed, 63 deletions(-) delete mode 100644 module/plugins/hoster/KingfilesNet.py (limited to 'module/plugins') diff --git a/module/plugins/hoster/KingfilesNet.py b/module/plugins/hoster/KingfilesNet.py deleted file mode 100644 index 62ba6a225..000000000 --- a/module/plugins/hoster/KingfilesNet.py +++ /dev/null @@ -1,63 +0,0 @@ -# -*- coding: utf-8 -*- -# Testlink: http://www.kingfiles.net/zcegm9nkh2n1/test.dd - -import re -from module.plugins.internal.CaptchaService import SolveMedia -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo - -class KingfilesNet(SimpleHoster): - __name__ = "KingfilesNet" - __type__ = "hoster" - __pattern__ = r'https?://(www\.)?kingfiles.net/.+' - __version__ = "0.01" - __description__ = """KingfilesNet hoster plugin (free-user)""" - __author_name__ = ("zapp-brannigan") - __author_mail__ = ("fuerst.reinje@web.de") - - FILE_NAME_PATTERN = r'.+)\">' - FILE_SIZE_PATTERN = r'>Size: (?P.+) (?P[kKmMgG]?i?[bB])<' - OFFLINE_PATTERN = r'No such file with this filename' - FILE_ID_PATTERN = r'' - RANDOM_PATTERN = r'type=\"hidden\" name=\"rand\" value=\"(.+)\">' - DOWNLOAD_URL_PATTERN = r'var download_url = \'(.+)\';' - SOLVEMEDIA_PATTERN = r'src=\"http://api.solvemedia.com/papi/challenge.script\?k=(.+)\">' - - def setup(self): - self.multiDL = False - self.chunkLimit = 1 - - def process(self,pyfile): - #Load main page and find file-id - a = self.load(pyfile.url, cookies=True, decode=True) - file_id = re.search(self.FILE_ID_PATTERN, a).group(1) - self.logDebug("file_id: "+file_id) - - #Click the free user button - post_data = { "op": "download1", "usr_login": "", "id": file_id, "fname": pyfile.name, "referer": "", "method_free": "+" } - b = self.load(pyfile.url, post=post_data, cookies=True, decode=True) - - #Do the captcha stuff - captcha_key = re.search(self.SOLVEMEDIA_PATTERN, b).group(1) - if not captcha_key: - self.fail("Can not find captcha_key, maybe the plugin is out of date") - self.logDebug("captcha_key: "+captcha_key) - rand = re.search(self.RANDOM_PATTERN, b).group(1) - if not rand: - self.fail("Can not find random string, maybe the plugin is out of date") - self.logDebug("random string: "+rand) - solvemedia = SolveMedia(self) - captcha_challenge, captcha_response = solvemedia.challenge(captcha_key) - - #Make the downloadlink appear and load the file - post_data = { "op": "download2", "id": file_id, "rand": rand, "referer": pyfile.url, "method_free": "+", "method_premium": "", "adcopy_response": captcha_response, "adcopy_challenge": captcha_challenge, "down_direct": "1" } - c = self.load(pyfile.url, post=post_data, cookies=True, decode=True) - dl_url = re.search(self.DOWNLOAD_URL_PATTERN, c).group(1) - if not dl_url: - self.fail("Can not find download-url, maybe the plugin is out of date") - self.logDebug("Downloadurl: "+dl_url) - self.download(dl_url, cookies=True, disposition=True) - check = self.checkDownload({"is_html": re.compile("")}) - if check == "is_html": - self.fail("The downloaded file is html, something went wrong. Maybe the plugin is out of date") - -getInfo = create_getInfo(KingfilesNet) -- 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') 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 From 35f5b61e7c49d72c13c5220940c3584edf79a4f3 Mon Sep 17 00:00:00 2001 From: Christian Plesche Date: Sun, 23 Nov 2014 20:45:56 +0100 Subject: Update NetloadIn.py changed to recaptcha, initial commit, needs rework --- module/plugins/hoster/NetloadIn.py | 203 +++++++++++++++++++------------------ 1 file changed, 103 insertions(+), 100 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index 549ecb667..4efd3839b 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -1,13 +1,13 @@ +#!/usr/bin/env python # -*- coding: utf-8 -*- import re - from time import sleep, time -from module.network.RequestFactory import getURL from module.plugins.Hoster import Hoster +from module.network.RequestFactory import getURL from module.plugins.Plugin import chunks - +from module.plugins.internal.CaptchaService import ReCaptcha def getInfo(urls): ## returns list of tupels (name, size (in bytes), status (see FileDatabase), url) @@ -26,11 +26,10 @@ def getInfo(urls): api = getURL(apiurl + ids, decode=True) if api is None or len(api) < 10: - self.logDebug("Prefetch failed") + print "Netload prefetch: failed " return if api.find("unknown_auth") >= 0: - print - self.logDebug("Outdated auth code") + print "Netload prefetch: Outdated auth code " return result = [] @@ -42,46 +41,45 @@ def getInfo(urls): size = int(tmp[2]) except: size = 0 - result.append((tmp[1], size, 2 if tmp[3] == "online" else 1, chunk[i])) + result.append((tmp[1], size, 2 if tmp[3] == "online" else 1, chunk[i] )) except: - self.logDebug("Error while processing response: %s" % r) + print "Netload prefetch: Error while processing response: " + print r yield result class NetloadIn(Hoster): - __name__ = "NetloadIn" - __type__ = "hoster" - __version__ = "0.45" - - __pattern__ = r'https?://(?:[^/]*\.)?netload\.in/(?:datei(.*?)(?:\.htm|/)|index\.php?id=10&file_id=)' - - __description__ = """Netload.in hoster plugin""" - __license__ = "GPLv3" - __authors__ = [("spoob", "spoob@pyload.org"), - ("RaNaN", "ranan@pyload.org"), - ("Gregy", "gregy@gregy.cz")] - + __name__ = "NetloadIn" + __type__ = "hoster" + __pattern__ = r"https?://.*netload\.in/(?:datei(.*?)(?:\.htm|/)|index.php?id=10&file_id=)" + __version__ = "0.451" + __description__ = """Netload.in Download Hoster""" + __author_name__ = ("spoob", "RaNaN", "Gregy") + __author_mail__ = ("spoob@pyload.org", "ranan@pyload.org", "gregy@gregy.cz") + RECAPTCHA_KEY="6LcLJMQSAAAAAJzquPUPKNovIhbK6LpSqCjYrsR1" def setup(self): - self.multiDL = self.resumeDownload = self.premium - + self.multiDL = False + if self.premium: + self.multiDL = True + self.chunkLimit = -1 + self.resumeDownload = True def process(self, pyfile): self.url = pyfile.url self.prepare() - pyfile.setStatus("downloading") + self.pyfile.setStatus("downloading") self.proceed(self.url) - def prepare(self): self.download_api_data() - if self.api_data and self.api_data['filename']: - self.pyfile.name = self.api_data['filename'] + if self.api_data and self.api_data["filename"]: + self.pyfile.name = self.api_data["filename"] if self.premium: - self.logDebug("Use Premium Account") + self.logDebug("Netload: Use Premium Account") settings = self.load("http://www.netload.in/index.php?id=2&lang=en") if '', html_unescape(captcha_div)) -- cgit v1.2.3 From d66784d79ab5159e2480b89056dbf9dadae5a6b7 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 1 Dec 2014 18:17:57 +0100 Subject: [Keep2shareCc] Rewrite hoster --- module/plugins/hoster/Keep2shareCc.py | 120 ++++++++++++++++++++-------------- 1 file changed, 70 insertions(+), 50 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/Keep2shareCc.py b/module/plugins/hoster/Keep2shareCc.py index fd8a5524d..a374cc481 100644 --- a/module/plugins/hoster/Keep2shareCc.py +++ b/module/plugins/hoster/Keep2shareCc.py @@ -2,16 +2,16 @@ import re -from urlparse import urlparse, urljoin +from urlparse import urljoin, urlparse from module.plugins.internal.CaptchaService import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import _isDirectLink, SimpleHoster, create_getInfo class Keep2shareCc(SimpleHoster): __name__ = "Keep2shareCc" __type__ = "hoster" - __version__ = "0.15" + __version__ = "0.16" __pattern__ = r'https?://(?:www\.)?(keep2share|k2s|keep2s)\.cc/file/(?P\w+)' @@ -21,75 +21,101 @@ class Keep2shareCc(SimpleHoster): ("Walter Purcaro", "vuolter@gmail.com")] + URL_REPLACEMENTS = [(__pattern__ + ".*", "http://k2s.cc/file/\g")] + + CONTENT_DISPOSITION = True + NAME_PATTERN = r'File: (?P.+)' SIZE_PATTERN = r'Size: (?P[^<]+)' - OFFLINE_PATTERN = r'File not found or deleted|Sorry, this file is blocked or deleted|Error 404' - LINK_PATTERN = r'To download this file with slow speed, use this link' + OFFLINE_PATTERN = r'File not found or deleted|Sorry, this file is blocked or deleted|Error 404' + TEMP_OFFLINE_PATTERN = r'Downloading blocked due to' + + LINK_FREE_PATTERN = LINK_PREMIUM_PATTERN = r'"([^"]+url.html?file=.+?)"|window\.location\.href = \'(.+?)\';' + CAPTCHA_PATTERN = r'src="(/file/captcha\.html.+?)"' - WAIT_PATTERN = r'Please wait ([\d:]+) to download this file' - MULTIDL_ERROR = r'Free account does not allow to download more than one file at the same time' + WAIT_PATTERN = r'Please wait ([\d:]+) to download this file' + ERROR_BLOCK_PATTERN = r'Downloading is not possible
.+?
' + TEMP_ERROR_PATTERN = r'Download count files exceed|Traffic limit exceed|Free account does not allow to download more than one file at the same time' + ERROR_PATTERN = r'Free user can\'t download large files|You no can access to this file|This download available only for premium users|This is private file' - def handleFree(self): - self.sanitize_url() - self.html = self.load(self.pyfile.url) - self.fid = re.search(r'', self.html).group(1) + def checkErrors(self): + m = re.search(self.ERROR_BLOCK_PATTERN, self.html, re.S) + if m: + e = self.info['error'] = m.group(0) + + m = re.search(self.TEMP_ERROR_PATTERN, self.html) + if m: + self.wantReconnect = True + self.retry(wait_time=30 * 60, reason=m.group(0)) + + m = re.search(self.ERROR_PATTERN, self.html) + if m: + self.error(e) + + m = re.search(self.WAIT_PATTERN, self.html) + if m: + self.logDebug("Hoster told us to wait for %s" % m.group(1)) + + # string to time convert courtesy of https://stackoverflow.com/questions/10663720 + ftr = [3600, 60, 1] + wait_time = sum([a * b for a, b in zip(ftr, map(int, m.group(1).split(':')))]) + + self.wantReconnect = True + self.retry(wait_time=wait_time, reason="Please wait to download this file") + + self.info.pop('error', None) + + + def handleFree(self): + self.fid = re.search(r'', self.html).group(1) self.html = self.load(self.pyfile.url, post={'yt0': '', 'slow_id': self.fid}) - if ">Downloading is not possible" in self.html: - self.fail("Free user can't download large files") + self.checkErrors() - m = re.search(r"function download\(\){.*window\.location\.href = '([^']+)';", self.html, re.S) - if m: # Direct mode - self.startDownload(m.group(1)) - else: + m = re.search(self.LINK_FREE_PATTERN, self.html) + + if m is None: self.handleCaptcha() self.wait(30) self.html = self.load(self.pyfile.url, post={'uniqueId': self.fid, 'free': 1}) - m = re.search(self.WAIT_PATTERN, self.html) - if m: - self.logDebug("Hoster told us to wait for %s" % m.group(1)) - # string to time convert courtesy of https://stackoverflow.com/questions/10663720 - ftr = [3600, 60, 1] - wait_time = sum([a * b for a, b in zip(ftr, map(int, m.group(1).split(':')))]) - self.wait(wait_time, True) - self.retry() - - m = re.search(self.MULTIDL_ERROR, self.html) - if m: - # if someone is already downloading on our line, wait 30min and retry - self.logDebug("Already downloading, waiting for 30 minutes") - self.wait(30 * 60, True) - self.retry() + self.checkErrors() - m = re.search(self.LINK_PATTERN, self.html) + m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: - self.error(_("LINK_PATTERN not found")) - self.startDownload(m.group(1)) + self.error(_("LINK_FREE_PATTERN not found")) + + self.link = self._getDownloadLink(m.group(1)) + + + def handlePremium(self): + super(Keep2shareCc, self).handlePremium() + if self.link: + self.link = self._getDownloadLink(self.link) def handleCaptcha(self): recaptcha = ReCaptcha(self) for _i in xrange(5): - post_data = {'free': 1, + post_data = {'free' : 1, 'freeDownloadRequest': 1, - 'uniqueId': self.fid, - 'yt0': ''} + 'uniqueId' : self.fid, + 'yt0' : ''} m = re.search(self.CAPTCHA_PATTERN, self.html) if m: - captcha_url = urljoin(self.base_url, m.group(1)) + captcha_url = urljoin(self.base, m.group(1)) post_data['CaptchaForm[code]'] = self.decryptCaptcha(captcha_url) else: challenge, response = recaptcha.challenge() post_data.update({'recaptcha_challenge_field': challenge, - 'recaptcha_response_field': response}) + 'recaptcha_response_field' : response}) self.html = self.load(self.pyfile.url, post=post_data) @@ -102,17 +128,11 @@ class Keep2shareCc(SimpleHoster): self.fail(_("All captcha attempts failed")) - def startDownload(self, url): - d = urljoin(self.base_url, url) - self.download(d, disposition=True) - - - def sanitize_url(self): - header = self.load(self.pyfile.url, just_header=True) - if 'location' in header: - self.pyfile.url = header['location'] + def _getDownloadLink(self, url): p = urlparse(self.pyfile.url) - self.base_url = "%s://%s" % (p.scheme, p.hostname) + base = "%s://%s" % (p.scheme, p.netloc) + link = _isDirectLink(url) + return urljoin(base, link) if link else "" getInfo = create_getInfo(Keep2shareCc) -- cgit v1.2.3 From 2512e1f1bf655c987828698d69790d8f6f9bebe8 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 1 Dec 2014 18:19:47 +0100 Subject: [BasePlugin] Improve some routines --- module/plugins/hoster/BasePlugin.py | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py index 01a234d3b..0b1888e3b 100644 --- a/module/plugins/hoster/BasePlugin.py +++ b/module/plugins/hoster/BasePlugin.py @@ -3,7 +3,7 @@ import re from urllib import unquote -from urlparse import urlparse +from urlparse import urljoin, urlparse from module.network.HTTPRequest import BadHeader from module.plugins.internal.SimpleHoster import create_getInfo @@ -13,7 +13,7 @@ from module.plugins.Hoster import Hoster class BasePlugin(Hoster): __name__ = "BasePlugin" __type__ = "hoster" - __version__ = "0.24" + __version__ = "0.25" __pattern__ = r'^unmatchable$' @@ -25,7 +25,7 @@ class BasePlugin(Hoster): @classmethod def getInfo(cls, url="", html=""): #@TODO: Move to hoster class in 0.4.10 - return {'name': urlparse(url).path.split('/')[-1] or _("Unknown"), 'size': 0, 'status': 3 if url else 1, 'url': url or ""} + return {'name': urlparse(unquote(url)).path.split('/')[-1] or _("Unknown"), 'size': 0, 'status': 3 if url else 1, 'url': unquote(url) or ""} def setup(self): @@ -50,7 +50,7 @@ class BasePlugin(Hoster): self.offline() elif e.code in (401, 403): - self.logDebug("Auth required") + self.logDebug("Auth required", "Received HTTP status code: %d" % e.code) account = self.core.accountManager.getAccountPlugin('Http') servers = [x['login'] for x in account.getAllAccounts()] @@ -65,16 +65,16 @@ class BasePlugin(Hoster): self.req.addAuth(pwd.strip()) break else: - self.fail(_("Authorization required (username:password)")) + self.fail(_("Authorization required")) else: self.fail(e) else: break else: - self.fail(_("No file downloaded")) #@TODO: Move to hoster class (check if self.lastDownload) in 0.4.10 + self.fail(_("No file downloaded")) #@TODO: Move to hoster class in 0.4.10 - # if self.checkDownload({'empty': re.compile(r"^$")}) is "empty": - # self.fail(_("Empty file")) + if self.checkDownload({'empty': re.compile(r"^$")}) is "empty": #@TODO: Move to hoster in 0.4.10 + self.fail(_("Empty file")) def downloadFile(self, pyfile): @@ -85,7 +85,8 @@ class BasePlugin(Hoster): if 'location' not in header or not header['location']: if 'code' in header and header['code'] not in (200, 201, 203, 206): - self.fail(_("File not found"), _("HTTP status code: %d") % header['code']) + self.logDebug("Received HTTP status code: %d" % header['code']) + self.fail(_("File not found")) else: break @@ -93,17 +94,13 @@ class BasePlugin(Hoster): self.logDebug("Redirect #%d to: %s" % (i, location)) - base = re.match(r'https?://[^/]+', url).group(0) - - if location.startswith("http"): + if urlparse(location).scheme: url = location - - elif location.startswith("/"): - url = base + unquote(location) - else: - url = "%s/%s" % (base, unquote(location)) + p = urlparse(url) + base = "%s://%s" % (p.scheme, p.netloc) + url = urljoin(base, location) else: self.fail(_("Too many redirects")) - self.download(url, disposition=True) + self.download(unquote(url), disposition=True) -- cgit v1.2.3 From 9dba25814346190ac9e86fbbd6af1f101d6e96b3 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 1 Dec 2014 18:20:37 +0100 Subject: [ShareonlineBiz] Extend SimpleHoster --- module/plugins/hoster/ShareonlineBiz.py | 184 +++++++++++++++----------------- 1 file changed, 87 insertions(+), 97 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index 78a27558b..91fc989c9 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -3,43 +3,18 @@ import re from time import time +from urllib import unquote +from urlparse import urlparse from module.network.RequestFactory import getURL -from module.plugins.Hoster import Hoster -from module.plugins.Plugin import chunks from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -def getInfo(urls): - api_url_base = "http://api.share-online.biz/linkcheck.php" - - urls = [url.replace("https://", "http://") for url in urls] - - for chunk in chunks(urls, 90): - api_param_file = {"links": "\n".join(x.replace("http://www.share-online.biz/dl/", "").rstrip("/") for x in - chunk)} # api only supports old style links - html = getURL(api_url_base, post=api_param_file, decode=True) - result = [] - for i, res in enumerate(html.split("\n")): - if not res: - continue - fields = res.split(";") - - if fields[1] == "OK": - status = 2 - elif fields[1] in ("DELETED", "NOT FOUND"): - status = 1 - else: - status = 3 - - result.append((fields[2], int(fields[3]), status, chunk[i])) - yield result - - -class ShareonlineBiz(Hoster): +class ShareonlineBiz(SimpleHoster): __name__ = "ShareonlineBiz" __type__ = "hoster" - __version__ = "0.41" + __version__ = "0.42" __pattern__ = r'https?://(?:www\.)?(share-online\.biz|egoshare\.com)/(download\.php\?id=|dl/)(?P\w+)' @@ -51,110 +26,118 @@ class ShareonlineBiz(Hoster): ("Walter Purcaro", "vuolter@gmail.com")] - ERROR_INFO_PATTERN = r'

Information:

\s*
\s*(.*?)' + URL_REPLACEMENTS = [(__pattern__ + ".*", "http://www.share-online.biz/dl/\g")] + ERROR_INFO_PATTERN = r'

Information:

\s*
\s*(.*?)' - def setup(self): - self.file_id = re.match(self.__pattern__, self.pyfile.url).group("ID") - self.pyfile.url = "http://www.share-online.biz/dl/" + self.file_id - self.resumeDownload = self.premium - self.multiDL = False + @classmethod + def getInfo(cls, url="", html=""): + info = {'name': urlparse(unquote(url)).path.split('/')[-1] or _("Unknown"), 'size': 0, 'status': 3 if url else 1, 'url': url} - self.check_data = None + if url: + info.update(re.match(cls.__pattern__, url).groupdict()) + api_url = "http://api.share-online.biz/linkcheck.php?md5=1" + html = getURL(api_url, cookies=False, post={"links": self.info['pattern']['ID']}, decode=True) + field = html.split(";") - def process(self, pyfile): - if self.premium: - self.handlePremium() - else: - self.handleFree() + if field[1] is "OK": + info['fileid'] = field[0] + info['status'] = 2 + info['filename'] = field[2] + info['size'] = field[3] #: in bytes + info['md5'] = field[4].strip().lower().replace("\n\n", "") #: md5 - if self.api_data: - self.check_data = {"size": int(self.api_data['size']), "md5": self.api_data['md5']} + elif field[1] in ("DELETED", "NOT FOUND"): + info['status'] = 1 + return info - def loadAPIData(self): - api_url_base = "http://api.share-online.biz/linkcheck.php?md5=1" - api_param_file = {"links": self.file_id} #: api only supports old style links - html = self.load(api_url_base, cookies=False, post=api_param_file, decode=True) - - fields = html.split(";") - self.api_data = {"fileid": fields[0], - "status": fields[1]} - if not self.api_data['status'] == "OK": - self.offline() - else: - self.api_data['filename'] = fields[2] - self.api_data['size'] = fields[3] #: in bytes - self.api_data['md5'] = fields[4].strip().lower().replace("\n\n", "") #: md5 + def setup(self): + self.resumeDownload = self.premium + self.multiDL = False - def handleFree(self): - self.loadAPIData() - self.pyfile.name = self.api_data['filename'] - self.pyfile.size = int(self.api_data['size']) - - self.html = self.load(self.pyfile.url, cookies=True) #: refer, stuff - self.setWait(3) - self.wait() - - self.html = self.load("%s/free/" % self.pyfile.url, post={"dl_free": "1", "choice": "free"}, decode=True) - self.checkErrors() - - m = re.search(r'var wait=(\d+);', self.html) + def handleCaptcha(self): recaptcha = ReCaptcha(self) + for _i in xrange(5): - challenge, response = recaptcha.challenge("6LdatrsSAAAAAHZrB70txiV5p-8Iv8BtVxlTtjKX") + challenge, response = recaptcha.challenge() + + m = re.search(r'var wait=(\d+);', self.html) self.setWait(int(m.group(1)) if m else 30) + res = self.load("%s/free/captcha/%d" % (self.pyfile.url, int(time() * 1000)), - post={'dl_free': '1', + post={'dl_free' : "1", 'recaptcha_challenge_field': challenge, - 'recaptcha_response_field': response}) - + 'recaptcha_response_field' : response}) if not res == '0': self.correctCaptcha() - break + return res else: self.invalidCaptcha() else: self.invalidCaptcha() self.fail(_("No valid captcha solution received")) + + def handleFree(self): + self.html = self.load(self.pyfile.url, cookies=True) #: refer, stuff + + self.wait(3) + + self.html = self.load("%s/free/" % self.pyfile.url, post={"dl_free": "1", "choice": "free"}, decode=True) + + self.checkErrors() + + res = self.handleCaptcha() + download_url = res.decode("base64") + if not download_url.startswith("http://"): self.error(_("Wrong download url")) self.wait() + self.download(download_url) + + def checkFile(self): # check download check = self.checkDownload({ - "cookie": re.compile(r'
Share-Online") + 'empty' : re.compile(r"^$"), + 'cookie': re.compile(r'
Share-Online") }) - if check == "cookie": + + if check == "empty": + self.fail(_("Empty file")) + + elif check == "cookie": self.invalidCaptcha() - self.retry(5, 60, "Cookie failure") + self.retry(5, 60, _("Cookie failure")) + elif check == "fail": self.invalidCaptcha() - self.retry(5, 5 * 60, "Download failed") - else: - self.correctCaptcha() + self.retry(5, 5 * 60, _("Download failed")) def handlePremium(self): #: should be working better loading (account) api internally self.account.getAccountInfo(self.user, True) + html = self.load("http://api.share-online.biz/account.php", {"username": self.user, "password": self.account.accounts[self.user]['password'], - "act": "download", "lid": self.file_id}) + "act": "download", "lid": self.info['fileid']}) self.api_data = dlinfo = {} + for line in html.splitlines(): key, value = line.split(": ") dlinfo[key.lower()] = value self.logDebug(dlinfo) + if not dlinfo['status'] == "online": self.offline() else: @@ -162,6 +145,7 @@ class ShareonlineBiz(Hoster): self.pyfile.size = int(dlinfo['size']) dlLink = dlinfo['url'] + if dlLink == "server_under_maintenance": self.tempOffline() else: @@ -174,23 +158,29 @@ class ShareonlineBiz(Hoster): if m is None: return - err = m.group(1) + errmsg = m.group(1).lower() + try: - self.logError(err, re.search(self.ERROR_INFO_PATTERN, self.html).group(1)) + self.logError(errmsg, re.search(self.ERROR_INFO_PATTERN, self.html).group(1)) except: - self.logError(err, "Unknown error occurred") + self.logError("Unknown error occurred", errmsg) - if err == "invalid": + if errmsg is "invalid": self.fail(_("File not available")) - elif err in ("freelimit", "size", "proxy"): + + elif errmsg in ("freelimit", "size", "proxy"): self.fail(_("Premium account needed")) + + elif errmsg in ("expired", "server"): + self.retry(wait_time=600, reason=errmsg) + + elif 'slot' in errmsg: + self.wantReconnect = True + self.retry(24, 3600, errmsg) + else: - if err in 'server': - self.setWait(600, False) - elif err in 'expired': - self.setWait(30, False) - else: - self.setWait(300, True) + self.wantReconnect = True + self.retry(wait_time=60, reason=errmsg) + - self.wait() - self.retry(max_tries=25, reason=err) +getInfo = create_getInfo(ShareonlineBiz) -- cgit v1.2.3 From a83f45f14aefb4fd766f7908e11bc6beaac3d0e8 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 1 Dec 2014 18:51:37 +0100 Subject: [XFSAccount] Improve patterns --- module/plugins/internal/XFSAccount.py | 8 ++++---- module/plugins/internal/XFSHoster.py | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/internal/XFSAccount.py b/module/plugins/internal/XFSAccount.py index 5a265c08a..2094b1480 100644 --- a/module/plugins/internal/XFSAccount.py +++ b/module/plugins/internal/XFSAccount.py @@ -12,7 +12,7 @@ from module.plugins.internal.SimpleHoster import parseHtmlForm, set_cookies class XFSAccount(Account): __name__ = "XFSAccount" __type__ = "account" - __version__ = "0.31" + __version__ = "0.32" __description__ = """XFileSharing account plugin""" __license__ = "GPLv3" @@ -27,15 +27,15 @@ class XFSAccount(Account): PREMIUM_PATTERN = r'\(Premium only\)' - VALID_UNTIL_PATTERN = r'>Premium.[Aa]ccount expire:.*?(\d{1,2} [\w^_]+ \d{4})' + VALID_UNTIL_PATTERN = r'Premium.[Aa]ccount expire:.*?(\d{1,2} [\w^_]+ \d{4})' - TRAFFIC_LEFT_PATTERN = r'>Traffic available today:.*?\s*(?P[\d.,]+|[Uu]nlimited)\s*(?:(?P[\w^_]+)\s*)?' + TRAFFIC_LEFT_PATTERN = r'Traffic available today:.*?\s*(?P[\d.,]+|[Uu]nlimited)\s*(?:(?P[\w^_]+)\s*)?' TRAFFIC_LEFT_UNIT = "MB" #: used only if no group was found LEECH_TRAFFIC_PATTERN = r'Leech Traffic left:.*?(?P[\d.,]+|[Uu]nlimited)\s*(?:(?P[\w^_]+)\s*)?' LEECH_TRAFFIC_UNIT = "MB" #: used only if no group was found - LOGIN_FAIL_PATTERN = r'>(Incorrect Login or Password|Error<)' + LOGIN_FAIL_PATTERN = r'>\s*(Incorrect Login or Password|Error<)' def __init__(self, manager, accounts): #@TODO: remove in 0.4.10 diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py index 587d47f6e..c3db3f335 100644 --- a/module/plugins/internal/XFSHoster.py +++ b/module/plugins/internal/XFSHoster.py @@ -35,7 +35,6 @@ class XFSHoster(SimpleHoster): CHECK_DIRECT_LINK = None MULTI_HOSTER = True #@NOTE: Should be default to False for safe, but I'm lazy... - INFO_PATTERN = r'Filename:(?P[^<]+)\s*.*?\((?P[^<]+)\)' NAME_PATTERN = r'(>Filename:|name="fname" value="|)(?P.+?)(\s*<|")' SIZE_PATTERN = r'(>Size:|>File:.*>|)(?P[\d.,]+)\s*(?P[\w^_]+)' -- cgit v1.2.3 From d651ed468f2f38c7e81fa9c7945b3e996461e8bb Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 1 Dec 2014 18:52:21 +0100 Subject: [SafesharingEu] Cleanup --- module/plugins/accounts/SafesharingEu.py | 11 ++++------- module/plugins/hoster/SafesharingEu.py | 25 +++++++------------------ 2 files changed, 11 insertions(+), 25 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/accounts/SafesharingEu.py b/module/plugins/accounts/SafesharingEu.py index a2b964cba..2e58d33b3 100644 --- a/module/plugins/accounts/SafesharingEu.py +++ b/module/plugins/accounts/SafesharingEu.py @@ -4,16 +4,13 @@ from module.plugins.internal.XFSAccount import XFSAccount class SafesharingEu(XFSAccount): - __name__ = "SafesharingEu" - __type__ = "account" + __name__ = "SafesharingEu" + __type__ = "account" __version__ = "0.02" __description__ = """Safesharing.eu account plugin""" - __license__ = "GPLv3" - __authors__ = [("guidobelix", "guidobelix@hotmail.it")] + __license__ = "GPLv3" + __authors__ = [("guidobelix", "guidobelix@hotmail.it")] HOSTER_DOMAIN = "safesharing.eu" - - VALID_UNTIL_PATTERN = r'> Premium.[Aa]ccount expire:(.+?)
' - TRAFFIC_LEFT_PATTERN = r'> Traffic available today:\s*?(?P[\d.,]+)\s*?(?:(?P[\w^_]+)\s*)?
' diff --git a/module/plugins/hoster/SafesharingEu.py b/module/plugins/hoster/SafesharingEu.py index 92a0ff932..f0936b9e8 100644 --- a/module/plugins/hoster/SafesharingEu.py +++ b/module/plugins/hoster/SafesharingEu.py @@ -4,31 +4,20 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class SafesharingEu(XFSHoster): - __name__ = "SafesharingEu" - __type__ = "hoster" - __version__ = "0.04" + __name__ = "SafesharingEu" + __type__ = "hoster" + __version__ = "0.05" - __pattern__ = r'https?://(?:\w+\.)?safesharing.eu/\w+' + __pattern__ = r'https?://(?:www\.)?safesharing\.eu/\w{12}' __description__ = """Safesharing.eu hoster plugin""" - __license__ = "GPLv3" - __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] + __license__ = "GPLv3" + __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] - HOSTER_DOMAIN = "safesharing.eu" - - FILE_NAME_PATTERN = r'Filename:(?P.*)' - FILE_SIZE_PATTERN = r'Size:(?P.*) (?P[kKmMbB]*) ' - - FILE_ID_PATTERN = r'' - OFFLINE_PATTERN = r'File Not Found' - TEMP_OFFLINE_PATTERN = r'This server is in maintenance mode' + HOSTER_DOMAIN = "safesharing.eu" WAIT_PATTERN = r'You have to wait (\d+) minutes' - COUNTDOWN_PATTERN = r'
Wait (\d+) seconds' - - RECAPTCHA_KEY_PATTERN = r'' - RANDOM_STRING_PATTERN = r'' ERROR_PATTERN = r'(?:
)(.+?)(?:
)' -- cgit v1.2.3 From 1bcdfb409ded0c369735c413b33f2e344b36bd7a Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 1 Dec 2014 20:00:14 +0100 Subject: Fixes --- module/plugins/hoster/Keep2shareCc.py | 25 +++++++++++-------------- module/plugins/internal/SimpleHoster.py | 4 ++-- 2 files changed, 13 insertions(+), 16 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/Keep2shareCc.py b/module/plugins/hoster/Keep2shareCc.py index a374cc481..7ca29701a 100644 --- a/module/plugins/hoster/Keep2shareCc.py +++ b/module/plugins/hoster/Keep2shareCc.py @@ -36,24 +36,21 @@ class Keep2shareCc(SimpleHoster): CAPTCHA_PATTERN = r'src="(/file/captcha\.html.+?)"' WAIT_PATTERN = r'Please wait ([\d:]+) to download this file' - ERROR_BLOCK_PATTERN = r'Downloading is not possible
.+?' - TEMP_ERROR_PATTERN = r'Download count files exceed|Traffic limit exceed|Free account does not allow to download more than one file at the same time' - ERROR_PATTERN = r'Free user can\'t download large files|You no can access to this file|This download available only for premium users|This is private file' + TEMP_ERROR_PATTERN = r'>\s*(Download count files exceed|Traffic limit exceed|Free account does not allow to download more than one file at the same time)' + ERROR_PATTERN = r'>\s*(Free user can\'t download large files|You no can access to this file|This download available only for premium users|This is private file)' def checkErrors(self): - m = re.search(self.ERROR_BLOCK_PATTERN, self.html, re.S) + m = re.search(self.TEMP_ERROR_PATTERN, self.html) if m: - e = self.info['error'] = m.group(0) - - m = re.search(self.TEMP_ERROR_PATTERN, self.html) - if m: - self.wantReconnect = True - self.retry(wait_time=30 * 60, reason=m.group(0)) + self.info['error'] = m.group(1) + self.wantReconnect = True + self.retry(wait_time=30 * 60, reason=m.group(0)) - m = re.search(self.ERROR_PATTERN, self.html) - if m: - self.error(e) + m = re.search(self.ERROR_PATTERN, self.html) + if m: + e = self.info['error'] = m.group(1) + self.error(e) m = re.search(self.WAIT_PATTERN, self.html) if m: @@ -131,7 +128,7 @@ class Keep2shareCc(SimpleHoster): def _getDownloadLink(self, url): p = urlparse(self.pyfile.url) base = "%s://%s" % (p.scheme, p.netloc) - link = _isDirectLink(url) + link = _isDirectLink(self, url, self.premium) return urljoin(base, link) if link else "" diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 736d15f3a..cf03a1242 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -123,7 +123,7 @@ def _isDirectLink(self, url, resumable=True): location = header['location'] if resumable: #: sometimes http code may be wrong... - if self.load(location, ref=True, cookies=True, just_header=True, decode=True)['location']: + if 'location' in self.load(location, ref=True, cookies=True, just_header=True, decode=True): return "" else: if not 'code' in header or header['code'] != 302: @@ -388,7 +388,7 @@ class SimpleHoster(Hoster): self.checkFile() - def checkFile(self) + def checkFile(self): if self.checkDownload({'empty': re.compile(r"^$")}) is "empty": #@TODO: Move to hoster in 0.4.10 self.fail(_("Empty file")) -- cgit v1.2.3 From eb71f308010e35aaec7f7bfa529ada96975c909d Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 2 Dec 2014 00:04:41 +0100 Subject: [SimpleHoster] Force _isDirectLink to old style --- module/plugins/internal/SimpleHoster.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'module/plugins') diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index cf03a1242..ba718950d 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -122,6 +122,8 @@ def _isDirectLink(self, url, resumable=True): location = header['location'] + resumable = False #@NOTE: Testing... + if resumable: #: sometimes http code may be wrong... if 'location' in self.load(location, ref=True, cookies=True, just_header=True, decode=True): return "" -- cgit v1.2.3 From fd1e0ee870d9b0388db82c6003727dcf1397bf0a Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 2 Dec 2014 00:38:06 +0100 Subject: [NetloadIn] Cleanup --- module/plugins/hoster/NetloadIn.py | 236 ++++++++++++++++++++----------------- 1 file changed, 128 insertions(+), 108 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index 204862144..8cf4a03c0 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -1,14 +1,16 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- import re + +from urlparse import urljoin from time import sleep, time -from module.plugins.Hoster import Hoster from module.network.RequestFactory import getURL +from module.plugins.Hoster import Hoster from module.plugins.Plugin import chunks from module.plugins.internal.CaptchaService import ReCaptcha + def getInfo(urls): ## returns list of tupels (name, size (in bytes), status (see FileDatabase), url) @@ -26,10 +28,11 @@ def getInfo(urls): api = getURL(apiurl + ids, decode=True) if api is None or len(api) < 10: - print "Netload prefetch: failed " + self.logDebug("Prefetch failed") return + if api.find("unknown_auth") >= 0: - print "Netload prefetch: Outdated auth code " + self.logDebug("Outdated auth code") return result = [] @@ -37,50 +40,59 @@ def getInfo(urls): for i, r in enumerate(api.splitlines()): try: tmp = r.split(";") + try: size = int(tmp[2]) - except: + except Exception: size = 0 + result.append((tmp[1], size, 2 if tmp[3] == "online" else 1, chunk[i] )) - except: - print "Netload prefetch: Error while processing response: " - print r + + except Exception: + self.logDebug("Error while processing response: %s" % r) yield result class NetloadIn(Hoster): - __name__ = "NetloadIn" - __type__ = "hoster" - __pattern__ = r"https?://.*netload\.in/(?:datei(.*?)(?:\.htm|/)|index.php?id=10&file_id=)" - __version__ = "0.451" - __description__ = """Netload.in Download Hoster""" - __author_name__ = ("spoob", "RaNaN", "Gregy") - __author_mail__ = ("spoob@pyload.org", "ranan@pyload.org", "gregy@gregy.cz") - RECAPTCHA_KEY="6LcLJMQSAAAAAJzquPUPKNovIhbK6LpSqCjYrsR1" + __name__ = "NetloadIn" + __type__ = "hoster" + __version__ = "0.46" + + __pattern__ = r'https?://(?:[^/]*\.)?netload\.in/(?:datei(.*?)(?:\.htm|/)|index\.php?id=10&file_id=)' + + __description__ = """Netload.in hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("spoob", "spoob@pyload.org"), + ("RaNaN", "ranan@pyload.org"), + ("Gregy", "gregy@gregy.cz")] + def setup(self): - self.multiDL = False - if self.premium: - self.multiDL = True - self.chunkLimit = -1 - self.resumeDownload = True + self.multiDL = self.resumeDownload = self.premium + def process(self, pyfile): self.url = pyfile.url + self.prepare() - self.pyfile.setStatus("downloading") + + pyfile.setStatus("downloading") + self.proceed(self.url) + def prepare(self): self.download_api_data() - if self.api_data and self.api_data["filename"]: - self.pyfile.name = self.api_data["filename"] + if self.api_data and self.api_data['filename']: + self.pyfile.name = self.api_data['filename'] if self.premium: - self.logDebug("Netload: Use Premium Account") + self.logDebug(" Use Premium Account") + settings = self.load("http://www.netload.in/index.php?id=2&lang=en") + if '