From 01e76034bcad5e5aab7f6e141782071e5c328649 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 6 Jul 2014 19:08:06 +0200 Subject: Fix account checkLogin + related code cosmetics --- module/plugins/hoster/NetloadIn.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/NetloadIn.py') diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index 4b8842d18..a011d87b4 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -176,9 +176,9 @@ class NetloadIn(Hoster): return True if ">An access request has been made from IP address <" in page: wait = self.get_wait_time(page) - if wait == 0: + if not wait: self.logDebug("Netload: Wait was 0 setting 30") - wait = 30 + wait = 30 * 60 self.logInfo(_("Netload: waiting between downloads %d s." % wait)) self.wantReconnect = True self.setWait(wait) -- cgit v1.2.3 From 5060e4c6374a5116d0d8b02528f910f8c5f8bcf9 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 15 Jul 2014 16:25:41 +0200 Subject: Fix code indentation, some bad whitespaces and missing authors + use 'not' instead 'is None' + replace __pattern__'s r" with r' + other minor cosmetics --- module/plugins/hoster/NetloadIn.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/NetloadIn.py') diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index a011d87b4..043de5463 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -24,7 +24,7 @@ def getInfo(urls): api = getURL(apiurl + ids, decode=True) - if api is None or len(api) < 10: + if not api or len(api) < 10: print "Netload prefetch: failed " return if api.find("unknown_auth") >= 0: -- cgit v1.2.3 From 7b8c458cca7d21a029620f98e453f746fce69cd1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 14 Jul 2014 16:10:01 +0200 Subject: Prefer single quote for dict key name --- module/plugins/hoster/NetloadIn.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'module/plugins/hoster/NetloadIn.py') diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index 043de5463..5431ebb9a 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -69,8 +69,8 @@ class NetloadIn(Hoster): 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") @@ -113,13 +113,13 @@ class NetloadIn(Hoster): self.api_data = {} if src and ";" in src and src not in ("unknown file_data", "unknown_server_data", "No input file specified."): lines = src.split(";") - self.api_data["exists"] = True - self.api_data["fileid"] = lines[0] - self.api_data["filename"] = lines[1] - self.api_data["size"] = lines[2] - self.api_data["status"] = lines[3] - if self.api_data["status"] == "online": - self.api_data["checksum"] = lines[4].strip() + self.api_data['exists'] = True + self.api_data['fileid'] = lines[0] + self.api_data['filename'] = lines[1] + self.api_data['size'] = lines[2] + self.api_data['status'] = lines[3] + if self.api_data['status'] == "online": + self.api_data['checksum'] = lines[4].strip() else: self.api_data = False # check manually since api data is useless sometimes -- cgit v1.2.3 From 05d258d98dd8c2faf0b769840fa1e3c4acccdce8 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 20 Jul 2014 03:25:14 +0200 Subject: Fix and improve 5060e4c6374a5116d0d8b02528f910f8c5f8bcf9 --- module/plugins/hoster/NetloadIn.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/NetloadIn.py') diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index 5431ebb9a..2baeed5da 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -24,7 +24,7 @@ def getInfo(urls): api = getURL(apiurl + ids, decode=True) - if not api or len(api) < 10: + if api is None or len(api) < 10: print "Netload prefetch: failed " return if api.find("unknown_auth") >= 0: -- cgit v1.2.3 From ba916633f2bedb04c7358000b91aed69f52e8e43 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 1 Aug 2014 19:35:59 +0200 Subject: Remove trailing whitespaces + remove license headers + import urllib methods directly + sort and fix key attributes + use save_join instead join + sort some import declarations + other minor code cosmetics --- module/plugins/hoster/NetloadIn.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'module/plugins/hoster/NetloadIn.py') diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index 2baeed5da..a45aafa63 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -1,10 +1,11 @@ # -*- coding: utf-8 -*- import re + 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 @@ -51,12 +52,15 @@ def getInfo(urls): class NetloadIn(Hoster): __name__ = "NetloadIn" __type__ = "hoster" - __pattern__ = r'https?://(?:[^/]*\.)?netload\.in/(?:datei(.*?)(?:\.htm|/)|index.php?id=10&file_id=)' __version__ = "0.45" + + __pattern__ = r'https?://(?:[^/]*\.)?netload\.in/(?:datei(.*?)(?:\.htm|/)|index.php?id=10&file_id=)' + __description__ = """Netload.in hoster plugin""" __author_name__ = ("spoob", "RaNaN", "Gregy") __author_mail__ = ("spoob@pyload.org", "ranan@pyload.org", "gregy@gregy.cz") + def setup(self): self.multiDL = self.resumeDownload = self.premium @@ -151,7 +155,7 @@ class NetloadIn(Hoster): self.offline() name = re.search(r'class="dl_first_filename">([^<]+)', page, re.MULTILINE) - # the found filename is not truncated + # the found filename is not truncated if name: name = name.group(1).strip() if not name.endswith(".."): -- cgit v1.2.3 From b0868ae6446078bacf1635dde5e4ab316b4a94cb Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 7 Oct 2014 18:57:59 +0200 Subject: New __authors__ key replaces __author_name__ and __author_mail__ + Whitespaces and EOF fixup --- module/plugins/hoster/NetloadIn.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/NetloadIn.py') diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index a45aafa63..ec68c08f7 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -57,8 +57,9 @@ class NetloadIn(Hoster): __pattern__ = r'https?://(?:[^/]*\.)?netload\.in/(?:datei(.*?)(?:\.htm|/)|index.php?id=10&file_id=)' __description__ = """Netload.in hoster plugin""" - __author_name__ = ("spoob", "RaNaN", "Gregy") - __author_mail__ = ("spoob@pyload.org", "ranan@pyload.org", "gregy@gregy.cz") + __authors__ = [("spoob", "spoob@pyload.org"), + ("RaNaN", "ranan@pyload.org"), + ("Gregy", "gregy@gregy.cz")] def setup(self): -- cgit v1.2.3 From ae7a7e66981456e5bbe2b54006d79b6f907be7a4 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 8 Oct 2014 20:18:13 +0200 Subject: Add __license__ key attribute to plugins --- module/plugins/hoster/NetloadIn.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/hoster/NetloadIn.py') diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index ec68c08f7..fe00e1565 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -57,6 +57,7 @@ class NetloadIn(Hoster): __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")] -- cgit v1.2.3 From c5d1a4fd8943877c6d2eb3843e0de725dba5191e Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 11 Oct 2014 15:09:53 +0200 Subject: Pattern update 2 --- module/plugins/hoster/NetloadIn.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/NetloadIn.py') diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index fe00e1565..becfa56dd 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -54,7 +54,7 @@ class NetloadIn(Hoster): __type__ = "hoster" __version__ = "0.45" - __pattern__ = r'https?://(?:[^/]*\.)?netload\.in/(?:datei(.*?)(?:\.htm|/)|index.php?id=10&file_id=)' + __pattern__ = r'https?://(?:[^/]*\.)?netload\.in/(?:datei(.*?)(?:\.htm|/)|index\.php?id=10&file_id=)' __description__ = """Netload.in hoster plugin""" __license__ = "GPLv3" -- cgit v1.2.3 From 8939f015a688a07ec7d0bd14b6a3704f6a2cb4a0 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 11 Oct 2014 15:12:40 +0200 Subject: Pattern update 3 --- module/plugins/hoster/NetloadIn.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/NetloadIn.py') diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index becfa56dd..0c255afbe 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -229,13 +229,13 @@ class NetloadIn(Hoster): def get_file_url(self, page): try: - file_url_pattern = r"Or click here" + file_url_pattern = r'Or click here' attempt = re.search(file_url_pattern, page) if attempt is not None: return attempt.group(1) else: self.logDebug("Netload: Backup try for final link") - file_url_pattern = r"Click here" + file_url_pattern = r'Click here' attempt = re.search(file_url_pattern, page) return "http://netload.in/" + attempt.group(1) except: -- cgit v1.2.3 From 0eb6e7ec4a1144dcca824d8add049787d3da1762 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 22 Oct 2014 19:44:59 +0200 Subject: Two space before function declaration --- module/plugins/hoster/NetloadIn.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'module/plugins/hoster/NetloadIn.py') diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index 0c255afbe..800de3068 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -66,12 +66,14 @@ class NetloadIn(Hoster): def setup(self): self.multiDL = self.resumeDownload = self.premium + def process(self, pyfile): self.url = pyfile.url self.prepare() pyfile.setStatus("downloading") self.proceed(self.url) + def prepare(self): self.download_api_data() @@ -93,6 +95,7 @@ class NetloadIn(Hoster): self.fail("Failed") return False + def download_api_data(self, n=0): url = self.url id_regex = re.compile(self.__pattern__) @@ -134,6 +137,7 @@ class NetloadIn(Hoster): else: self.api_data = False + def final_wait(self, page): wait_time = self.get_wait_time(page) self.setWait(wait_time) @@ -141,6 +145,7 @@ class NetloadIn(Hoster): self.wait() self.url = self.get_file_url(page) + def download_html(self): self.logDebug("Netload: Entering download_html") page = self.load(self.url, decode=True) @@ -227,6 +232,7 @@ class NetloadIn(Hoster): return False + def get_file_url(self, page): try: file_url_pattern = r'Or click here' @@ -242,10 +248,12 @@ class NetloadIn(Hoster): self.logDebug("Netload: Getting final link failed") return None + def get_wait_time(self, page): wait_seconds = int(re.search(r"countdown\((.+),'change\(\)'\)", page).group(1)) / 100 return wait_seconds + def proceed(self, url): self.logDebug("Netload: Downloading..") -- cgit v1.2.3 From 4da90891eb2544ac15a7d512aba8cb357f68ee5f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 25 Oct 2014 01:11:29 +0200 Subject: Spare code cosmetics --- module/plugins/hoster/NetloadIn.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/NetloadIn.py') diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index 800de3068..ffacc9c66 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -161,7 +161,7 @@ class NetloadIn(Hoster): if "* The file was deleted" in page: self.offline() - name = re.search(r'class="dl_first_filename">([^<]+)', page, re.MULTILINE) + name = re.search(r'class="dl_first_filename">([^<]+)', page, re.M) # the found filename is not truncated if name: name = name.group(1).strip() -- cgit v1.2.3 From 9f2ebe486a3e155fb6a60e07cccb77ab6a772eb2 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 26 Oct 2014 02:31:54 +0200 Subject: Extend translation support in plugins + a lot of code cosmetics and typo fixes --- module/plugins/hoster/NetloadIn.py | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'module/plugins/hoster/NetloadIn.py') diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index ffacc9c66..2d4773bac 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -81,7 +81,7 @@ class NetloadIn(Hoster): 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 'Click here' attempt = re.search(file_url_pattern, page) return "http://netload.in/" + attempt.group(1) except: - self.logDebug("Netload: Getting final link failed") + self.logDebug("Getting final link failed") return None @@ -255,7 +255,7 @@ class NetloadIn(Hoster): def proceed(self, url): - self.logDebug("Netload: Downloading..") + self.logDebug("Downloading..") self.download(url, disposition=True) -- cgit v1.2.3 From 146fe1e309c33ab149bfaf58ad86c0dd4fb9b156 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 27 Oct 2014 01:18:45 +0100 Subject: Spare code cosmetics --- module/plugins/hoster/NetloadIn.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/hoster/NetloadIn.py') diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index 2d4773bac..2f0c6e2a8 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -26,10 +26,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 " + print + self.logDebug("Outdated auth code") return result = [] @@ -43,8 +44,7 @@ def getInfo(urls): 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 + self.logDebug("Error while processing response: %s" % r) yield result -- cgit v1.2.3 From 8b3589dd394d81177bf4680dddb5bdb9506b89ea Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 28 Oct 2014 16:04:10 +0100 Subject: Update plugins to last changes --- module/plugins/hoster/NetloadIn.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'module/plugins/hoster/NetloadIn.py') diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index 2f0c6e2a8..d4980ceca 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -191,8 +191,7 @@ class NetloadIn(Hoster): self.logDebug("Wait was 0 setting 30") wait = 30 * 60 self.logInfo(_("Waiting between downloads %d seconds") % wait) - self.wantReconnect = True - self.setWait(wait) + self.setWait(wait, True) self.wait() return self.download_html() -- cgit v1.2.3 From 34984dae733c3f3d47b41a0acfba3724d53c65a1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 28 Oct 2014 16:52:10 +0100 Subject: Code cosmetics: plugin class attributes --- module/plugins/hoster/NetloadIn.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'module/plugins/hoster/NetloadIn.py') diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index d4980ceca..bfa1cc932 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -50,17 +50,17 @@ def getInfo(urls): class NetloadIn(Hoster): - __name__ = "NetloadIn" - __type__ = "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")] + __license__ = "GPLv3" + __authors__ = [("spoob", "spoob@pyload.org"), + ("RaNaN", "ranan@pyload.org"), + ("Gregy", "gregy@gregy.cz")] def setup(self): -- cgit v1.2.3 From c9e31d875d32de31e54959b82bc35eff2b3e0f3f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 10 Nov 2014 00:19:51 +0100 Subject: Code cosmetics --- module/plugins/hoster/NetloadIn.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'module/plugins/hoster/NetloadIn.py') diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index bfa1cc932..549ecb667 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -110,18 +110,18 @@ class NetloadIn(Hoster): return apiurl = "http://api.netload.in/info.php" - src = self.load(apiurl, cookies=False, + html = self.load(apiurl, cookies=False, get={"file_id": match.group(1), "auth": "Zf9SnQh9WiReEsb18akjvQGqT0I830e8", "bz": "1", "md5": "1"}, decode=True).strip() - if not src and n <= 3: + if not html and n <= 3: sleep(0.2) self.download_api_data(n + 1) return - self.logDebug("APIDATA: " + src) + self.logDebug("APIDATA: " + html) self.api_data = {} - if src and ";" in src and src not in ("unknown file_data", "unknown_server_data", "No input file specified."): - lines = src.split(";") + if html and ";" in html and html not in ("unknown file_data", "unknown_server_data", "No input file specified."): + lines = html.split(";") self.api_data['exists'] = True self.api_data['fileid'] = lines[0] self.api_data['filename'] = lines[1] -- 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/hoster/NetloadIn.py') 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 'Or click here' + file_url_pattern = r"Or click here" attempt = re.search(file_url_pattern, page) if attempt is not None: return attempt.group(1) else: - self.logDebug("Backup try for final link") - file_url_pattern = r'Click here' + self.logDebug("Netload: Backup try for final link") + file_url_pattern = r"Click here" attempt = re.search(file_url_pattern, page) return "http://netload.in/" + attempt.group(1) - except: - self.logDebug("Getting final link failed") + except Exception as e: + self.logDebug("Netload: Getting final link failed; " + e.message) return None - def get_wait_time(self, page): wait_seconds = int(re.search(r"countdown\((.+),'change\(\)'\)", page).group(1)) / 100 - return wait_seconds - + return wait_seconds def proceed(self, url): - self.logDebug("Downloading..") + self.logDebug("Netload: Downloading.." + url) self.download(url, disposition=True) -- cgit v1.2.3 From 17c5924c57a7e3c243b3915094f10dba6c47ff73 Mon Sep 17 00:00:00 2001 From: Christian Plesche Date: Sun, 23 Nov 2014 20:53:05 +0100 Subject: Update NetloadIn.py some code cleanup --- module/plugins/hoster/NetloadIn.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'module/plugins/hoster/NetloadIn.py') diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index 4efd3839b..a912b438a 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -158,7 +158,7 @@ class NetloadIn(Hoster): def download_html(self): - self.logDebug("Netload: Entering download_html (%s)" % self.url) + #self.logDebug("Netload: Entering download_html (%s)" % self.url) page = self.load(self.url, decode=True) t = time() + 30 @@ -180,7 +180,7 @@ class NetloadIn(Hoster): self.pyfile.name = name captchawaited = False - for i in range(2): + for i in range(5): if not page: page = self.load(self.url) @@ -258,11 +258,9 @@ class NetloadIn(Hoster): def proceed(self, url): self.logDebug("Netload: Downloading.." + url) - self.download(url, disposition=True) check = self.checkDownload({"empty": re.compile(r"^$"), "offline": re.compile("The file was deleted")}) - if check == "empty": self.logInfo(_("Downloaded File was empty")) self.retry() -- cgit v1.2.3 From be53f2b117c091770ce58f5d2ab479fc1bb57c47 Mon Sep 17 00:00:00 2001 From: Christian Plesche Date: Sun, 23 Nov 2014 23:54:55 +0100 Subject: Update NetloadIn.py restart after waiting period --- module/plugins/hoster/NetloadIn.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'module/plugins/hoster/NetloadIn.py') diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index a912b438a..204862144 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -223,17 +223,18 @@ class NetloadIn(Hoster): break if self.check_free_wait(response_page): - self.logDebug("Had to wait for next free slot:") + self.logDebug("Had to wait for next free slot, trying again") + return self.download_html() else: download_url = self.get_file_url(response_page) self.logDebug("Download URL after get_file: " + download_url) - if not download_url.startswith("http://"): + if not download_url.startswith("http://"): self.error("download url: %s" % download_url) - self.wait() + self.wait() - self.url = download_url - #self.logDebug("download_url: " + download_url) - break + self.url = download_url + #self.logDebug("download_url: " + download_url) + break return True def get_file_url(self, page): -- 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/hoster/NetloadIn.py') 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 'Or click here" + file_url_pattern = r'Or click here' attempt = re.search(file_url_pattern, page) if attempt is not None: return attempt.group(1) else: - self.logDebug("Netload: Backup try for final link") - file_url_pattern = r"Click here" + self.logDebug(" Backup try for final link") + file_url_pattern = r'Click here' attempt = re.search(file_url_pattern, page) return "http://netload.in/" + attempt.group(1) - except Exception as e: - self.logDebug("Netload: Getting final link failed; " + e.message) + + except Exception, e: + self.logDebug("Getting final link failed", e.message) return None + def get_wait_time(self, page): - wait_seconds = int(re.search(r"countdown\((.+),'change\(\)'\)", page).group(1)) / 100 - return wait_seconds + return int(re.search(r"countdown\((.+),'change\(\)'\)", page).group(1)) / 100 + def proceed(self, url): - self.logDebug("Netload: Downloading.." + url) self.download(url, disposition=True) - check = self.checkDownload({"empty": re.compile(r"^$"), "offline": re.compile("The file was deleted")}) + check = self.checkDownload({'empty' : re.compile(r'^$'), + 'offline': re.compile("The file was deleted")}) if check == "empty": self.logInfo(_("Downloaded File was empty")) self.retry() + elif check == "offline": self.offline() -- cgit v1.2.3 From f3441978ca039c38924bd3b1d0019ca92f8a12d0 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 3 Dec 2014 22:38:59 +0100 Subject: [NetloadIn] Syntax fixup --- module/plugins/hoster/NetloadIn.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'module/plugins/hoster/NetloadIn.py') diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index 8cf4a03c0..b866b51c5 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -57,7 +57,7 @@ def getInfo(urls): class NetloadIn(Hoster): __name__ = "NetloadIn" __type__ = "hoster" - __version__ = "0.46" + __version__ = "0.47" __pattern__ = r'https?://(?:[^/]*\.)?netload\.in/(?:datei(.*?)(?:\.htm|/)|index\.php?id=10&file_id=)' @@ -89,7 +89,7 @@ class NetloadIn(Hoster): self.pyfile.name = self.api_data['filename'] if self.premium: - self.logDebug(" Use Premium Account") + self.logDebug("Use Premium Account") settings = self.load("http://www.netload.in/index.php?id=2&lang=en") @@ -128,7 +128,7 @@ class NetloadIn(Hoster): self.download_api_data(n + 1) return - self.logDebug(" APIDATA: " + html) + self.logDebug("APIDATA: " + html) self.api_data = {} @@ -156,7 +156,7 @@ class NetloadIn(Hoster): self.setWait(wait_time) - self.logDebug(" final wait %d seconds" % wait_time) + self.logDebug("Final wait %d seconds" % wait_time) self.wait() @@ -194,8 +194,8 @@ class NetloadIn(Hoster): self.pyfile.name = name captchawaited = False - for i in range(5): + for i in xrange(5): if not page: page = self.load(self.url) t = time() + 30 @@ -204,20 +204,20 @@ class NetloadIn(Hoster): self.logError(_("Netload HDD Crash")) self.fail(_("File temporarily not available")) - self.logDebug(" try number %d " % i) + self.logDebug("Try number %d " % i) if ">Your download is being prepared.<" in page: - self.logDebug(" We will prepare your download") + self.logDebug("We will prepare your download") self.final_wait(page) return True - self.logDebug(" Trying to find captcha") + self.logDebug("Trying to find captcha") try: - url_captcha_html = re.search('(index.php\?id=10&.*&captcha=1)', page).group(1).replace("amp;", "") + url_captcha_html = re.search(r'(index.php\?id=10&.*&captcha=1)', page).group(1).replace("amp;", "") - except Exception as e: - self.logDebug("exception during Captcha regex: %s" % e.message) + except Exception, e: + self.logDebug("Exception during Captcha regex: %s" % e.message) page = None else: @@ -262,7 +262,7 @@ class NetloadIn(Hoster): if attempt is not None: return attempt.group(1) else: - self.logDebug(" Backup try for final link") + self.logDebug("Backup try for final link") file_url_pattern = r'Click here' attempt = re.search(file_url_pattern, page) return "http://netload.in/" + attempt.group(1) -- cgit v1.2.3 From 67587fbe0335cacfde28a86ba729b9d567ce1da7 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 7 Dec 2014 00:27:18 +0100 Subject: Plugin code cosmetics (3) --- module/plugins/hoster/NetloadIn.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'module/plugins/hoster/NetloadIn.py') diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index b866b51c5..f5c5ee802 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -14,7 +14,7 @@ from module.plugins.internal.CaptchaService import ReCaptcha def getInfo(urls): ## returns list of tupels (name, size (in bytes), status (see FileDatabase), url) - apiurl = "http://api.netload.in/info.php?auth=Zf9SnQh9WiReEsb18akjvQGqT0I830e8&bz=1&md5=1&file_id=" + apiurl = "http://api.netload.in/info.php" id_regex = re.compile(NetloadIn.__pattern__) urls_per_query = 80 @@ -25,7 +25,12 @@ def getInfo(urls): if match: ids = ids + match.group(1) + ";" - api = getURL(apiurl + ids, decode=True) + api = getURL(apiurl, + get={'auth' : "Zf9SnQh9WiReEsb18akjvQGqT0I830e8", + 'bz' : 1, + 'md5' : 1, + 'file_id': ids}, + decode=True) if api is None or len(api) < 10: self.logDebug("Prefetch failed") @@ -91,7 +96,7 @@ class NetloadIn(Hoster): if self.premium: self.logDebug("Use Premium Account") - settings = self.load("http://www.netload.in/index.php?id=2&lang=en") + settings = self.load("http://www.netload.in/index.php", get={'id': 2, 'lang': "en"}) if '