From 7a7e3e211e36af06d00e0effbcc37ac59e152427 Mon Sep 17 00:00:00 2001 From: synweap15 Date: Tue, 8 Jul 2014 20:00:23 +0200 Subject: nopremium.pl files added --- module/plugins/accounts/NoPremiumPl.py | 102 +++++++++++++++++++++++++ module/plugins/hooks/NoPremiumPl.py | 39 ++++++++++ module/plugins/hoster/NoPremiumPl.py | 132 +++++++++++++++++++++++++++++++++ 3 files changed, 273 insertions(+) create mode 100644 module/plugins/accounts/NoPremiumPl.py create mode 100644 module/plugins/hooks/NoPremiumPl.py create mode 100644 module/plugins/hoster/NoPremiumPl.py (limited to 'module/plugins') diff --git a/module/plugins/accounts/NoPremiumPl.py b/module/plugins/accounts/NoPremiumPl.py new file mode 100644 index 000000000..e44a6acff --- /dev/null +++ b/module/plugins/accounts/NoPremiumPl.py @@ -0,0 +1,102 @@ +# !/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +@author: Pawel W. +""" + +from datetime import datetime + +from module.plugins.Account import Account +from module.plugins.internal.SimpleHoster import parseHtmlForm +import re +from time import mktime, strptime +import module.lib.beaker.crypto as crypto + +try: + from json import loads +except ImportError: + from simplejson import loads + +class NoPremiumPl(Account): + __name__ = "NoPremiumPl" + __version__ = "0.01" + __type__ = "account" + __description__ = "NoPremium.pl account plugin" + __author_name__ = ("goddie") + __author_mail__ = ("dev@nopremium.pl") + + _api_url = "http://crypt.nopremium.pl" + + _api_query = { + "site": "nopremium", + "username": "", + "password": "", + "output": "json", + "loc": "1", + "info": "1" + } + + _req = None + _usr = None + _pwd = None + + def loadAccountInfo(self, name, req): + + self._req = req + + try: + result = loads(self.runAuthQuery()) + except: + #todo: ret? + return + + premium = False + valid_untill = -1 + + is_premium = "expire" in result.keys() and result["expire"] is not None + + if is_premium: + + premium = True + valid_untill = mktime(datetime.fromtimestamp(int(result["expire"])).timetuple()) + + traffic_left = result["balance"] * 1024 + + return ({ + "validuntil": valid_untill, + "trafficleft": traffic_left, + "premium": premium + }) + + def login(self, user, data, req): + + self._usr = user + self._pwd = crypto.sha1(crypto.md5(data["password"]).hexdigest()).hexdigest() + + self._req = req + + try: + response = loads(self.runAuthQuery()) + except: + self.wrongPassword() + + if "errno" in response.keys(): + self.wrongPassword() + + data['usr'] = self._usr + data['pwd'] = self._pwd + + def createAuthQuery(self): + + query = self._api_query + query["username"] = self._usr + query["password"] = self._pwd + + return query + + def runAuthQuery(self): + + data = self._req.load(self._api_url, post=self.createAuthQuery()) + + return data \ No newline at end of file diff --git a/module/plugins/hooks/NoPremiumPl.py b/module/plugins/hooks/NoPremiumPl.py new file mode 100644 index 000000000..154d748f1 --- /dev/null +++ b/module/plugins/hooks/NoPremiumPl.py @@ -0,0 +1,39 @@ +# !/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +@author: Pawel W. +""" + +from module.plugins.internal.MultiHoster import MultiHoster +from module.network.RequestFactory import getURL + +try: + from json import loads +except ImportError: + from simplejson import loads + +class NoPremiumPl(MultiHoster): + __name__ = "NoPremiumPl" + __version__ = "0.01" + __type__ = "hook" + + __config__ = [("activated", "bool", "Activated", "False"), + ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), + ("hosterList", "str", "Hoster list (comma separated)", ""), + ("unloadFailing", "bool", "Try standard download if download fails", "False"), + ("interval", "int", "Reload supported hosts interval in hours (0 to disable)", "24")] + + __description__ = "NoPremium.pl hook" + __author_name__ = ("goddie") + __author_mail__ = ("dev@nopremium.pl") + + def getHoster(self): + + hostings = loads(getURL("https://www.nopremium.pl/clipboard.php?json=3").strip()) + return [domain for row in hostings for domain in row["domains"] if row["sdownload"] == "0"] + + def getHosterCached(self): + return self.getHoster() + + diff --git a/module/plugins/hoster/NoPremiumPl.py b/module/plugins/hoster/NoPremiumPl.py new file mode 100644 index 000000000..7f61261b9 --- /dev/null +++ b/module/plugins/hoster/NoPremiumPl.py @@ -0,0 +1,132 @@ +# !/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +@author: Pawel W. +""" + +try: + from json import loads, dumps +except ImportError: + from simplejson import loads + +from module.plugins.internal.SimpleHoster import SimpleHoster + + +class NoPremiumPl(SimpleHoster): + + __name__ = "NoPremiumPl" + __version__ = "0.01" + __type__ = "hoster" + + __description__ = "NoPremium.pl hoster plugin" + __author_name__ = ("goddie") + __author_mail__ = ("dev@nopremium.pl") + + _api_url = "http://crypt.nopremium.pl" + + _api_query = {"site": "nopremium", + "output": "json", + "username": "", + "password": "", + "url": ""} + + _usr = False + _pwd = False + + def setup(self): + + self.resumeDownload = True + self.multiDL = True + + def get_username_password(self): + + if not self.account: + + self.fail("[NoPremium.pl] Zaloguj się we wtyczce NoPremium.pl lub ją wyłącz") + + else: + + self._usr = self.account.getAccountData(self.user).get('usr') + self._pwd = self.account.getAccountData(self.user).get('pwd') + + def runFileQuery(self, url, mode=None): + + query = self._api_query.copy() + + query["username"] = self._usr + query["password"] = self._pwd + + query["url"] = url + + if mode == "fileinfo": + query['check'] = 2 + query['loc'] = 1 + + self.logDebug(query) + + return self.load(self._api_url, post=query) + + def process(self, pyfile): + + self.get_username_password() + + try: + data = self.runFileQuery(pyfile.url, 'fileinfo') + except Exception as e: + self.logDebug(str(e)) + self.tempOffline() + + try: + parsed = loads(data) + except Exception as e: + self.logDebug(str(e)) + self.tempOffline() + + self.logDebug(parsed) + + if "errno" in parsed.keys(): + + if parsed["errno"] == 0: + self.fail("[NoPremium.pl] Niepoprawne dane logowania") + + elif parsed["errno"] == 80: + self.fail("[NoPremium.pl] Zbyt dużo niepoprawnych logowań, konto zablokowane na 24h") + + elif parsed["errno"] == 1: + self.fail("[NoPremium.pl] Za mało transferu - doładuj aby pobrać") + + elif parsed["errno"] == 9: + self.fail("[NoPremium.pl] Konto wygasło") + + elif parsed["errno"] == 2: + self.fail("[NoPremium.pl] Niepoprawny / wygasły link") + + elif parsed["errno"] == 3: + self.fail("[NoPremium.pl] Błąd łączenia z hostingiem") + + elif parsed["errno"] == 15: + self.fail("[NoPremium.pl] Hosting nie jest już wspierany") + + else: + self.fail( + parsed["errstring"] + or "Nieznany błąd (kod: {})".format(parsed["errno"]) + ) + + if "sdownload" in parsed: + if parsed["sdownload"] == "1": + self.fail( + "Pobieranie z {} jest możliwe tylko przy bezpośrednim użyciu \ + NoPremium.pl. Zaktualizuj wtyczkę.".format(parsed["hosting"])) + + pyfile.name = parsed["filename"] + pyfile.size = parsed["filesize"] + + try: + result_dl = self.runFileQuery(pyfile.url, 'filedownload') + except Exception as e: + self.logDebug(str(e)) + self.tempOffline() + + self.download(result_dl, disposition=True) -- cgit v1.2.3 From 2404538888ced4e6964df55823d0514b1c0ba685 Mon Sep 17 00:00:00 2001 From: synweap15 Date: Tue, 8 Jul 2014 20:03:27 +0200 Subject: rapideo.pl files added --- module/plugins/accounts/RapideoPl.py | 102 +++++++++++++++++++++++++++ module/plugins/hooks/RapideoPl.py | 38 ++++++++++ module/plugins/hoster/RapideoPl.py | 132 +++++++++++++++++++++++++++++++++++ 3 files changed, 272 insertions(+) create mode 100644 module/plugins/accounts/RapideoPl.py create mode 100644 module/plugins/hooks/RapideoPl.py create mode 100644 module/plugins/hoster/RapideoPl.py (limited to 'module/plugins') diff --git a/module/plugins/accounts/RapideoPl.py b/module/plugins/accounts/RapideoPl.py new file mode 100644 index 000000000..f7343cf02 --- /dev/null +++ b/module/plugins/accounts/RapideoPl.py @@ -0,0 +1,102 @@ +# !/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +@author: Pawel W. +""" + +from datetime import datetime + +from module.plugins.Account import Account +from module.plugins.internal.SimpleHoster import parseHtmlForm +import re +from time import mktime, strptime +import module.lib.beaker.crypto as crypto + +try: + from json import loads +except ImportError: + from simplejson import loads + +class RapideoPl(Account): + __name__ = "RapideoPl" + __version__ = "0.01" + __type__ = "account" + __description__ = "Rapideo.pl account plugin" + __author_name__ = ("goddie") + __author_mail__ = ("dev@rapideo.pl") + + _api_url = "http://enc.rapideo.pl" + + _api_query = { + "site": "newrd", + "username": "", + "password": "", + "output": "json", + "loc": "1", + "info": "1" + } + + _req = None + _usr = None + _pwd = None + + def loadAccountInfo(self, name, req): + + self._req = req + + try: + result = loads(self.runAuthQuery()) + except: + #todo: ret? + return + + premium = False + valid_untill = -1 + + is_premium = "expire" in result.keys() and result["expire"] is not None + + if is_premium: + + premium = True + valid_untill = mktime(datetime.fromtimestamp(int(result["expire"])).timetuple()) + + traffic_left = result["balance"] + + return ({ + "validuntil": valid_untill, + "trafficleft": traffic_left, + "premium": premium + }) + + def login(self, user, data, req): + + self._usr = user + self._pwd = crypto.md5(data["password"]).hexdigest() + + self._req = req + + try: + response = loads(self.runAuthQuery()) + except: + self.wrongPassword() + + if "errno" in response.keys(): + self.wrongPassword() + + data['usr'] = user + data['pwd'] = crypto.md5(data['password']).hexdigest() + + def createAuthQuery(self): + + query = self._api_query + query["username"] = self._usr + query["password"] = self._pwd + + return query + + def runAuthQuery(self): + + data = self._req.load(self._api_url, post=self.createAuthQuery()) + + return data \ No newline at end of file diff --git a/module/plugins/hooks/RapideoPl.py b/module/plugins/hooks/RapideoPl.py new file mode 100644 index 000000000..5d7673826 --- /dev/null +++ b/module/plugins/hooks/RapideoPl.py @@ -0,0 +1,38 @@ +# !/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +@author: Pawel W. +""" +from module.plugins.internal.MultiHoster import MultiHoster +from module.network.RequestFactory import getURL + +try: + from json import loads +except ImportError: + from simplejson import loads + +class RapideoPl(MultiHoster): + __name__ = "RapideoPl" + __version__ = "0.01" + __type__ = "hook" + + __config__ = [("activated", "bool", "Activated", "False"), + ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), + ("hosterList", "str", "Hoster list (comma separated)", ""), + ("unloadFailing", "bool", "Try standard download if download fails", "False"), + ("interval", "int", "Reload supported hosts interval in hours (0 to disable)", "24")] + + __description__ = "Rapideo.pl hook" + __author_name__ = ("goddie") + __author_mail__ = ("dev@rapideo.pl") + + def getHoster(self): + + hostings = loads(getURL("https://www.rapideo.pl/clipboard.php?json=3").strip()) + return [domain for row in hostings for domain in row["domains"] if row["sdownload"] == "0"] + + def getHosterCached(self): + return self.getHoster() + + diff --git a/module/plugins/hoster/RapideoPl.py b/module/plugins/hoster/RapideoPl.py new file mode 100644 index 000000000..4d497faa9 --- /dev/null +++ b/module/plugins/hoster/RapideoPl.py @@ -0,0 +1,132 @@ +# !/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +@author: Pawel W. +""" + +try: + from json import loads, dumps +except ImportError: + from simplejson import loads + +from module.plugins.internal.SimpleHoster import SimpleHoster + + +class RapideoPl(SimpleHoster): + + __name__ = "RapideoPl" + __version__ = "0.01" + __type__ = "hoster" + + __description__ = "Rapideo.pl hoster plugin" + __author_name__ = ("goddie") + __author_mail__ = ("dev@rapideo.pl") + + _api_url = "http://enc.rapideo.pl" + + _api_query = {"site": "newrd", + "output": "json", + "username": "", + "password": "", + "url": ""} + + _usr = False + _pwd = False + + def setup(self): + + self.resumeDownload = True + self.multiDL = True + + def get_username_password(self): + + if not self.account: + + self.fail("[Rapideo.pl] Login to Rapideo.pl plugin or turn plugin off") + + else: + + self._usr = self.account.getAccountData(self.user).get('usr') + self._pwd = self.account.getAccountData(self.user).get('pwd') + + def runFileQuery(self, url, mode=None): + + query = self._api_query.copy() + + query["username"] = self._usr + query["password"] = self._pwd + + query["url"] = url + + if mode == "fileinfo": + query['check'] = 2 + query['loc'] = 1 + + self.logDebug(query) + + return self.load(self._api_url, post=query) + + def process(self, pyfile): + + self.get_username_password() + + try: + data = self.runFileQuery(pyfile.url, 'fileinfo') + except Exception as e: + self.logDebug(str(e)) + self.tempOffline() + + try: + parsed = loads(data) + except Exception as e: + self.logDebug(str(e)) + self.tempOffline() + + self.logDebug(parsed) + + if "errno" in parsed.keys(): + + if parsed["errno"] == 0: + self.fail("[Rapideo.pl] Invalid account credentials") + + elif parsed["errno"] == 80: + self.fail("[Rapideo.pl] Too much incorrect login attempts, account blocked for 24h") + + elif parsed["errno"] == 1: + self.fail("[Rapideo.pl] Not enough transfer - top up to download") + + elif parsed["errno"] == 9: + self.fail("[Rapideo.pl] Account expired") + + elif parsed["errno"] == 2: + self.fail("[Rapideo.pl] Invalid / dead link") + + elif parsed["errno"] == 3: + self.fail("[Rapideo.pl] Error connecting to host") + + elif parsed["errno"] == 15: + self.fail("[Rapideo.pl] Hosting no longer supported") + + else: + self.fail( + parsed["errstring"] + or "Unknown error (code: {})".format(parsed["errno"]) + ) + + if "sdownload" in parsed: + if parsed["sdownload"] == "1": + self.fail( + "Download from {} is possible only when using \ + Rapideo.pl directly. Update this plugin.".format(parsed["hosting"])) + + pyfile.name = parsed["filename"] + pyfile.size = parsed["filesize"] + + try: + result_dl = self.runFileQuery(pyfile.url, 'filedownload') + except Exception as e: + self.logDebug(str(e)) + self.tempOffline() + + self.download(result_dl, disposition=True) -- cgit v1.2.3 From fa0db462b06e2d6b64b3b07ed2d7d6c31de22448 Mon Sep 17 00:00:00 2001 From: synweap15 Date: Tue, 8 Jul 2014 20:10:53 +0200 Subject: to-do & small simplification in username and password saving --- module/plugins/accounts/RapideoPl.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/accounts/RapideoPl.py b/module/plugins/accounts/RapideoPl.py index f7343cf02..8abfa4989 100644 --- a/module/plugins/accounts/RapideoPl.py +++ b/module/plugins/accounts/RapideoPl.py @@ -48,7 +48,7 @@ class RapideoPl(Account): try: result = loads(self.runAuthQuery()) except: - #todo: ret? + #todo: return or let it be thrown? return premium = False @@ -84,8 +84,8 @@ class RapideoPl(Account): if "errno" in response.keys(): self.wrongPassword() - data['usr'] = user - data['pwd'] = crypto.md5(data['password']).hexdigest() + data['usr'] = self._usr + data['pwd'] = self._pwd def createAuthQuery(self): -- cgit v1.2.3 From 4a33d2e93055299e0108a23e0f2615e5cfd422f2 Mon Sep 17 00:00:00 2001 From: synweap15 Date: Tue, 8 Jul 2014 20:12:15 +0200 Subject: to-do elaborate --- module/plugins/accounts/NoPremiumPl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins') diff --git a/module/plugins/accounts/NoPremiumPl.py b/module/plugins/accounts/NoPremiumPl.py index e44a6acff..7ba89b881 100644 --- a/module/plugins/accounts/NoPremiumPl.py +++ b/module/plugins/accounts/NoPremiumPl.py @@ -48,7 +48,7 @@ class NoPremiumPl(Account): try: result = loads(self.runAuthQuery()) except: - #todo: ret? + #todo: return or let it be thrown? return premium = False -- cgit v1.2.3 From ccf15e75c12ad1e8347fdff834f8c62e5e2ab617 Mon Sep 17 00:00:00 2001 From: synweap15 Date: Tue, 8 Jul 2014 21:33:01 +0200 Subject: remove redundant author information --- module/plugins/accounts/NoPremiumPl.py | 4 ---- module/plugins/hooks/NoPremiumPl.py | 4 ---- module/plugins/hoster/NoPremiumPl.py | 4 ---- 3 files changed, 12 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/accounts/NoPremiumPl.py b/module/plugins/accounts/NoPremiumPl.py index 7ba89b881..8cfdbe1a7 100644 --- a/module/plugins/accounts/NoPremiumPl.py +++ b/module/plugins/accounts/NoPremiumPl.py @@ -1,10 +1,6 @@ # !/usr/bin/env python # -*- coding: utf-8 -*- -""" -@author: Pawel W. -""" - from datetime import datetime from module.plugins.Account import Account diff --git a/module/plugins/hooks/NoPremiumPl.py b/module/plugins/hooks/NoPremiumPl.py index 154d748f1..527119c5f 100644 --- a/module/plugins/hooks/NoPremiumPl.py +++ b/module/plugins/hooks/NoPremiumPl.py @@ -1,10 +1,6 @@ # !/usr/bin/env python # -*- coding: utf-8 -*- -""" -@author: Pawel W. -""" - from module.plugins.internal.MultiHoster import MultiHoster from module.network.RequestFactory import getURL diff --git a/module/plugins/hoster/NoPremiumPl.py b/module/plugins/hoster/NoPremiumPl.py index 7f61261b9..b324dff84 100644 --- a/module/plugins/hoster/NoPremiumPl.py +++ b/module/plugins/hoster/NoPremiumPl.py @@ -1,10 +1,6 @@ # !/usr/bin/env python # -*- coding: utf-8 -*- -""" -@author: Pawel W. -""" - try: from json import loads, dumps except ImportError: -- cgit v1.2.3 From ea1cbeda0006bbf427223686892c9e6f87cfbe94 Mon Sep 17 00:00:00 2001 From: synweap15 Date: Tue, 8 Jul 2014 21:36:14 +0200 Subject: remove redundant author information --- module/plugins/accounts/RapideoPl.py | 4 ---- module/plugins/hooks/RapideoPl.py | 3 --- module/plugins/hoster/RapideoPl.py | 4 ---- 3 files changed, 11 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/accounts/RapideoPl.py b/module/plugins/accounts/RapideoPl.py index 8abfa4989..679f7eab0 100644 --- a/module/plugins/accounts/RapideoPl.py +++ b/module/plugins/accounts/RapideoPl.py @@ -1,10 +1,6 @@ # !/usr/bin/env python # -*- coding: utf-8 -*- -""" -@author: Pawel W. -""" - from datetime import datetime from module.plugins.Account import Account diff --git a/module/plugins/hooks/RapideoPl.py b/module/plugins/hooks/RapideoPl.py index 5d7673826..e032b426d 100644 --- a/module/plugins/hooks/RapideoPl.py +++ b/module/plugins/hooks/RapideoPl.py @@ -1,9 +1,6 @@ # !/usr/bin/env python # -*- coding: utf-8 -*- -""" -@author: Pawel W. -""" from module.plugins.internal.MultiHoster import MultiHoster from module.network.RequestFactory import getURL diff --git a/module/plugins/hoster/RapideoPl.py b/module/plugins/hoster/RapideoPl.py index 4d497faa9..4f23bc4a9 100644 --- a/module/plugins/hoster/RapideoPl.py +++ b/module/plugins/hoster/RapideoPl.py @@ -1,10 +1,6 @@ # !/usr/bin/env python # -*- coding: utf-8 -*- -""" -@author: Pawel W. -""" - try: from json import loads, dumps except ImportError: -- cgit v1.2.3 From 2ed13d51ab8cd28f2f3db4caabde9b6d2e2cec25 Mon Sep 17 00:00:00 2001 From: synweap15 Date: Wed, 9 Jul 2014 11:55:23 +0200 Subject: remove enviroment line --- module/plugins/accounts/RapideoPl.py | 1 - module/plugins/hooks/RapideoPl.py | 1 - module/plugins/hoster/RapideoPl.py | 12 ------------ 3 files changed, 14 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/accounts/RapideoPl.py b/module/plugins/accounts/RapideoPl.py index 679f7eab0..0463bba69 100644 --- a/module/plugins/accounts/RapideoPl.py +++ b/module/plugins/accounts/RapideoPl.py @@ -1,4 +1,3 @@ -# !/usr/bin/env python # -*- coding: utf-8 -*- from datetime import datetime diff --git a/module/plugins/hooks/RapideoPl.py b/module/plugins/hooks/RapideoPl.py index e032b426d..fa3df9f84 100644 --- a/module/plugins/hooks/RapideoPl.py +++ b/module/plugins/hooks/RapideoPl.py @@ -1,4 +1,3 @@ -# !/usr/bin/env python # -*- coding: utf-8 -*- from module.plugins.internal.MultiHoster import MultiHoster diff --git a/module/plugins/hoster/RapideoPl.py b/module/plugins/hoster/RapideoPl.py index 4f23bc4a9..b7deaa8ed 100644 --- a/module/plugins/hoster/RapideoPl.py +++ b/module/plugins/hoster/RapideoPl.py @@ -1,4 +1,3 @@ -# !/usr/bin/env python # -*- coding: utf-8 -*- try: @@ -10,11 +9,9 @@ from module.plugins.internal.SimpleHoster import SimpleHoster class RapideoPl(SimpleHoster): - __name__ = "RapideoPl" __version__ = "0.01" __type__ = "hoster" - __description__ = "Rapideo.pl hoster plugin" __author_name__ = ("goddie") __author_mail__ = ("dev@rapideo.pl") @@ -31,28 +28,20 @@ class RapideoPl(SimpleHoster): _pwd = False def setup(self): - self.resumeDownload = True self.multiDL = True def get_username_password(self): - if not self.account: - self.fail("[Rapideo.pl] Login to Rapideo.pl plugin or turn plugin off") - else: - self._usr = self.account.getAccountData(self.user).get('usr') self._pwd = self.account.getAccountData(self.user).get('pwd') def runFileQuery(self, url, mode=None): - query = self._api_query.copy() - query["username"] = self._usr query["password"] = self._pwd - query["url"] = url if mode == "fileinfo": @@ -60,7 +49,6 @@ class RapideoPl(SimpleHoster): query['loc'] = 1 self.logDebug(query) - return self.load(self._api_url, post=query) def process(self, pyfile): -- cgit v1.2.3 From e325412cd71ae329f3f0b7084e5989e6ffbdbd18 Mon Sep 17 00:00:00 2001 From: synweap15 Date: Wed, 9 Jul 2014 11:57:05 +0200 Subject: remove enviroment line --- module/plugins/accounts/NoPremiumPl.py | 1 - module/plugins/hooks/NoPremiumPl.py | 1 - module/plugins/hoster/NoPremiumPl.py | 1 - 3 files changed, 3 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/accounts/NoPremiumPl.py b/module/plugins/accounts/NoPremiumPl.py index 8cfdbe1a7..df9e94a42 100644 --- a/module/plugins/accounts/NoPremiumPl.py +++ b/module/plugins/accounts/NoPremiumPl.py @@ -1,4 +1,3 @@ -# !/usr/bin/env python # -*- coding: utf-8 -*- from datetime import datetime diff --git a/module/plugins/hooks/NoPremiumPl.py b/module/plugins/hooks/NoPremiumPl.py index 527119c5f..ef36331eb 100644 --- a/module/plugins/hooks/NoPremiumPl.py +++ b/module/plugins/hooks/NoPremiumPl.py @@ -1,4 +1,3 @@ -# !/usr/bin/env python # -*- coding: utf-8 -*- from module.plugins.internal.MultiHoster import MultiHoster diff --git a/module/plugins/hoster/NoPremiumPl.py b/module/plugins/hoster/NoPremiumPl.py index b324dff84..7665e589f 100644 --- a/module/plugins/hoster/NoPremiumPl.py +++ b/module/plugins/hoster/NoPremiumPl.py @@ -1,4 +1,3 @@ -# !/usr/bin/env python # -*- coding: utf-8 -*- try: -- cgit v1.2.3 From 352301e4892d311d1a4cf6127f6bc70bc23eede3 Mon Sep 17 00:00:00 2001 From: synweap15 Date: Wed, 9 Jul 2014 12:02:59 +0200 Subject: remove blank lines and unused imports --- module/plugins/accounts/NoPremiumPl.py | 25 +++++++------------------ module/plugins/hooks/NoPremiumPl.py | 2 +- module/plugins/hoster/NoPremiumPl.py | 12 ------------ 3 files changed, 8 insertions(+), 31 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/accounts/NoPremiumPl.py b/module/plugins/accounts/NoPremiumPl.py index df9e94a42..494b559c3 100644 --- a/module/plugins/accounts/NoPremiumPl.py +++ b/module/plugins/accounts/NoPremiumPl.py @@ -3,9 +3,7 @@ from datetime import datetime from module.plugins.Account import Account -from module.plugins.internal.SimpleHoster import parseHtmlForm -import re -from time import mktime, strptime +from time import mktime import module.lib.beaker.crypto as crypto try: @@ -13,6 +11,7 @@ try: except ImportError: from simplejson import loads + class NoPremiumPl(Account): __name__ = "NoPremiumPl" __version__ = "0.01" @@ -37,38 +36,31 @@ class NoPremiumPl(Account): _pwd = None def loadAccountInfo(self, name, req): - self._req = req - try: result = loads(self.runAuthQuery()) except: - #todo: return or let it be thrown? + # todo: return or let it be thrown? return premium = False valid_untill = -1 - is_premium = "expire" in result.keys() and result["expire"] is not None if is_premium: - premium = True valid_untill = mktime(datetime.fromtimestamp(int(result["expire"])).timetuple()) - traffic_left = result["balance"] * 1024 return ({ - "validuntil": valid_untill, - "trafficleft": traffic_left, - "premium": premium - }) + "validuntil": valid_untill, + "trafficleft": traffic_left, + "premium": premium + }) def login(self, user, data, req): - self._usr = user self._pwd = crypto.sha1(crypto.md5(data["password"]).hexdigest()).hexdigest() - self._req = req try: @@ -78,12 +70,10 @@ class NoPremiumPl(Account): if "errno" in response.keys(): self.wrongPassword() - data['usr'] = self._usr data['pwd'] = self._pwd def createAuthQuery(self): - query = self._api_query query["username"] = self._usr query["password"] = self._pwd @@ -91,7 +81,6 @@ class NoPremiumPl(Account): return query def runAuthQuery(self): - data = self._req.load(self._api_url, post=self.createAuthQuery()) return data \ No newline at end of file diff --git a/module/plugins/hooks/NoPremiumPl.py b/module/plugins/hooks/NoPremiumPl.py index ef36331eb..121e92f91 100644 --- a/module/plugins/hooks/NoPremiumPl.py +++ b/module/plugins/hooks/NoPremiumPl.py @@ -24,8 +24,8 @@ class NoPremiumPl(MultiHoster): __author_mail__ = ("dev@nopremium.pl") def getHoster(self): - hostings = loads(getURL("https://www.nopremium.pl/clipboard.php?json=3").strip()) + return [domain for row in hostings for domain in row["domains"] if row["sdownload"] == "0"] def getHosterCached(self): diff --git a/module/plugins/hoster/NoPremiumPl.py b/module/plugins/hoster/NoPremiumPl.py index 7665e589f..bd5260a55 100644 --- a/module/plugins/hoster/NoPremiumPl.py +++ b/module/plugins/hoster/NoPremiumPl.py @@ -9,7 +9,6 @@ from module.plugins.internal.SimpleHoster import SimpleHoster class NoPremiumPl(SimpleHoster): - __name__ = "NoPremiumPl" __version__ = "0.01" __type__ = "hoster" @@ -30,42 +29,31 @@ class NoPremiumPl(SimpleHoster): _pwd = False def setup(self): - self.resumeDownload = True self.multiDL = True def get_username_password(self): - if not self.account: - self.fail("[NoPremium.pl] Zaloguj się we wtyczce NoPremium.pl lub ją wyłącz") - else: - self._usr = self.account.getAccountData(self.user).get('usr') self._pwd = self.account.getAccountData(self.user).get('pwd') def runFileQuery(self, url, mode=None): - query = self._api_query.copy() - query["username"] = self._usr query["password"] = self._pwd - query["url"] = url if mode == "fileinfo": query['check'] = 2 query['loc'] = 1 - self.logDebug(query) return self.load(self._api_url, post=query) def process(self, pyfile): - self.get_username_password() - try: data = self.runFileQuery(pyfile.url, 'fileinfo') except Exception as e: -- cgit v1.2.3 From ce18793af9864acdf9e9c71b7324d923a53adaad Mon Sep 17 00:00:00 2001 From: synweap15 Date: Wed, 9 Jul 2014 12:05:22 +0200 Subject: fix json loads, dumps on ImportError exception --- module/plugins/accounts/NoPremiumPl.py | 5 +++-- module/plugins/hooks/NoPremiumPl.py | 5 +++-- module/plugins/hoster/NoPremiumPl.py | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/accounts/NoPremiumPl.py b/module/plugins/accounts/NoPremiumPl.py index 494b559c3..7b4140169 100644 --- a/module/plugins/accounts/NoPremiumPl.py +++ b/module/plugins/accounts/NoPremiumPl.py @@ -7,9 +7,10 @@ from time import mktime import module.lib.beaker.crypto as crypto try: - from json import loads + from json import loads, dumps except ImportError: - from simplejson import loads + from module.common.json_layer import json_loads as loads + from module.common.json_layer import json_dumps as dumps class NoPremiumPl(Account): diff --git a/module/plugins/hooks/NoPremiumPl.py b/module/plugins/hooks/NoPremiumPl.py index 121e92f91..47aa117df 100644 --- a/module/plugins/hooks/NoPremiumPl.py +++ b/module/plugins/hooks/NoPremiumPl.py @@ -4,9 +4,10 @@ from module.plugins.internal.MultiHoster import MultiHoster from module.network.RequestFactory import getURL try: - from json import loads + from json import loads, dumps except ImportError: - from simplejson import loads + from module.common.json_layer import json_loads as loads + from module.common.json_layer import json_dumps as dumps class NoPremiumPl(MultiHoster): __name__ = "NoPremiumPl" diff --git a/module/plugins/hoster/NoPremiumPl.py b/module/plugins/hoster/NoPremiumPl.py index bd5260a55..86255f95a 100644 --- a/module/plugins/hoster/NoPremiumPl.py +++ b/module/plugins/hoster/NoPremiumPl.py @@ -3,7 +3,8 @@ try: from json import loads, dumps except ImportError: - from simplejson import loads + from module.common.json_layer import json_loads as loads + from module.common.json_layer import json_dumps as dumps from module.plugins.internal.SimpleHoster import SimpleHoster -- cgit v1.2.3 From dfd5cb44138494b803f66559747cacc1260b5595 Mon Sep 17 00:00:00 2001 From: synweap15 Date: Wed, 9 Jul 2014 12:15:03 +0200 Subject: simplify json loads, replace crypto with hashlib --- module/plugins/accounts/NoPremiumPl.py | 10 +++------- module/plugins/hooks/NoPremiumPl.py | 8 +++----- module/plugins/hoster/NoPremiumPl.py | 7 +------ 3 files changed, 7 insertions(+), 18 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/accounts/NoPremiumPl.py b/module/plugins/accounts/NoPremiumPl.py index 7b4140169..0f3b5286f 100644 --- a/module/plugins/accounts/NoPremiumPl.py +++ b/module/plugins/accounts/NoPremiumPl.py @@ -1,16 +1,12 @@ # -*- coding: utf-8 -*- from datetime import datetime +import hashlib from module.plugins.Account import Account from time import mktime -import module.lib.beaker.crypto as crypto -try: - from json import loads, dumps -except ImportError: - from module.common.json_layer import json_loads as loads - from module.common.json_layer import json_dumps as dumps +from module.common.json_layer import json_loads as loads class NoPremiumPl(Account): @@ -61,7 +57,7 @@ class NoPremiumPl(Account): def login(self, user, data, req): self._usr = user - self._pwd = crypto.sha1(crypto.md5(data["password"]).hexdigest()).hexdigest() + self._pwd = hashlib.sha1(hashlib.md5(data["password"]).hexdigest()).hexdigest() self._req = req try: diff --git a/module/plugins/hooks/NoPremiumPl.py b/module/plugins/hooks/NoPremiumPl.py index 47aa117df..1357c95e8 100644 --- a/module/plugins/hooks/NoPremiumPl.py +++ b/module/plugins/hooks/NoPremiumPl.py @@ -3,11 +3,9 @@ from module.plugins.internal.MultiHoster import MultiHoster from module.network.RequestFactory import getURL -try: - from json import loads, dumps -except ImportError: - from module.common.json_layer import json_loads as loads - from module.common.json_layer import json_dumps as dumps +from module.common.json_layer import json_loads as loads + + class NoPremiumPl(MultiHoster): __name__ = "NoPremiumPl" diff --git a/module/plugins/hoster/NoPremiumPl.py b/module/plugins/hoster/NoPremiumPl.py index 86255f95a..39e5b435c 100644 --- a/module/plugins/hoster/NoPremiumPl.py +++ b/module/plugins/hoster/NoPremiumPl.py @@ -1,11 +1,6 @@ # -*- coding: utf-8 -*- -try: - from json import loads, dumps -except ImportError: - from module.common.json_layer import json_loads as loads - from module.common.json_layer import json_dumps as dumps - +from module.common.json_layer import json_loads as loads from module.plugins.internal.SimpleHoster import SimpleHoster -- cgit v1.2.3 From 0fc351436bfb4a94749899e34c46bf81a44c92c9 Mon Sep 17 00:00:00 2001 From: synweap15 Date: Wed, 9 Jul 2014 12:16:36 +0200 Subject: replace is_premium with direct expression --- module/plugins/accounts/NoPremiumPl.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/accounts/NoPremiumPl.py b/module/plugins/accounts/NoPremiumPl.py index 0f3b5286f..49c9b7653 100644 --- a/module/plugins/accounts/NoPremiumPl.py +++ b/module/plugins/accounts/NoPremiumPl.py @@ -42,9 +42,8 @@ class NoPremiumPl(Account): premium = False valid_untill = -1 - is_premium = "expire" in result.keys() and result["expire"] is not None - if is_premium: + if "expire" in result.keys() and result["expire"] is not None: premium = True valid_untill = mktime(datetime.fromtimestamp(int(result["expire"])).timetuple()) traffic_left = result["balance"] * 1024 -- cgit v1.2.3 From e6912eb377069cd8e28d293c2e1cb85ab4d4e986 Mon Sep 17 00:00:00 2001 From: synweap15 Date: Wed, 9 Jul 2014 12:38:17 +0200 Subject: fail messages localization and dictionary --- module/plugins/hoster/NoPremiumPl.py | 44 +++++++++++++++--------------------- 1 file changed, 18 insertions(+), 26 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/NoPremiumPl.py b/module/plugins/hoster/NoPremiumPl.py index 39e5b435c..2b6d2aa35 100644 --- a/module/plugins/hoster/NoPremiumPl.py +++ b/module/plugins/hoster/NoPremiumPl.py @@ -21,6 +21,16 @@ class NoPremiumPl(SimpleHoster): "password": "", "url": ""} + _error_codes = { + 0: "[%s] Incorrect login credentials", + 1: "[%s] Not enough transfer to download - top-up your account", + 2: "[%s] Incorrect / dead link", + 3: "[%s] Error connecting to hosting, try again later", + 9: "[%s] Premium account has expired", + 15: "[%s] Hosting no longer supported", + 80: "[%s] Too many incorrect login attempts, account blocked for 24h" + } + _usr = False _pwd = False @@ -30,7 +40,7 @@ class NoPremiumPl(SimpleHoster): def get_username_password(self): if not self.account: - self.fail("[NoPremium.pl] Zaloguj się we wtyczce NoPremium.pl lub ją wyłącz") + self.fail(_("Please enter your %s account or deactivate this plugin") % "NoPremium.pl") else: self._usr = self.account.getAccountData(self.user).get('usr') self._pwd = self.account.getAccountData(self.user).get('pwd') @@ -65,39 +75,21 @@ class NoPremiumPl(SimpleHoster): self.logDebug(parsed) if "errno" in parsed.keys(): - - if parsed["errno"] == 0: - self.fail("[NoPremium.pl] Niepoprawne dane logowania") - - elif parsed["errno"] == 80: - self.fail("[NoPremium.pl] Zbyt dużo niepoprawnych logowań, konto zablokowane na 24h") - - elif parsed["errno"] == 1: - self.fail("[NoPremium.pl] Za mało transferu - doładuj aby pobrać") - - elif parsed["errno"] == 9: - self.fail("[NoPremium.pl] Konto wygasło") - - elif parsed["errno"] == 2: - self.fail("[NoPremium.pl] Niepoprawny / wygasły link") - - elif parsed["errno"] == 3: - self.fail("[NoPremium.pl] Błąd łączenia z hostingiem") - - elif parsed["errno"] == 15: - self.fail("[NoPremium.pl] Hosting nie jest już wspierany") - + if parsed["errno"] in self._error_codes: + # error code in known + self.fail(self._error_codes[parsed["errno"]] % self.__name__) else: + # error code isn't yet added to plugin self.fail( parsed["errstring"] - or "Nieznany błąd (kod: {})".format(parsed["errno"]) + or "Unknown error (code: %s)" % parsed["errno"] ) if "sdownload" in parsed: if parsed["sdownload"] == "1": self.fail( - "Pobieranie z {} jest możliwe tylko przy bezpośrednim użyciu \ - NoPremium.pl. Zaktualizuj wtyczkę.".format(parsed["hosting"])) + "Download from %s is possible only using NoPremium.pl webiste \ + directly. Update this plugin." % parsed["hosting"]) pyfile.name = parsed["filename"] pyfile.size = parsed["filesize"] -- cgit v1.2.3 From 1df1779ded75e863994449ba034ed31ab2018ddc Mon Sep 17 00:00:00 2001 From: synweap15 Date: Wed, 9 Jul 2014 12:40:13 +0200 Subject: remove explicit "is not None" --- module/plugins/accounts/NoPremiumPl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins') diff --git a/module/plugins/accounts/NoPremiumPl.py b/module/plugins/accounts/NoPremiumPl.py index 49c9b7653..5f70440ac 100644 --- a/module/plugins/accounts/NoPremiumPl.py +++ b/module/plugins/accounts/NoPremiumPl.py @@ -43,7 +43,7 @@ class NoPremiumPl(Account): premium = False valid_untill = -1 - if "expire" in result.keys() and result["expire"] is not None: + if "expire" in result.keys() and result["expire"]: premium = True valid_untill = mktime(datetime.fromtimestamp(int(result["expire"])).timetuple()) traffic_left = result["balance"] * 1024 -- cgit v1.2.3 From 1b0dad0b60b155a3629b705c44bbbd45aa3a1cf6 Mon Sep 17 00:00:00 2001 From: synweap15 Date: Wed, 9 Jul 2014 12:48:29 +0200 Subject: nopremium link pattern --- module/plugins/hoster/NoPremiumPl.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins') diff --git a/module/plugins/hoster/NoPremiumPl.py b/module/plugins/hoster/NoPremiumPl.py index 2b6d2aa35..51e171f7a 100644 --- a/module/plugins/hoster/NoPremiumPl.py +++ b/module/plugins/hoster/NoPremiumPl.py @@ -9,6 +9,7 @@ class NoPremiumPl(SimpleHoster): __version__ = "0.01" __type__ = "hoster" + __pattern__ = r"https?://direct\.nopremium\.pl.*" __description__ = "NoPremium.pl hoster plugin" __author_name__ = ("goddie") __author_mail__ = ("dev@nopremium.pl") -- cgit v1.2.3 From 2e8ed2bf0b357e907f6921c7bb88719bb347367b Mon Sep 17 00:00:00 2001 From: synweap15 Date: Wed, 9 Jul 2014 13:47:49 +0200 Subject: remove blank lines and unused imports --- module/plugins/accounts/RapideoPl.py | 26 +++++++------------------- module/plugins/hooks/RapideoPl.py | 3 ++- module/plugins/hoster/RapideoPl.py | 2 -- 3 files changed, 9 insertions(+), 22 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/accounts/RapideoPl.py b/module/plugins/accounts/RapideoPl.py index 0463bba69..853731f26 100644 --- a/module/plugins/accounts/RapideoPl.py +++ b/module/plugins/accounts/RapideoPl.py @@ -3,9 +3,7 @@ from datetime import datetime from module.plugins.Account import Account -from module.plugins.internal.SimpleHoster import parseHtmlForm -import re -from time import mktime, strptime +from time import mktime import module.lib.beaker.crypto as crypto try: @@ -13,6 +11,7 @@ try: except ImportError: from simplejson import loads + class RapideoPl(Account): __name__ = "RapideoPl" __version__ = "0.01" @@ -37,40 +36,32 @@ class RapideoPl(Account): _pwd = None def loadAccountInfo(self, name, req): - self._req = req - try: result = loads(self.runAuthQuery()) except: - #todo: return or let it be thrown? + # todo: return or let it be thrown? return premium = False valid_untill = -1 - is_premium = "expire" in result.keys() and result["expire"] is not None - if is_premium: - premium = True valid_untill = mktime(datetime.fromtimestamp(int(result["expire"])).timetuple()) traffic_left = result["balance"] return ({ - "validuntil": valid_untill, - "trafficleft": traffic_left, - "premium": premium - }) + "validuntil": valid_untill, + "trafficleft": traffic_left, + "premium": premium + }) def login(self, user, data, req): - self._usr = user self._pwd = crypto.md5(data["password"]).hexdigest() - self._req = req - try: response = loads(self.runAuthQuery()) except: @@ -78,12 +69,10 @@ class RapideoPl(Account): if "errno" in response.keys(): self.wrongPassword() - data['usr'] = self._usr data['pwd'] = self._pwd def createAuthQuery(self): - query = self._api_query query["username"] = self._usr query["password"] = self._pwd @@ -91,7 +80,6 @@ class RapideoPl(Account): return query def runAuthQuery(self): - data = self._req.load(self._api_url, post=self.createAuthQuery()) return data \ No newline at end of file diff --git a/module/plugins/hooks/RapideoPl.py b/module/plugins/hooks/RapideoPl.py index fa3df9f84..de1a80908 100644 --- a/module/plugins/hooks/RapideoPl.py +++ b/module/plugins/hooks/RapideoPl.py @@ -8,6 +8,7 @@ try: except ImportError: from simplejson import loads + class RapideoPl(MultiHoster): __name__ = "RapideoPl" __version__ = "0.01" @@ -24,8 +25,8 @@ class RapideoPl(MultiHoster): __author_mail__ = ("dev@rapideo.pl") def getHoster(self): - hostings = loads(getURL("https://www.rapideo.pl/clipboard.php?json=3").strip()) + return [domain for row in hostings for domain in row["domains"] if row["sdownload"] == "0"] def getHosterCached(self): diff --git a/module/plugins/hoster/RapideoPl.py b/module/plugins/hoster/RapideoPl.py index b7deaa8ed..587b00bca 100644 --- a/module/plugins/hoster/RapideoPl.py +++ b/module/plugins/hoster/RapideoPl.py @@ -52,9 +52,7 @@ class RapideoPl(SimpleHoster): return self.load(self._api_url, post=query) def process(self, pyfile): - self.get_username_password() - try: data = self.runFileQuery(pyfile.url, 'fileinfo') except Exception as e: -- cgit v1.2.3 From 25d2cceff065a0268a7e183449ef54edf98f1783 Mon Sep 17 00:00:00 2001 From: synweap15 Date: Wed, 9 Jul 2014 13:49:12 +0200 Subject: simplify json loads, replace crypto with hashlib --- module/plugins/accounts/RapideoPl.py | 11 +++-------- module/plugins/hooks/RapideoPl.py | 7 +------ module/plugins/hoster/RapideoPl.py | 6 +----- 3 files changed, 5 insertions(+), 19 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/accounts/RapideoPl.py b/module/plugins/accounts/RapideoPl.py index 853731f26..6ace9ede0 100644 --- a/module/plugins/accounts/RapideoPl.py +++ b/module/plugins/accounts/RapideoPl.py @@ -1,16 +1,11 @@ # -*- coding: utf-8 -*- from datetime import datetime +import hashlib from module.plugins.Account import Account from time import mktime -import module.lib.beaker.crypto as crypto - -try: - from json import loads -except ImportError: - from simplejson import loads - +from module.common.json_layer import json_loads as loads class RapideoPl(Account): __name__ = "RapideoPl" @@ -60,7 +55,7 @@ class RapideoPl(Account): def login(self, user, data, req): self._usr = user - self._pwd = crypto.md5(data["password"]).hexdigest() + self._pwd = hashlib.md5(data["password"]).hexdigest() self._req = req try: response = loads(self.runAuthQuery()) diff --git a/module/plugins/hooks/RapideoPl.py b/module/plugins/hooks/RapideoPl.py index de1a80908..0c5327903 100644 --- a/module/plugins/hooks/RapideoPl.py +++ b/module/plugins/hooks/RapideoPl.py @@ -2,12 +2,7 @@ from module.plugins.internal.MultiHoster import MultiHoster from module.network.RequestFactory import getURL - -try: - from json import loads -except ImportError: - from simplejson import loads - +from module.common.json_layer import json_loads as loads class RapideoPl(MultiHoster): __name__ = "RapideoPl" diff --git a/module/plugins/hoster/RapideoPl.py b/module/plugins/hoster/RapideoPl.py index 587b00bca..d64919ae0 100644 --- a/module/plugins/hoster/RapideoPl.py +++ b/module/plugins/hoster/RapideoPl.py @@ -1,10 +1,6 @@ # -*- coding: utf-8 -*- -try: - from json import loads, dumps -except ImportError: - from simplejson import loads - +from module.common.json_layer import json_loads as loads from module.plugins.internal.SimpleHoster import SimpleHoster -- cgit v1.2.3 From 88ba5ecd9027ffa7a8bb5eb207085295ad35724d Mon Sep 17 00:00:00 2001 From: synweap15 Date: Wed, 9 Jul 2014 13:49:42 +0200 Subject: newline fix --- module/plugins/accounts/RapideoPl.py | 1 + module/plugins/hooks/RapideoPl.py | 1 + 2 files changed, 2 insertions(+) (limited to 'module/plugins') diff --git a/module/plugins/accounts/RapideoPl.py b/module/plugins/accounts/RapideoPl.py index 6ace9ede0..cbec9809a 100644 --- a/module/plugins/accounts/RapideoPl.py +++ b/module/plugins/accounts/RapideoPl.py @@ -7,6 +7,7 @@ from module.plugins.Account import Account from time import mktime from module.common.json_layer import json_loads as loads + class RapideoPl(Account): __name__ = "RapideoPl" __version__ = "0.01" diff --git a/module/plugins/hooks/RapideoPl.py b/module/plugins/hooks/RapideoPl.py index 0c5327903..910dd175b 100644 --- a/module/plugins/hooks/RapideoPl.py +++ b/module/plugins/hooks/RapideoPl.py @@ -4,6 +4,7 @@ from module.plugins.internal.MultiHoster import MultiHoster from module.network.RequestFactory import getURL from module.common.json_layer import json_loads as loads + class RapideoPl(MultiHoster): __name__ = "RapideoPl" __version__ = "0.01" -- cgit v1.2.3 From d0eea8f9baced6fd882e396e019940cff5fcf777 Mon Sep 17 00:00:00 2001 From: synweap15 Date: Wed, 9 Jul 2014 13:50:58 +0200 Subject: replace is_premium with direct expression, remove explicit "is not None" --- module/plugins/accounts/RapideoPl.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/accounts/RapideoPl.py b/module/plugins/accounts/RapideoPl.py index cbec9809a..f35d23827 100644 --- a/module/plugins/accounts/RapideoPl.py +++ b/module/plugins/accounts/RapideoPl.py @@ -41,8 +41,7 @@ class RapideoPl(Account): premium = False valid_untill = -1 - is_premium = "expire" in result.keys() and result["expire"] is not None - if is_premium: + if "expire" in result.keys() and result["expire"]: premium = True valid_untill = mktime(datetime.fromtimestamp(int(result["expire"])).timetuple()) -- cgit v1.2.3 From 4ef0c28e60efa92b0113c748afe5383e7cf432fd Mon Sep 17 00:00:00 2001 From: synweap15 Date: Wed, 9 Jul 2014 14:04:16 +0200 Subject: fail messages localization and dictionary --- module/plugins/hoster/RapideoPl.py | 44 ++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 26 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/RapideoPl.py b/module/plugins/hoster/RapideoPl.py index d64919ae0..1047b1002 100644 --- a/module/plugins/hoster/RapideoPl.py +++ b/module/plugins/hoster/RapideoPl.py @@ -20,6 +20,16 @@ class RapideoPl(SimpleHoster): "password": "", "url": ""} + _error_codes = { + 0: "[%s] Incorrect login credentials", + 1: "[%s] Not enough transfer to download - top-up your account", + 2: "[%s] Incorrect / dead link", + 3: "[%s] Error connecting to hosting, try again later", + 9: "[%s] Premium account has expired", + 15: "[%s] Hosting no longer supported", + 80: "[%s] Too many incorrect login attempts, account blocked for 24h" + } + _usr = False _pwd = False @@ -29,7 +39,7 @@ class RapideoPl(SimpleHoster): def get_username_password(self): if not self.account: - self.fail("[Rapideo.pl] Login to Rapideo.pl plugin or turn plugin off") + self.fail(_("Please enter your %s account or deactivate this plugin") % "Rapideo.pl") else: self._usr = self.account.getAccountData(self.user).get('usr') self._pwd = self.account.getAccountData(self.user).get('pwd') @@ -64,39 +74,21 @@ class RapideoPl(SimpleHoster): self.logDebug(parsed) if "errno" in parsed.keys(): - - if parsed["errno"] == 0: - self.fail("[Rapideo.pl] Invalid account credentials") - - elif parsed["errno"] == 80: - self.fail("[Rapideo.pl] Too much incorrect login attempts, account blocked for 24h") - - elif parsed["errno"] == 1: - self.fail("[Rapideo.pl] Not enough transfer - top up to download") - - elif parsed["errno"] == 9: - self.fail("[Rapideo.pl] Account expired") - - elif parsed["errno"] == 2: - self.fail("[Rapideo.pl] Invalid / dead link") - - elif parsed["errno"] == 3: - self.fail("[Rapideo.pl] Error connecting to host") - - elif parsed["errno"] == 15: - self.fail("[Rapideo.pl] Hosting no longer supported") - + if parsed["errno"] in self._error_codes: + # error code in known + self.fail(self._error_codes[parsed["errno"]] % self.__name__) else: + # error code isn't yet added to plugin self.fail( parsed["errstring"] - or "Unknown error (code: {})".format(parsed["errno"]) + or "Unknown error (code: %s)" % parsed["errno"] ) if "sdownload" in parsed: if parsed["sdownload"] == "1": self.fail( - "Download from {} is possible only when using \ - Rapideo.pl directly. Update this plugin.".format(parsed["hosting"])) + "Download from %s is possible only using Rapideo.pl webiste \ + directly. Update this plugin." % parsed["hosting"]) pyfile.name = parsed["filename"] pyfile.size = parsed["filesize"] -- cgit v1.2.3 From 0824528da43d0842c15ffa0d4fe132309ca592eb Mon Sep 17 00:00:00 2001 From: synweap15 Date: Wed, 9 Jul 2014 14:05:40 +0200 Subject: newline fix --- module/plugins/accounts/NoPremiumPl.py | 1 - module/plugins/hooks/NoPremiumPl.py | 2 -- module/plugins/hoster/NoPremiumPl.py | 3 +-- 3 files changed, 1 insertion(+), 5 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/accounts/NoPremiumPl.py b/module/plugins/accounts/NoPremiumPl.py index 5f70440ac..bf1aec841 100644 --- a/module/plugins/accounts/NoPremiumPl.py +++ b/module/plugins/accounts/NoPremiumPl.py @@ -5,7 +5,6 @@ import hashlib from module.plugins.Account import Account from time import mktime - from module.common.json_layer import json_loads as loads diff --git a/module/plugins/hooks/NoPremiumPl.py b/module/plugins/hooks/NoPremiumPl.py index 1357c95e8..757af6037 100644 --- a/module/plugins/hooks/NoPremiumPl.py +++ b/module/plugins/hooks/NoPremiumPl.py @@ -2,11 +2,9 @@ from module.plugins.internal.MultiHoster import MultiHoster from module.network.RequestFactory import getURL - from module.common.json_layer import json_loads as loads - class NoPremiumPl(MultiHoster): __name__ = "NoPremiumPl" __version__ = "0.01" diff --git a/module/plugins/hoster/NoPremiumPl.py b/module/plugins/hoster/NoPremiumPl.py index 51e171f7a..636220ca7 100644 --- a/module/plugins/hoster/NoPremiumPl.py +++ b/module/plugins/hoster/NoPremiumPl.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- -from module.common.json_layer import json_loads as loads from module.plugins.internal.SimpleHoster import SimpleHoster - +from module.common.json_layer import json_loads as loads class NoPremiumPl(SimpleHoster): __name__ = "NoPremiumPl" -- cgit v1.2.3 From 307523821d61811032bd3a2f6f9e6661fdc489ca Mon Sep 17 00:00:00 2001 From: synweap15 Date: Wed, 9 Jul 2014 14:05:53 +0200 Subject: newline fix --- module/plugins/hoster/NoPremiumPl.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins') diff --git a/module/plugins/hoster/NoPremiumPl.py b/module/plugins/hoster/NoPremiumPl.py index 636220ca7..f43292156 100644 --- a/module/plugins/hoster/NoPremiumPl.py +++ b/module/plugins/hoster/NoPremiumPl.py @@ -3,6 +3,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster from module.common.json_layer import json_loads as loads + class NoPremiumPl(SimpleHoster): __name__ = "NoPremiumPl" __version__ = "0.01" -- cgit v1.2.3 From 36b5bfedc2e57bd000831559ca8fb4d7e7899e24 Mon Sep 17 00:00:00 2001 From: tjeh Date: Sun, 20 Jul 2014 21:49:27 +0200 Subject: Added support for Multihosters.com multihoster. --- module/plugins/accounts/MultihostersCom.py | 50 ++++++++++++++++++++++++++++++ module/plugins/hooks/MultihostersCom.py | 22 +++++++++++++ module/plugins/hoster/MultihostersCom.py | 41 ++++++++++++++++++++++++ 3 files changed, 113 insertions(+) create mode 100644 module/plugins/accounts/MultihostersCom.py create mode 100644 module/plugins/hooks/MultihostersCom.py create mode 100644 module/plugins/hoster/MultihostersCom.py (limited to 'module/plugins') diff --git a/module/plugins/accounts/MultihostersCom.py b/module/plugins/accounts/MultihostersCom.py new file mode 100644 index 000000000..3f96fdf41 --- /dev/null +++ b/module/plugins/accounts/MultihostersCom.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- + +from time import mktime, strptime +from module.plugins.Account import Account + +class MultihostersCom(Account): + __name__ = "MultihostersCom" + __version__ = "0.01" + __type__ = "account" + __description__ = """Multihosters.com account plugin""" + __author_name__ = "tjeh" + __author_mail__ = "tjeh@gmx.net" + + def loadAccountInfo(self, user, req): + data = self.getAPIData(req) + if data == "No traffic": + account_info = {"trafficleft": 0, "validuntil": 0, "premium": False} + else: + account_info = { + "trafficleft": int(data['availabletodaytraffic']) * 1024, + "validuntil": mktime(strptime(data['endsubscriptiondate'], "%Y/%m/%d %H:%M:%S")), + "premium": True + } + return account_info + + def login(self, user, data, req): + self.loginname = user + self.password = data['password'] + if self.getAPIData(req) == "No traffic": + self.wrongPassword() + + def getAPIData(self, req, just_header=False, **kwargs): + get_data = { + 'cmd': 'accountinfo', + 'login': self.loginname, + 'pass': self.password + } + get_data.update(kwargs) + + response = req.load("http://www.multihosters.com/jDownloader.ashx", get=get_data, + decode=True, just_header=just_header) + self.logDebug(response) + + if ':' in response: + if not just_header: + response = response.replace(',', '\n') + return dict((y.strip().lower(), z.strip()) for (y, z) in + [x.split(':', 1) for x in response.splitlines() if ':' in x]) + else: + return response diff --git a/module/plugins/hooks/MultihostersCom.py b/module/plugins/hooks/MultihostersCom.py new file mode 100644 index 000000000..5ada3aa56 --- /dev/null +++ b/module/plugins/hooks/MultihostersCom.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- + +from module.network.RequestFactory import getURL +from module.plugins.internal.MultiHoster import MultiHoster + +class MultihostersCom(MultiHoster): + __name__ = "MultihostersCom" + __version__ = "0.01" + __type__ = "hook" + __config__ = [("activated", "bool", "Activated", False), + ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), + ("hosterList", "str", "Hoster list (comma separated)", ""), + ("unloadFailing", "bool", "Revert to standard download if download fails", False), + ("interval", "int", "Reload interval in hours (0 to disable)", 24)] + + __description__ = """Multihosters.com hook plugin""" + __author_name__ = "tjeh" + __author_mail__ = "tjeh@gmx.net" + + def getHoster(self): + page = getURL("http://www.multihosters.com/jDownloader.ashx?cmd=gethosters") + return [x.strip() for x in page.split(",")] \ No newline at end of file diff --git a/module/plugins/hoster/MultihostersCom.py b/module/plugins/hoster/MultihostersCom.py new file mode 100644 index 000000000..04192cd8e --- /dev/null +++ b/module/plugins/hoster/MultihostersCom.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- + +import re +from module.plugins.Hoster import Hoster + +class MultihostersCom(Hoster): + __name__ = "MultihostersCom" + __version__ = "0.01" + __type__ = "hoster" + __pattern__ = r'http://(?:www\.)?multihosters.com/.*' + __description__ = """Multihosters.com hoster plugin""" + __author_name__ = "tjeh" + __author_mail__ = "tjeh@gmx.net" + + def setup(self): + self.resumeDownload = self.multiDL = True + self.chunkLimit = 1 + + def process(self, pyfile): + if re.match(self.__pattern__, pyfile.url): + new_url = pyfile.url + elif not self.account: + self.logError(("Please enter your %s account or deactivate this plugin") % "multihosters.com") + self.fail("No multihosters.com account provided") + else: + self.logDebug("Old URL: %s" % pyfile.url) + new_url = "http://multihosters.com/getFiles.aspx?ourl=" + pyfile.url + pyfile.url = new_url + self.logDebug("New URL: %s" % new_url) + + if self.account.getAPIData(self.req, cmd="checklink", olink=pyfile.url) != "Alive": + self.fail("Offline or not downloadable - contact Multihosters support") + + header = self.account.getAPIData(self.req, just_header=True, cmd="generatedownloaddirect", olink=pyfile.url) + if not "location" in header: + self.fail("Unable to initialize download - contact Multihosters support") + self.download(header['location'], disposition=True) + + check = self.checkDownload({"error": 'action="ErrorDownload.aspx'}) + if check == "error": + self.fail("Error response received - contact Multihosters support") -- cgit v1.2.3 From 3554160654a1cb8e7000ebeea06aecdabc91af8e Mon Sep 17 00:00:00 2001 From: glukgluk Date: Thu, 7 Aug 2014 22:33:47 +0200 Subject: Create JustPremium.py --- module/plugins/hooks/JustPremium.py | 76 +++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 module/plugins/hooks/JustPremium.py (limited to 'module/plugins') diff --git a/module/plugins/hooks/JustPremium.py b/module/plugins/hooks/JustPremium.py new file mode 100644 index 000000000..17028ef5e --- /dev/null +++ b/module/plugins/hooks/JustPremium.py @@ -0,0 +1,76 @@ +# -*- coding: utf-8 -*- +""" + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, + or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . + + @author: mazleu +""" +from module.plugins.Hook import Hook +from module.plugins.Account import Account +from module.plugins.Hoster import Hoster + + +class JustPremium(Hook): + __name__ = "JustPremium" + __version__ = "0.15" + __description__ = "If you add multiple links with at least one premium hoster link, all non premium links get removed" + __config__ = [("activated", "bool", "Activated", "False"), + ("freehosters","bool", "Allow all freehosters and other unknown sites", "false"), + ("nicehoster", "str", "unblock this hosters (comma seperated)", "Zippyshare.com")] + + __author_name__ = ("mazleu") + __author_mail__ = ("mazleica@gmail.com") + + event_list = ["linksAdded"] + + def coreReady(self) : + accs=str(self.core.accountManager.getAccountInfos()) + global badhosts + global hosts + hosts = "" + while "[{" in accs: + startid=accs.rfind("[], ", 0, accs.find("[{"))+2 + endid=accs.find("}]",startid)+2 + hosts=hosts+","+accs[startid+3:accs.find("'",startid+3)] + accs=accs[0:startid]+accs[endid:] + badhosts=accs.replace("': [], '",",")[2:-6] + hosts=hosts[1:] + hosts=hosts+","+self.getConfig("nicehoster") + self.logDebug("good hosts:",hosts) + self.logDebug("bad hosts:",badhosts) + + + def filterLinks(self, t): + links = self.core.api.checkURLs(t) + hosterlist ="" + bhosters = [x.strip() for x in badhosts.split(",")] + ghosters = [x.strip() for x in hosts.split(",")] + premhoster = False + for hoster in links: + self.logDebug(hoster) + if hoster in ghosters: + premhoster = True + if premhoster : + for hoster in links: + if self.getConfig("freehosters"): + if hoster in bhosters: + for link in links[hoster]: + t.remove(link) + self.logDebug("removed link '%s'because hoster was: '%s' " % (link,hoster)) + else: + if not hoster in ghosters: + for link in links[hoster]: + t.remove(link) + self.logDebug("removed link '%s'because hoster was: '%s' " % (link,hoster)) + def linksAdded(self, links, pid): + self.filterLinks(links) -- cgit v1.2.3 From dabe45332a554aba173c47754d39b514fa77c1bb Mon Sep 17 00:00:00 2001 From: glukgluk Date: Fri, 8 Aug 2014 21:53:56 +0200 Subject: Update JustPremium.py --- module/plugins/hooks/JustPremium.py | 77 +++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 37 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/JustPremium.py b/module/plugins/hooks/JustPremium.py index 17028ef5e..2c5788b75 100644 --- a/module/plugins/hooks/JustPremium.py +++ b/module/plugins/hooks/JustPremium.py @@ -22,55 +22,58 @@ from module.plugins.Hoster import Hoster class JustPremium(Hook): __name__ = "JustPremium" - __version__ = "0.15" + __version__ = "0.16" __description__ = "If you add multiple links with at least one premium hoster link, all non premium links get removed" __config__ = [("activated", "bool", "Activated", "False"), - ("freehosters","bool", "Allow all freehosters and other unknown sites", "false"), + ("freehosters","bool", "Allow all freehosters and other unknown sites", "false"), ("nicehoster", "str", "unblock this hosters (comma seperated)", "Zippyshare.com")] - + __author_name__ = ("mazleu") __author_mail__ = ("mazleica@gmail.com") event_list = ["linksAdded"] - - def coreReady(self) : + + def coreReady(self) : accs=str(self.core.accountManager.getAccountInfos()) - global badhosts - global hosts - hosts = "" - while "[{" in accs: - startid=accs.rfind("[], ", 0, accs.find("[{"))+2 - endid=accs.find("}]",startid)+2 - hosts=hosts+","+accs[startid+3:accs.find("'",startid+3)] - accs=accs[0:startid]+accs[endid:] - badhosts=accs.replace("': [], '",",")[2:-6] - hosts=hosts[1:] - hosts=hosts+","+self.getConfig("nicehoster") - self.logDebug("good hosts:",hosts) - self.logDebug("bad hosts:",badhosts) + global badhosts + global hosts + hosts = "" + while "[{" in accs: + startid=accs.rfind("[], ", 0, accs.find("[{"))+2 + endid=accs.find("}]",startid)+2 + hosts=hosts+","+accs[startid+3:accs.find("'",startid+3)] + accs=accs[0:startid]+accs[endid:] + badhosts=accs.replace("': [], '",",")[2:-6] + hosts=hosts[1:] + hosts=hosts+","+self.getConfig("nicehoster") + self.logDebug("good hosts:",hosts) + self.logDebug("bad hosts:",badhosts) - def filterLinks(self, t): - links = self.core.api.checkURLs(t) + def filterLinks(self, t): + links = self.core.api.checkURLs(t) hosterlist ="" - bhosters = [x.strip() for x in badhosts.split(",")] - ghosters = [x.strip() for x in hosts.split(",")] - premhoster = False - for hoster in links: - self.logDebug(hoster) + bhosters = [x.strip() for x in badhosts.split(",")] + ghosters = [x.strip() for x in hosts.split(",")] + premhoster = False + for hoster in links: + self.logDebug(hoster) if hoster in ghosters: premhoster = True - if premhoster : - for hoster in links: - if self.getConfig("freehosters"): - if hoster in bhosters: - for link in links[hoster]: - t.remove(link) - self.logDebug("removed link '%s'because hoster was: '%s' " % (link,hoster)) - else: - if not hoster in ghosters: - for link in links[hoster]: - t.remove(link) - self.logDebug("removed link '%s'because hoster was: '%s' " % (link,hoster)) + self.logDebug ("Found at least one hoster with account") + if premhoster : + for hoster in links: + if self.getConfig("freehosters"): + if hoster in bhosters: + self.logInfo("remove links from hoster '%s' " % (hoster)) + for link in links[hoster]: + t.remove(link) + self.logDebug("remove link '%s'because hoster was: '%s' " % (link,hoster)) + else: + if not hoster in ghosters: + self.logInfo("remove links from hoster '%s' " % (hoster)) + for link in links[hoster]: + t.remove(link) + self.logDebug("remove link '%s' because hoster was: '%s' " % (link,hoster)) def linksAdded(self, links, pid): self.filterLinks(links) -- cgit v1.2.3 From 1e90f0a46b7fd0f1d9376ea966e1650afa782c37 Mon Sep 17 00:00:00 2001 From: synweap15 Date: Tue, 16 Sep 2014 23:20:17 +0200 Subject: fix to work with python 2.5 --- module/plugins/hoster/RapideoPl.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/RapideoPl.py b/module/plugins/hoster/RapideoPl.py index 1047b1002..0c46c0593 100644 --- a/module/plugins/hoster/RapideoPl.py +++ b/module/plugins/hoster/RapideoPl.py @@ -61,14 +61,14 @@ class RapideoPl(SimpleHoster): self.get_username_password() try: data = self.runFileQuery(pyfile.url, 'fileinfo') - except Exception as e: - self.logDebug(str(e)) + except Exception: + self.logDebug("RunFileQuery error") self.tempOffline() try: parsed = loads(data) - except Exception as e: - self.logDebug(str(e)) + except Exception: + self.logDebug("Loads error") self.tempOffline() self.logDebug(parsed) @@ -95,8 +95,8 @@ class RapideoPl(SimpleHoster): try: result_dl = self.runFileQuery(pyfile.url, 'filedownload') - except Exception as e: - self.logDebug(str(e)) + except Exception: + self.logDebug("runFileQuery error #2") self.tempOffline() self.download(result_dl, disposition=True) -- cgit v1.2.3 From 542bb076b6a51c779f73249b02ffb5fae6950841 Mon Sep 17 00:00:00 2001 From: synweap15 Date: Tue, 16 Sep 2014 23:21:57 +0200 Subject: fix to work with python 2.5 --- module/plugins/hoster/NoPremiumPl.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/NoPremiumPl.py b/module/plugins/hoster/NoPremiumPl.py index f43292156..1bdd6eda0 100644 --- a/module/plugins/hoster/NoPremiumPl.py +++ b/module/plugins/hoster/NoPremiumPl.py @@ -63,14 +63,14 @@ class NoPremiumPl(SimpleHoster): self.get_username_password() try: data = self.runFileQuery(pyfile.url, 'fileinfo') - except Exception as e: - self.logDebug(str(e)) + except Exception: + self.logDebug("runFileQuery error") self.tempOffline() try: parsed = loads(data) - except Exception as e: - self.logDebug(str(e)) + except Exception: + self.logDebug("loads error") self.tempOffline() self.logDebug(parsed) @@ -97,8 +97,8 @@ class NoPremiumPl(SimpleHoster): try: result_dl = self.runFileQuery(pyfile.url, 'filedownload') - except Exception as e: - self.logDebug(str(e)) + except Exception: + self.logDebug("runFileQuery error #2") self.tempOffline() self.download(result_dl, disposition=True) -- cgit v1.2.3 From 168f175ce4765dec7e847c45d95e4babe20a7193 Mon Sep 17 00:00:00 2001 From: synweap15 Date: Mon, 3 Nov 2014 14:42:05 +0100 Subject: New __authors__ key, added __license__ --- module/plugins/accounts/NoPremiumPl.py | 4 ++-- module/plugins/hooks/NoPremiumPl.py | 4 ++-- module/plugins/hoster/NoPremiumPl.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/accounts/NoPremiumPl.py b/module/plugins/accounts/NoPremiumPl.py index bf1aec841..f2223b7d9 100644 --- a/module/plugins/accounts/NoPremiumPl.py +++ b/module/plugins/accounts/NoPremiumPl.py @@ -13,8 +13,8 @@ class NoPremiumPl(Account): __version__ = "0.01" __type__ = "account" __description__ = "NoPremium.pl account plugin" - __author_name__ = ("goddie") - __author_mail__ = ("dev@nopremium.pl") + __license__ = "GPLv3" + __authors__ = [("goddie", "dev@nopremium.pl")] _api_url = "http://crypt.nopremium.pl" diff --git a/module/plugins/hooks/NoPremiumPl.py b/module/plugins/hooks/NoPremiumPl.py index 757af6037..f60cb3dd6 100644 --- a/module/plugins/hooks/NoPremiumPl.py +++ b/module/plugins/hooks/NoPremiumPl.py @@ -17,8 +17,8 @@ class NoPremiumPl(MultiHoster): ("interval", "int", "Reload supported hosts interval in hours (0 to disable)", "24")] __description__ = "NoPremium.pl hook" - __author_name__ = ("goddie") - __author_mail__ = ("dev@nopremium.pl") + __license__ = "GPLv3" + __authors__ = [("goddie", "dev@nopremium.pl")] def getHoster(self): hostings = loads(getURL("https://www.nopremium.pl/clipboard.php?json=3").strip()) diff --git a/module/plugins/hoster/NoPremiumPl.py b/module/plugins/hoster/NoPremiumPl.py index 1bdd6eda0..f4f7ba56a 100644 --- a/module/plugins/hoster/NoPremiumPl.py +++ b/module/plugins/hoster/NoPremiumPl.py @@ -11,8 +11,8 @@ class NoPremiumPl(SimpleHoster): __pattern__ = r"https?://direct\.nopremium\.pl.*" __description__ = "NoPremium.pl hoster plugin" - __author_name__ = ("goddie") - __author_mail__ = ("dev@nopremium.pl") + __license__ = "GPLv3" + __authors__ = [("goddie", "dev@nopremium.pl")] _api_url = "http://crypt.nopremium.pl" -- cgit v1.2.3 From 005710831caa04bbe372b54ac357658963fe02bb Mon Sep 17 00:00:00 2001 From: synweap15 Date: Mon, 3 Nov 2014 14:44:44 +0100 Subject: New __authors__ key, added __license__ --- module/plugins/accounts/RapideoPl.py | 4 ++-- module/plugins/hooks/RapideoPl.py | 4 ++-- module/plugins/hoster/RapideoPl.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/accounts/RapideoPl.py b/module/plugins/accounts/RapideoPl.py index f35d23827..438ce7ad3 100644 --- a/module/plugins/accounts/RapideoPl.py +++ b/module/plugins/accounts/RapideoPl.py @@ -13,8 +13,8 @@ class RapideoPl(Account): __version__ = "0.01" __type__ = "account" __description__ = "Rapideo.pl account plugin" - __author_name__ = ("goddie") - __author_mail__ = ("dev@rapideo.pl") + __license__ = "GPLv3" + __authors__ = [("goddie", "dev@rapideo.pl")] _api_url = "http://enc.rapideo.pl" diff --git a/module/plugins/hooks/RapideoPl.py b/module/plugins/hooks/RapideoPl.py index 910dd175b..a5d7a34a5 100644 --- a/module/plugins/hooks/RapideoPl.py +++ b/module/plugins/hooks/RapideoPl.py @@ -17,8 +17,8 @@ class RapideoPl(MultiHoster): ("interval", "int", "Reload supported hosts interval in hours (0 to disable)", "24")] __description__ = "Rapideo.pl hook" - __author_name__ = ("goddie") - __author_mail__ = ("dev@rapideo.pl") + __license__ = "GPLv3" + __authors__ = [("goddie", "dev@rapideo.pl")] def getHoster(self): hostings = loads(getURL("https://www.rapideo.pl/clipboard.php?json=3").strip()) diff --git a/module/plugins/hoster/RapideoPl.py b/module/plugins/hoster/RapideoPl.py index 0c46c0593..9fd20e69e 100644 --- a/module/plugins/hoster/RapideoPl.py +++ b/module/plugins/hoster/RapideoPl.py @@ -9,8 +9,8 @@ class RapideoPl(SimpleHoster): __version__ = "0.01" __type__ = "hoster" __description__ = "Rapideo.pl hoster plugin" - __author_name__ = ("goddie") - __author_mail__ = ("dev@rapideo.pl") + __license__ = "GPLv3" + __authors__ = [("goddie", "dev@rapideo.pl")] _api_url = "http://enc.rapideo.pl" -- cgit v1.2.3 From f71c1ef70a199e42e8a519364d9924e138ffd37c Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 24 Dec 2014 15:48:08 +0100 Subject: [ExtractArchive] Remove empty directory --- module/plugins/hooks/ExtractArchive.py | 11 +++++++++-- module/plugins/internal/UnRar.py | 2 +- module/plugins/internal/UnZip.py | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 16942bef0..8b3b4e310 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -58,7 +58,7 @@ from module.utils import save_join, uniqify class ExtractArchive(Hook): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.00" + __version__ = "1.01" __config__ = [("activated" , "bool" , "Activated" , True ), ("fullpath" , "bool" , "Extract full path" , True ), @@ -135,7 +135,7 @@ class ExtractArchive(Hook): self.logInfo(_("Package %s queued for later extracting") % pypack.name) self.queue.append(pid) else: - self.manager.startThread(self.extract, [pid]) + self.extractPackage(pid) @threaded @@ -239,6 +239,7 @@ class ExtractArchive(Hook): new_files = None if new_files is None: + self.logWarning(basename(target), _("No files extracted")) success = False continue @@ -264,6 +265,12 @@ class ExtractArchive(Hook): else: self.logInfo(_("No files found to extract")) + if not matched or not success and subfolder: + try: + os.rmdir(out) + except OSError: + pass + return True if not failed else False diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index 5633b31f7..b70bf3257 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -8,7 +8,7 @@ from os.path import basename, dirname, join from string import digits from subprocess import Popen, PIPE -from module.plugins.internal.AbstractExtractor import AbtractExtractor, PasswordError, ArchiveError, CRCError +from module.plugins.internal.AbstractExtractor import AbtractExtractor, ArchiveError, CRCError, PasswordError from module.utils import save_join, decode diff --git a/module/plugins/internal/UnZip.py b/module/plugins/internal/UnZip.py index b3d54cba0..875a0ec09 100644 --- a/module/plugins/internal/UnZip.py +++ b/module/plugins/internal/UnZip.py @@ -5,7 +5,7 @@ from __future__ import with_statement import sys import zipfile -from module.plugins.internal.AbstractExtractor import AbtractExtractor, PasswordError, ArchiveError, CRCError +from module.plugins.internal.AbstractExtractor import AbtractExtractor, ArchiveError, CRCError, PasswordError class UnZip(AbtractExtractor): -- cgit v1.2.3 From 3a7839e3c8f78c729adde099f071c31abf64ea1b Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 24 Dec 2014 16:48:08 +0100 Subject: [SkipRev] Improve downloadFailed routine --- module/plugins/hooks/SkipRev.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py index 1eaee0118..cc32c365e 100644 --- a/module/plugins/hooks/SkipRev.py +++ b/module/plugins/hooks/SkipRev.py @@ -18,7 +18,7 @@ def _setup(self): class SkipRev(Hook): __name__ = "SkipRev" __type__ = "hook" - __version__ = "0.20" + __version__ = "0.21" __config__ = [("tokeep", "int", "Number of rev files to keep for package (-1 to auto)", -1)] @@ -72,7 +72,7 @@ class SkipRev(Hook): tokeep = self.getConfig("tokeep") if tokeep: - saved = [True for link in self.core.api.getPackageData(pyfile.packageid).links \ + saved = [True for link in self.core.api.getPackageData(pyfile.package().id).links \ if link.name.endswith(".rev") and link.status in (0, 12)].count(True) if not saved or saved < tokeep: #: keep one rev at least in auto mode @@ -84,12 +84,17 @@ class SkipRev(Hook): def downloadFailed(self, pyfile): + #: Check if pyfile is still "failed", + # maybe might has been restarted in meantime + if pyfile.status != 8: + return + tokeep = self.getConfig("tokeep") if not tokeep: return - for link in self.core.api.getPackageData(pyfile.packageid).links: + for link in self.core.api.getPackageData(pyfile.package().id).links: if link.status is 4 and link.name.endswith(".rev"): pylink = self._pyfile(link) -- cgit v1.2.3 From 429f8b54b11b1df9d99aa8f3fe222e47d98a5faf Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 24 Dec 2014 16:49:01 +0100 Subject: [UnSkipOnFail] Rewritten --- module/plugins/hooks/UnSkipOnFail.py | 127 ++++++++++++++++++----------------- 1 file changed, 65 insertions(+), 62 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/UnSkipOnFail.py b/module/plugins/hooks/UnSkipOnFail.py index d3baccfc2..87c21dda7 100644 --- a/module/plugins/hooks/UnSkipOnFail.py +++ b/module/plugins/hooks/UnSkipOnFail.py @@ -1,22 +1,19 @@ # -*- coding: utf-8 -*- -from os.path import basename - from module.PyFile import PyFile from module.plugins.Hook import Hook -from module.utils import fs_encode class UnSkipOnFail(Hook): __name__ = "UnSkipOnFail" __type__ = "hook" - __version__ = "0.02" + __version__ = "0.03" __config__ = [("activated", "bool", "Activated", True)] - __description__ = """When a download fails, restart skipped duplicates""" + __description__ = """Queue skipped duplicates""" __license__ = "GPLv3" - __authors__ = [("hagg", None)] + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] #@TODO: Remove in 0.4.10 @@ -25,68 +22,74 @@ class UnSkipOnFail(Hook): def downloadFailed(self, pyfile): - pyfile_name = basename(pyfile.name) - pid = pyfile.package().id - msg = _('look for skipped duplicates for %s (pid:%s)') - self.logInfo(msg % (pyfile_name, pid)) - dups = self.findDuplicates(pyfile) - for link in dups: - # check if link is "skipped"(=4) - if link.status == 4: - lpid = link.packageID - self.logInfo(_('restart "%s" (pid:%s)') % (pyfile_name, lpid)) - self.setLinkStatus(link, "queued") - - - def findDuplicates(self, pyfile): + #: Check if pyfile is still "failed", + # maybe might has been restarted in meantime + if pyfile.status != 8: + return + + msg = _("Looking for skipped duplicates of: %s (pid:%s)") + self.logInfo(msg % (pyfile.name, pyfile.package().id)) + + dup = self.findDuplicate(pyfile) + if dup: + self.logInfo(_("Queue found duplicate: %s (pid:%s)") % (dup.name, dup.packageID)) + + #: Change status of "link" to "new_status". + # "link" has to be a valid FileData object, + # "new_status" has to be a valid status name + # (i.e. "queued" for this Plugin) + # It creates a temporary PyFile object using + # "link" data, changes its status, and tells + # the core.files-manager to save its data. + pylink = _pyfile(link) + + pylink.setCustomStatus("UnSkipOnFail", "queued") + + self.core.files.save() + pylink.release() + + else: + self.logInfo(_("No duplicates found")) + + + def findDuplicate(self, pyfile): """ Search all packages for duplicate links to "pyfile". Duplicates are links that would overwrite "pyfile". To test on duplicity the package-folder and link-name - of twolinks are compared (basename(link.name)). + of twolinks are compared (link.name). So this method returns a list of all links with equal package-folders and filenames as "pyfile", but except the data for "pyfile" iotselöf. It does MOT check the link's status. """ - dups = [] - pyfile_name = fs_encode(basename(pyfile.name)) - # get packages (w/o files, as most file data is useless here) - queue = self.core.api.getQueue() + queue = self.api.getQueue() #: get packages (w/o files, as most file data is useless here) + for package in queue: - # check if package-folder equals pyfile's package folder - if fs_encode(package.folder) == fs_encode(pyfile.package().folder): - # now get packaged data w/ files/links - pdata = self.core.api.getPackageData(package.pid) - if pdata.links: - for link in pdata.links: - link_name = fs_encode(basename(link.name)) - # check if link name collides with pdata's name - if link_name == pyfile_name: - # at last check if it is not pyfile itself - if link.fid != pyfile.id: - dups.append(link) - return dups - - - def setLinkStatus(self, link, new_status): - """ Change status of "link" to "new_status". - "link" has to be a valid FileData object, - "new_status" has to be a valid status name - (i.e. "queued" for this Plugin) - It creates a temporary PyFile object using - "link" data, changes its status, and tells - the core.files-manager to save its data. - """ - pyfile = PyFile(self.core.files, - link.fid, - link.url, - link.name, - link.size, - link.status, - link.error, - link.plugin, - link.packageID, - link.order) - pyfile.setStatus(new_status) - self.core.files.save() - pyfile.release() + #: check if package-folder equals pyfile's package folder + if package.folder != pyfile.package().folder: + continue + + #: now get packaged data w/ files/links + pdata = self.api.getPackageData(package.pid) + for link in pdata.links: + #: check if link is "skipped" + if link.status != 4: + continue + + #: check if link name collides with pdata's name + #: AND at last check if it is not pyfile itself + if link.name == pyfile.name and link.fid != pyfile.id: + return link + + + def _pyfile(self, link): + return PyFile(self.core.files, + link.fid, + link.url, + link.name, + link.size, + link.status, + link.error, + link.plugin, + link.packageID, + link.order) -- cgit v1.2.3 From 22285c54c80b59ac17dd6a74dcb2044729258f43 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 24 Dec 2014 16:50:22 +0100 Subject: [UnSkipOnFail] Rewritten (2) --- module/plugins/hooks/UnSkipOnFail.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/UnSkipOnFail.py b/module/plugins/hooks/UnSkipOnFail.py index 87c21dda7..fad29b17b 100644 --- a/module/plugins/hooks/UnSkipOnFail.py +++ b/module/plugins/hooks/UnSkipOnFail.py @@ -11,7 +11,7 @@ class UnSkipOnFail(Hook): __config__ = [("activated", "bool", "Activated", True)] - __description__ = """Queue skipped duplicates""" + __description__ = """Queue skipped duplicates when download fails""" __license__ = "GPLv3" __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] -- cgit v1.2.3 From 8930bf1dc4e3915c46b413d5d61868dabf7d24d3 Mon Sep 17 00:00:00 2001 From: pbr85at Date: Thu, 25 Dec 2014 12:46:13 +0100 Subject: Update UnSkipOnFail.py indent error --- module/plugins/hooks/UnSkipOnFail.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/UnSkipOnFail.py b/module/plugins/hooks/UnSkipOnFail.py index fad29b17b..37f193f5d 100644 --- a/module/plugins/hooks/UnSkipOnFail.py +++ b/module/plugins/hooks/UnSkipOnFail.py @@ -52,7 +52,7 @@ class UnSkipOnFail(Hook): self.logInfo(_("No duplicates found")) - def findDuplicate(self, pyfile): + def findDuplicate(self, pyfile): """ Search all packages for duplicate links to "pyfile". Duplicates are links that would overwrite "pyfile". To test on duplicity the package-folder and link-name -- cgit v1.2.3 From d442ce97a7ba66d90527cfbee313dc5640975def Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 25 Dec 2014 16:07:09 +0100 Subject: [ClickAndLoad] Revert initPeriodical --- module/plugins/hooks/ClickAndLoad.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/ClickAndLoad.py b/module/plugins/hooks/ClickAndLoad.py index 27d99c71c..04aac2f10 100644 --- a/module/plugins/hooks/ClickAndLoad.py +++ b/module/plugins/hooks/ClickAndLoad.py @@ -52,7 +52,7 @@ def forward(source, destination): class ClickAndLoad(Hook): __name__ = "ClickAndLoad" __type__ = "hook" - __version__ = "0.23" + __version__ = "0.24" __config__ = [("activated", "bool", "Activated", True), ("extern", "bool", "Allow external link adding", False)] @@ -63,11 +63,6 @@ class ClickAndLoad(Hook): ("mkaay", "mkaay@mkaay.de")] - #@TODO: Remove in 0.4.10 - def initPeriodical(self): - pass - - def coreReady(self): self.port = int(self.config['webinterface']['port']) if self.config['webinterface']['activated']: -- cgit v1.2.3 From 37c4fdbe85bd193ec69e222330f05b7adf742145 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 25 Dec 2014 16:08:32 +0100 Subject: [UnSkipOnFail] Bump up version --- module/plugins/hooks/UnSkipOnFail.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/UnSkipOnFail.py b/module/plugins/hooks/UnSkipOnFail.py index 37f193f5d..88557e831 100644 --- a/module/plugins/hooks/UnSkipOnFail.py +++ b/module/plugins/hooks/UnSkipOnFail.py @@ -7,7 +7,7 @@ from module.plugins.Hook import Hook class UnSkipOnFail(Hook): __name__ = "UnSkipOnFail" __type__ = "hook" - __version__ = "0.03" + __version__ = "0.04" __config__ = [("activated", "bool", "Activated", True)] -- cgit v1.2.3 From 4c63928557398891c30d3e2b7c962a07b3483315 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 26 Dec 2014 04:18:41 +0100 Subject: Rename AbstractExtractor to Extractor --- module/plugins/hooks/ExtractArchive.py | 4 +- module/plugins/internal/AbstractExtractor.py | 141 --------------------------- module/plugins/internal/Extractor.py | 140 ++++++++++++++++++++++++++ module/plugins/internal/UnRar.py | 6 +- module/plugins/internal/UnZip.py | 6 +- 5 files changed, 148 insertions(+), 149 deletions(-) delete mode 100644 module/plugins/internal/AbstractExtractor.py create mode 100644 module/plugins/internal/Extractor.py (limited to 'module/plugins') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 8b3b4e310..af78ffc93 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -51,14 +51,14 @@ if os.name != "nt": from pwd import getpwnam from module.plugins.Hook import Hook, threaded, Expose -from module.plugins.internal.AbstractExtractor import ArchiveError, CRCError, PasswordError +from module.plugins.internal.Extractor import ArchiveError, CRCError, PasswordError from module.utils import save_join, uniqify class ExtractArchive(Hook): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.01" + __version__ = "1.02" __config__ = [("activated" , "bool" , "Activated" , True ), ("fullpath" , "bool" , "Extract full path" , True ), diff --git a/module/plugins/internal/AbstractExtractor.py b/module/plugins/internal/AbstractExtractor.py deleted file mode 100644 index 310897d4e..000000000 --- a/module/plugins/internal/AbstractExtractor.py +++ /dev/null @@ -1,141 +0,0 @@ -# -*- coding: utf-8 -*- - -class ArchiveError(Exception): - pass - - -class CRCError(Exception): - pass - - -class PasswordError(Exception): - pass - - -class AbtractExtractor: - __name__ = "AbtractExtractor" - __version__ = "0.12" - - __description__ = """Abtract extractor plugin""" - __license__ = "GPLv3" - __authors__ = [("RaNaN", "ranan@pyload.org"), - ("Walter Purcaro", "vuolter@gmail.com")] - - - EXTENSIONS = [] - - - @classmethod - def checkDeps(cls): - """ Check if system statisfy dependencies - :return: boolean - """ - return True - - - @classmethod - def isArchive(cls, file): - raise NotImplementedError - - - @classmethod - def getTargets(cls, files_ids): - """ Filter suited targets from list of filename id tuple list - :param files_ids: List of filepathes - :return: List of targets, id tuple list - """ - targets = [] - - for file, id in files_ids: - if cls.isArchive(file): - targets.append((file, id)) - - return targets - - - def __init__(self, m, file, out, password, fullpath, overwrite, excludefiles, renice, delete, keepbroken): - """Initialize extractor for specific file - - :param m: ExtractArchive Hook plugin - :param file: Absolute filepath - :param out: Absolute path to destination directory - :param fullpath: extract to fullpath - :param overwrite: Overwrite existing archives - :param renice: Renice value - """ - self.m = m - self.file = file - self.out = out - self.password = password - self.fullpath = fullpath - self.overwrite = overwrite - self.excludefiles = excludefiles - self.renice = renice - self.delete = delete - self.keepbroken = keepbroken - self.files = [] #: Store extracted files here - - - def init(self): - """ Initialize additional data structures """ - pass - - - def verify(self): - """Check if password if needed. Raise ArchiveError if integrity is - questionable. - - :raises ArchiveError - """ - pass - - - def isPassword(self, password): - """ Check if the given password is/might be correct. - If it can not be decided at this point return true. - - :param password: - :return: boolean - """ - if isinstance(password, basestring): - return True - else: - return False - - - def setPassword(self, password): - if self.isPassword(password): - self.password = password - return True - else: - return False - - - def repair(self): - return False - - - def extract(self, progress=lambda x: None): - """Extract the archive. Raise specific errors in case of failure. - - :param progress: Progress function, call this to update status - :raises PasswordError - :raises CRCError - :raises ArchiveError - :return: - """ - self.setPassword(password) - raise NotImplementedError - - - def getDeleteFiles(self): - """Return list of files to delete, do *not* delete them here. - - :return: List with paths of files to delete - """ - raise NotImplementedError - - - def getExtractedFiles(self): - """Populate self.files at some point while extracting""" - return self.files diff --git a/module/plugins/internal/Extractor.py b/module/plugins/internal/Extractor.py new file mode 100644 index 000000000..0b2462dac --- /dev/null +++ b/module/plugins/internal/Extractor.py @@ -0,0 +1,140 @@ +# -*- coding: utf-8 -*- + +class ArchiveError(Exception): + pass + + +class CRCError(Exception): + pass + + +class PasswordError(Exception): + pass + + +class Extractor: + __name__ = "Extractor" + __version__ = "0.13" + + __description__ = """Base extractor plugin""" + __license__ = "GPLv3" + __authors__ = [("RaNaN", "ranan@pyload.org"), + ("Walter Purcaro", "vuolter@gmail.com")] + + + EXTENSIONS = [] + + + @classmethod + def checkDeps(cls): + """ Check if system statisfy dependencies + :return: boolean + """ + return True + + + @classmethod + def isArchive(cls, file): + raise NotImplementedError + + + @classmethod + def getTargets(cls, files_ids): + """ Filter suited targets from list of filename id tuple list + :param files_ids: List of filepathes + :return: List of targets, id tuple list + """ + targets = [] + + for file, id in files_ids: + if cls.isArchive(file): + targets.append((file, id)) + + return targets + + + def __init__(self, m, file, out, password, fullpath, overwrite, excludefiles, renice, delete, keepbroken): + """Initialize extractor for specific file + + :param m: ExtractArchive Hook plugin + :param file: Absolute filepath + :param out: Absolute path to destination directory + :param fullpath: extract to fullpath + :param overwrite: Overwrite existing archives + :param renice: Renice value + """ + self.m = m + self.file = file + self.out = out + self.password = password + self.fullpath = fullpath + self.overwrite = overwrite + self.excludefiles = excludefiles + self.renice = renice + self.delete = delete + self.keepbroken = keepbroken + self.files = [] #: Store extracted files here + + + def init(self): + """ Initialize additional data structures """ + pass + + + def verify(self): + """Check if password if needed. Raise ArchiveError if integrity is + questionable. + + :raises ArchiveError + """ + pass + + + def isPassword(self, password): + """ Check if the given password is/might be correct. + If it can not be decided at this point return true. + + :param password: + :return: boolean + """ + if isinstance(password, basestring): + return True + else: + return False + + + def setPassword(self, password): + if self.isPassword(password): + self.password = password + return True + else: + return False + + + def repair(self): + return False + + + def extract(self, progress=lambda x: None): + """Extract the archive. Raise specific errors in case of failure. + + :param progress: Progress function, call this to update status + :raises PasswordError + :raises CRCError + :raises ArchiveError + :return: + """ + raise NotImplementedError + + + def getDeleteFiles(self): + """Return list of files to delete, do *not* delete them here. + + :return: List with paths of files to delete + """ + raise NotImplementedError + + + def getExtractedFiles(self): + """Populate self.files at some point while extracting""" + return self.files diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index b70bf3257..572fe95b9 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -8,7 +8,7 @@ from os.path import basename, dirname, join from string import digits from subprocess import Popen, PIPE -from module.plugins.internal.AbstractExtractor import AbtractExtractor, ArchiveError, CRCError, PasswordError +from module.plugins.internal.Extractor import Extractor, ArchiveError, CRCError, PasswordError from module.utils import save_join, decode @@ -20,9 +20,9 @@ def renice(pid, value): print "Renice failed" -class UnRar(AbtractExtractor): +class UnRar(Extractor): __name__ = "UnRar" - __version__ = "1.00" + __version__ = "1.01" __description__ = """Rar extractor plugin""" __license__ = "GPLv3" diff --git a/module/plugins/internal/UnZip.py b/module/plugins/internal/UnZip.py index 875a0ec09..5ec56cbdf 100644 --- a/module/plugins/internal/UnZip.py +++ b/module/plugins/internal/UnZip.py @@ -5,12 +5,12 @@ from __future__ import with_statement import sys import zipfile -from module.plugins.internal.AbstractExtractor import AbtractExtractor, ArchiveError, CRCError, PasswordError +from module.plugins.internal.Extractor import Extractor, ArchiveError, CRCError, PasswordError -class UnZip(AbtractExtractor): +class UnZip(Extractor): __name__ = "UnZip" - __version__ = "1.00" + __version__ = "1.01" __description__ = """Zip extractor plugin""" __license__ = "GPLv3" -- cgit v1.2.3 From f37514e315e076379ab73539ffa36e48671976cc Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 26 Dec 2014 04:19:57 +0100 Subject: [MultiHoster] Improve --- module/plugins/internal/MultiHoster.py | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/internal/MultiHoster.py b/module/plugins/internal/MultiHoster.py index e5c28d034..6bfff171b 100644 --- a/module/plugins/internal/MultiHoster.py +++ b/module/plugins/internal/MultiHoster.py @@ -2,13 +2,13 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, replace_patterns, set_cookies class MultiHoster(SimpleHoster): __name__ = "MultiHoster" __type__ = "hoster" - __version__ = "0.24" + __version__ = "0.25" __pattern__ = r'^unmatchable$' @@ -17,7 +17,7 @@ class MultiHoster(SimpleHoster): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - DIRECT_LINK = True + LOGIN_ACCOUNT = True def setup(self): @@ -25,6 +25,28 @@ class MultiHoster(SimpleHoster): self.multiDL = self.premium + def prepare(self): + self.info = {} + self.link = "" #@TODO: Move to hoster class in 0.4.10 + self.directDL = False #@TODO: Move to hoster class in 0.4.10 + + if self.LOGIN_ACCOUNT and not self.account: + self.fail(_("Required account not found")) + + self.req.setOption("timeout", 120) + + if isinstance(self.COOKIES, list): + set_cookies(self.req.cj, self.COOKIES) + + if self.DIRECT_LINK is None: + self.directDL = self.__pattern__ != r'^unmatchable$' + else: + self.directDL = self.DIRECT_LINK + + self.pyfile.url = replace_patterns(self.pyfile.url, + self.FILE_URL_REPLACEMENTS if hasattr(self, "FILE_URL_REPLACEMENTS") else self.URL_REPLACEMENTS) #@TODO: Remove FILE_URL_REPLACEMENTS check in 0.4.10 + + def process(self, pyfile): self.prepare() @@ -35,7 +57,7 @@ class MultiHoster(SimpleHoster): if not self.link and not self.lastDownload: self.preload() - if self.premium and (not self.CHECK_TRAFFIC or self.checkTrafficLeft()): + if self.premium and not self.CHECK_TRAFFIC or self.checkTrafficLeft(): self.logDebug("Handled as premium download") self.handlePremium() @@ -55,4 +77,4 @@ class MultiHoster(SimpleHoster): if self.premium: raise NotImplementedError else: - self.logError(_("Required account not found")) + self.fail(_("Required premium account not found")) -- cgit v1.2.3 From 60c4c83ed84f5bf7f638f99d21e74af314935280 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 26 Dec 2014 04:20:27 +0100 Subject: [UnSkipOnFail] Fixup --- module/plugins/hooks/UnSkipOnFail.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/UnSkipOnFail.py b/module/plugins/hooks/UnSkipOnFail.py index 88557e831..1becb937a 100644 --- a/module/plugins/hooks/UnSkipOnFail.py +++ b/module/plugins/hooks/UnSkipOnFail.py @@ -7,7 +7,7 @@ from module.plugins.Hook import Hook class UnSkipOnFail(Hook): __name__ = "UnSkipOnFail" __type__ = "hook" - __version__ = "0.04" + __version__ = "0.05" __config__ = [("activated", "bool", "Activated", True)] @@ -62,7 +62,7 @@ class UnSkipOnFail(Hook): the data for "pyfile" iotselöf. It does MOT check the link's status. """ - queue = self.api.getQueue() #: get packages (w/o files, as most file data is useless here) + queue = self.core.api.getQueue() #: get packages (w/o files, as most file data is useless here) for package in queue: #: check if package-folder equals pyfile's package folder @@ -70,7 +70,7 @@ class UnSkipOnFail(Hook): continue #: now get packaged data w/ files/links - pdata = self.api.getPackageData(package.pid) + pdata = self.core.api.getPackageData(package.pid) for link in pdata.links: #: check if link is "skipped" if link.status != 4: -- cgit v1.2.3 From 6b60af3d42fb3e5b68826ca370e39fc50b4d584f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 26 Dec 2014 04:22:34 +0100 Subject: [CloudzillaTo] Fixup --- module/plugins/hoster/CloudzillaTo.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/CloudzillaTo.py b/module/plugins/hoster/CloudzillaTo.py index 442b0dd6c..d8b5e8b5d 100644 --- a/module/plugins/hoster/CloudzillaTo.py +++ b/module/plugins/hoster/CloudzillaTo.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class CloudzillaTo(SimpleHoster): __name__ = "CloudzillaTo" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.05" __pattern__ = r'http://(?:www\.)?cloudzilla\.to/share/file/(?P[\w^_]+)' @@ -51,7 +51,7 @@ class CloudzillaTo(SimpleHoster): self.link = "http://%(server)s/download/%(file_id)s/%(ticket_id)s" % {'server' : ticket['server'], 'file_id' : self.info['pattern']['ID'], - 'ticket_id': ticket['ticket_id']}) + 'ticket_id': ticket['ticket_id']} def handlePremium(self): -- cgit v1.2.3 From 6d3b96012ba64343586ba53041650d93493a335c Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 26 Dec 2014 04:23:45 +0100 Subject: [MultiHook] Overwrites account if not premium --- module/plugins/internal/MultiHook.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/internal/MultiHook.py b/module/plugins/internal/MultiHook.py index dcf1c3383..caac6c258 100644 --- a/module/plugins/internal/MultiHook.py +++ b/module/plugins/internal/MultiHook.py @@ -9,7 +9,7 @@ from module.utils import remove_chars class MultiHook(Hook): __name__ = "MultiHook" __type__ = "hook" - __version__ = "0.22" + __version__ = "0.23" __description__ = """Hook plugin for MultiHoster""" __license__ = "GPLv3" @@ -130,14 +130,14 @@ class MultiHook(Hook): old_supported = [hoster for hoster in old_supported if hoster not in self.supported] if old_supported: - self.logDebug("UNLOAD", ", ".join(old_supported)) + self.logDebug("Unload: %s" % ", ".join(old_supported)) for hoster in old_supported: self.unloadHoster(hoster) def overridePlugins(self): pluginMap = dict((name.lower(), name) for name in self.core.pluginManager.hosterPlugins.iterkeys()) - accountList = [name.lower() for name, data in self.core.accountManager.accounts.iteritems() if data] + accountList = [account.type.lower() for account in self.core.api.getAccounts(False) if account.valid and account.premium] excludedList = [] for hoster in self.getHosterCached(): @@ -159,26 +159,26 @@ class MultiHook(Hook): klass = getattr(module, self.__name__) # inject plugin plugin - self.logDebug("Overwritten Hosters", ", ".join(sorted(self.supported))) + self.logDebug("Overwritten Hosters: %s" % ", ".join(sorted(self.supported))) for hoster in self.supported: hdict = self.core.pluginManager.hosterPlugins[hoster] hdict['new_module'] = module hdict['new_name'] = self.__name__ if excludedList: - self.logInfo(_("The following hosters were not overwritten - account exists"), ", ".join(sorted(excludedList))) + self.logInfo(_("Hosters not overwritten: %s" % ", ".join(sorted(excludedList)))) if self.new_supported: hosters = sorted(self.new_supported) - self.logDebug("New Hosters", ", ".join(hosters)) + self.logDebug("New Hosters: %s" % ", ".join(hosters)) # create new regexp regexp = r'.*(%s).*' % "|".join([x.replace(".", "\.") for x in hosters]) if hasattr(klass, "__pattern__") and isinstance(klass.__pattern__, basestring) and '://' in klass.__pattern__: regexp = r'%s|%s' % (klass.__pattern__, regexp) - self.logDebug("Regexp", regexp) + self.logDebug("Regexp: %s" % regexp) hdict = self.core.pluginManager.hosterPlugins[self.__name__] hdict['pattern'] = regexp -- cgit v1.2.3 From 9371e7c7f83d821cc1f4ce4580cfec05164f3595 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 26 Dec 2014 04:24:21 +0100 Subject: [DebridItaliaCom] Fixup --- module/plugins/hoster/DebridItaliaCom.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/DebridItaliaCom.py b/module/plugins/hoster/DebridItaliaCom.py index d20afb620..34a306cce 100644 --- a/module/plugins/hoster/DebridItaliaCom.py +++ b/module/plugins/hoster/DebridItaliaCom.py @@ -8,7 +8,7 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class DebridItaliaCom(MultiHoster): __name__ = "DebridItaliaCom" __type__ = "hoster" - __version__ = "0.14" + __version__ = "0.15" __pattern__ = r'http://s\d+\.debriditalia\.com/dl/\d+' @@ -33,17 +33,16 @@ class DebridItaliaCom(MultiHoster): if "ERROR:" not in self.html: self.link = self.html.strip() else: - errmsg = re.search(r'ERROR:(.*)', self.html).group(1).strip() + self.info['error'] = re.search(r'ERROR:(.*)', self.html).group(1).strip() self.html = self.load("http://debriditalia.com/linkgen2.php", post={'xjxfun' : "convertiLink", 'xjxargs[]': "S" % self.pyfile.url, 'xjxargs[]': "S%s" % self.getPassword()}) - - self.link = re.search(r' Date: Fri, 26 Dec 2014 04:26:20 +0100 Subject: [SimpleHoster] Improve --- module/plugins/internal/SimpleHoster.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 6726726e1..56c25e0d9 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -160,7 +160,7 @@ def _isDirectLink(self, url, resumable=False): class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "0.79" + __version__ = "0.80" __pattern__ = r'^unmatchable$' @@ -381,7 +381,7 @@ class SimpleHoster(Hoster): if self.html is None: self.fail(_("No html retrieved")) - if self.premium and (not self.CHECK_TRAFFIC or self.checkTrafficLeft()): + if self.premium and not self.CHECK_TRAFFIC or self.checkTrafficLeft(): self.logDebug("Handled as premium download") self.handlePremium() @@ -405,7 +405,11 @@ class SimpleHoster(Hoster): self.retry(10, reason=_("Wrong captcha")) elif not self.lastDownload or not exists(fs_encode(self.lastDownload)): - self.fail(_("No file downloaded")) + errmsg = _("No file downloaded") + if 'error' in self.info: + self.fail(errmsg, self.info['error']) + else: + self.fail(errmsg) else: rules = {'empty file': re.compile(r"^$")} -- cgit v1.2.3 From 0fdb441722dbf8b680f38c4d6e95ed2775a72c4b Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 26 Dec 2014 04:27:02 +0100 Subject: [AlldebridCom] Fix checkFile --- module/plugins/hoster/AlldebridCom.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/AlldebridCom.py b/module/plugins/hoster/AlldebridCom.py index fdf060330..3391f15d4 100644 --- a/module/plugins/hoster/AlldebridCom.py +++ b/module/plugins/hoster/AlldebridCom.py @@ -13,7 +13,7 @@ from module.utils import parseFileSize class AlldebridCom(MultiHoster): __name__ = "AlldebridCom" __type__ = "hoster" - __version__ = "0.39" + __version__ = "0.40" __pattern__ = r'https?://(?:[^/]*\.)?alldebrid\..*' @@ -27,8 +27,10 @@ class AlldebridCom(MultiHoster): name = unquote(url.rsplit("/", 1)[1]) except IndexError: name = "Unknown_Filename..." + if name.endswith("..."): # incomplete filename, append random stuff name += "%s.tmp" % randrange(100, 999) + return name @@ -70,11 +72,11 @@ class AlldebridCom(MultiHoster): self.pyfile.name = self.getFilename(self.link) - def AlldebridCom(self): - super(AlldebridCom, self).checkFile() + def checkFile(self): + super(AlldebridCom, self).checkFile() - if self.checkDownload({'error': "An error occured while processing your request"}) is "error": - self.retry(wait_time=60, reason=_("An error occured while generating link")) + if self.checkDownload({'error': "An error occured while processing your request"}) is "error": + self.retry(wait_time=60, reason=_("An error occured while generating link")) getInfo = create_getInfo(AlldebridCom) -- cgit v1.2.3 From 136f63dc39603814b215606f888fb2e639021277 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 26 Dec 2014 04:27:41 +0100 Subject: Spare code fixes --- module/plugins/accounts/ShareonlineBiz.py | 6 +++--- module/plugins/hoster/RealdebridCom.py | 6 +++--- module/plugins/hoster/UnrestrictLi.py | 5 ++++- module/plugins/internal/SimpleCrypter.py | 10 +++++----- module/plugins/internal/XFSHoster.py | 14 +++++++------- 5 files changed, 22 insertions(+), 19 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/accounts/ShareonlineBiz.py b/module/plugins/accounts/ShareonlineBiz.py index 596be9b7c..49afa12b8 100644 --- a/module/plugins/accounts/ShareonlineBiz.py +++ b/module/plugins/accounts/ShareonlineBiz.py @@ -16,7 +16,7 @@ class ShareonlineBiz(Account): def getUserAPI(self, user, req): return req.load("http://api.share-online.biz/account.php", - {"username": user, "password": self.accounts[user]['password'], "act": "userDetails"}) + get={"username": user, "password": self.accounts[user]['password'], 'act': "userDetails"}) def loadAccountInfo(self, user, req): @@ -34,9 +34,9 @@ class ShareonlineBiz(Account): if "a" in info and info['a'].lower() != "not_available": req.cj.setCookie("share-online.biz", "a", info['a']) - return {"validuntil": float(info['expire_date']) if "expire_date" in info else -1, + return {"validuntil" : float(info['expire_date']) if "expire_date" in info else -1, "trafficleft": -1, - "premium": True if ("dl" in info or "a" in info) and (info['group'] != "Sammler") else False} + "premium" : True if ("dl" in info or "a" in info) and (info['group'] != "Sammler") else False} def login(self, user, data, req): diff --git a/module/plugins/hoster/RealdebridCom.py b/module/plugins/hoster/RealdebridCom.py index 0de78226d..eb27a26f9 100644 --- a/module/plugins/hoster/RealdebridCom.py +++ b/module/plugins/hoster/RealdebridCom.py @@ -14,9 +14,9 @@ from module.utils import parseFileSize class RealdebridCom(MultiHoster): __name__ = "RealdebridCom" __type__ = "hoster" - __version__ = "0.58" + __version__ = "0.59" - __pattern__ = r'https?://(?:[^/]*\.)?real-debrid\..*' + __pattern__ = r'https?://(?:[^/]+\.)?real-debrid\..*' __description__ = """Real-Debrid.com hoster plugin""" __license__ = "GPLv3" @@ -41,7 +41,7 @@ class RealdebridCom(MultiHoster): def handlePremium(self): data = json_loads(self.load("https://real-debrid.com/ajax/unrestrict.php", get={'lang' : "en", - 'link' : quote(self.pyfile.url, ""), + 'link' : self.pyfile.url, 'password': self.getPassword(), 'time' : int(time() * 1000)})) diff --git a/module/plugins/hoster/UnrestrictLi.py b/module/plugins/hoster/UnrestrictLi.py index 7535d7b41..1476efa96 100644 --- a/module/plugins/hoster/UnrestrictLi.py +++ b/module/plugins/hoster/UnrestrictLi.py @@ -29,7 +29,7 @@ def secondsToMidnight(gmt=0): class UnrestrictLi(MultiHoster): __name__ = "UnrestrictLi" __type__ = "hoster" - __version__ = "0.17" + __version__ = "0.18" __pattern__ = r'https?://(?:[^/]*\.)?(unrestrict|unr)\.li' @@ -38,6 +38,9 @@ class UnrestrictLi(MultiHoster): __authors__ = [("stickell", "l.stickell@yahoo.it")] + LOGIN_ACCOUNT = False + + def setup(self): self.chunkLimit = 16 self.resumeDownload = True diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py index e0dd10585..6596828b3 100644 --- a/module/plugins/internal/SimpleCrypter.py +++ b/module/plugins/internal/SimpleCrypter.py @@ -12,7 +12,7 @@ from module.utils import fixup class SimpleCrypter(Crypter, SimpleHoster): __name__ = "SimpleCrypter" __type__ = "crypter" - __version__ = "0.33" + __version__ = "0.34" __pattern__ = r'^unmatchable$' __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), #: Overrides core.config['general']['folder_per_package'] @@ -82,14 +82,14 @@ class SimpleCrypter(Crypter, SimpleHoster): def prepare(self): - if self.LOGIN_ACCOUNT and not self.account: - self.fail(_("Required account not found")) + self.info = {} + self.links = [] #@TODO: Move to hoster class in 0.4.10 if self.LOGIN_PREMIUM and not self.premium: self.fail(_("Required premium account not found")) - self.info = {} - self.links = [] + if self.LOGIN_ACCOUNT and not self.account: + self.fail(_("Required account not found")) self.req.setOption("timeout", 120) diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py index dd2dd2527..7c6ae5725 100644 --- a/module/plugins/internal/XFSHoster.py +++ b/module/plugins/internal/XFSHoster.py @@ -16,7 +16,7 @@ from module.utils import html_unescape class XFSHoster(SimpleHoster): __name__ = "XFSHoster" __type__ = "hoster" - __version__ = "0.31" + __version__ = "0.32" __pattern__ = r'^unmatchable$' @@ -32,7 +32,7 @@ class XFSHoster(SimpleHoster): TEXT_ENCODING = False COOKIES = [(HOSTER_DOMAIN, "lang", "english")] - CHECK_DIRECT_LINK = None + DIRECT_LINK = None MULTI_HOSTER = True #@NOTE: Should be default to False for safe, but I'm lazy... NAME_PATTERN = r'(Filename[ ]*:[ ]*()?|name="fname"[ ]+value="|<[\w^_]+ class="(file)?name">)\s*(?P.+?)(\s*<|")' @@ -45,7 +45,7 @@ class XFSHoster(SimpleHoster): PREMIUM_ONLY_PATTERN = r'>This file is available for Premium Users only' ERROR_PATTERN = r'(?:class=["\']err["\'].*?>|<[Cc]enter>|>Error|>\(ERROR:)(?:\s*<.+?>\s*)*(.+?)(?:["\']|<|\))' - LEECH_LINK_PATTERN = r'

Download Link

\s*]*>([^<]+)' + LINK_LEECH_PATTERN = r'

Download Link

\s*]*>([^<]+)' LINK_PATTERN = None #: final download url pattern CAPTCHA_PATTERN = r'(https?://[^"\']+?/captchas?/[^"\']+)' @@ -58,7 +58,7 @@ class XFSHoster(SimpleHoster): def setup(self): - self.chunkLimit = 1 + self.chunkLimit = 1 self.resumeDownload = self.multiDL = self.premium @@ -80,7 +80,7 @@ class XFSHoster(SimpleHoster): super(XFSHoster, self).prepare() - if self.CHECK_DIRECT_LINK is None: + if self.DIRECT_LINK is None: self.directDL = bool(self.premium) @@ -189,9 +189,9 @@ class XFSHoster(SimpleHoster): self.fail(stmsg) #get easybytez.com link for uploaded file - m = re.search(self.LEECH_LINK_PATTERN, self.html) + m = re.search(self.LINK_LEECH_PATTERN, self.html) if m is None: - self.error(_("LEECH_LINK_PATTERN not found")) + self.error(_("LINK_LEECH_PATTERN not found")) header = self.load(m.group(1), just_header=True, decode=True) -- cgit v1.2.3 From a2324280a11b22ef75f7c86bad3392a2179c486c Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 26 Dec 2014 16:48:14 +0100 Subject: [ShareonlineBiz] Fix login --- module/plugins/accounts/ShareonlineBiz.py | 53 ++++++++++++++++++++----------- module/plugins/hoster/RealdebridCom.py | 2 +- 2 files changed, 36 insertions(+), 19 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/accounts/ShareonlineBiz.py b/module/plugins/accounts/ShareonlineBiz.py index 49afa12b8..c08d6f963 100644 --- a/module/plugins/accounts/ShareonlineBiz.py +++ b/module/plugins/accounts/ShareonlineBiz.py @@ -6,40 +6,57 @@ from module.plugins.Account import Account class ShareonlineBiz(Account): __name__ = "ShareonlineBiz" __type__ = "account" - __version__ = "0.25" + __version__ = "0.26" __description__ = """Share-online.biz account plugin""" __license__ = "GPLv3" __authors__ = [("mkaay", "mkaay@mkaay.de"), - ("zoidberg", "zoidberg@mujmail.cz")] + ("zoidberg", "zoidberg@mujmail.cz"), + ("Walter Purcaro", "vuolter@gmail.com")] - def getUserAPI(self, user, req): - return req.load("http://api.share-online.biz/account.php", - get={"username": user, "password": self.accounts[user]['password'], 'act': "userDetails"}) + def api_response(self, user, req): + return req.load("http://api.share-online.biz/cgi-bin", + get={'q': "userdetails", 'aux': "traffic", "username": user, "password": self.accounts[user]['password']}) def loadAccountInfo(self, user, req): - html = self.getUserAPI(user, req) + premium = False + validuntil = None + trafficleft = -1 + maxtraffic = 100 * 1024 * 1024 * 1024 #: 100 GB - info = {} - for line in html.splitlines(): + api = {} + for line in self.api_response(user, req).splitlines(): if "=" in line: key, value = line.split("=") - info[key] = value - self.logDebug(info) + api[key] = value - if "dl" in info and info['dl'].lower() != "not_available": - req.cj.setCookie("share-online.biz", "dl", info['dl']) - if "a" in info and info['a'].lower() != "not_available": - req.cj.setCookie("share-online.biz", "a", info['a']) + self.logDebug(api) - return {"validuntil" : float(info['expire_date']) if "expire_date" in info else -1, - "trafficleft": -1, - "premium" : True if ("dl" in info or "a" in info) and (info['group'] != "Sammler") else False} + for key in ("dl", "a"): + if key not in api: + continue + + if api['group'] != "Sammler": + premium = True + + if api[key].lower() != "not_available": + req.cj.setCookie("share-online.biz", key, api[key]) + break + + if 'expire_date' in api: + validuntil = float(api['expire_date']) + + if 'traffic_1d' in api: + traffic = int(api['traffic_1d'].split(";")[0]) + maxtraffic = max(maxtraffic, traffic) + trafficleft = maxtraffic - traffic + + return {'premium': premium, 'validuntil': validuntil, 'trafficleft': trafficleft, 'maxtraffic': maxtraffic} def login(self, user, data, req): - html = self.getUserAPI(user, req) + html = self.api_response(user, req) if "EXCEPTION" in html: self.wrongPassword() diff --git a/module/plugins/hoster/RealdebridCom.py b/module/plugins/hoster/RealdebridCom.py index eb27a26f9..d283ce8ea 100644 --- a/module/plugins/hoster/RealdebridCom.py +++ b/module/plugins/hoster/RealdebridCom.py @@ -16,7 +16,7 @@ class RealdebridCom(MultiHoster): __type__ = "hoster" __version__ = "0.59" - __pattern__ = r'https?://(?:[^/]+\.)?real-debrid\..*' + __pattern__ = r'https?://(?:[^/]+\.)?real-debrid\..+' __description__ = """Real-Debrid.com hoster plugin""" __license__ = "GPLv3" -- cgit v1.2.3 From c7187f2142c6e06be961bb3be45ea3b61ce31651 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 26 Dec 2014 17:24:41 +0100 Subject: [SimpleHoster] getInfo handle direct link error --- module/plugins/internal/MultiHoster.py | 4 ++-- module/plugins/internal/SimpleHoster.py | 23 +++++++++++++++-------- 2 files changed, 17 insertions(+), 10 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/internal/MultiHoster.py b/module/plugins/internal/MultiHoster.py index 6bfff171b..9d218c3b2 100644 --- a/module/plugins/internal/MultiHoster.py +++ b/module/plugins/internal/MultiHoster.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, r class MultiHoster(SimpleHoster): __name__ = "MultiHoster" __type__ = "hoster" - __version__ = "0.25" + __version__ = "0.26" __pattern__ = r'^unmatchable$' @@ -57,7 +57,7 @@ class MultiHoster(SimpleHoster): if not self.link and not self.lastDownload: self.preload() - if self.premium and not self.CHECK_TRAFFIC or self.checkTrafficLeft(): + if self.premium and (not self.CHECK_TRAFFIC or self.checkTrafficLeft()): self.logDebug("Handled as premium download") self.handlePremium() diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 56c25e0d9..89d2e629c 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -160,7 +160,7 @@ def _isDirectLink(self, url, resumable=False): class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "0.80" + __version__ = "0.81" __pattern__ = r'^unmatchable$' @@ -233,7 +233,13 @@ class SimpleHoster(Hoster): @classmethod def getInfo(cls, url="", html=""): - info = {'name': urlparse(unquote(url)).path.split('/')[-1] or _("Unknown"), 'size': 0, 'status': 3, 'url': url} + info = {'name': urlparse(unquote(url)).path.split('/')[-1] or _("Unknown"), 'size': 0, 'status': 3, 'url': url} + online = False + + try: + info['pattern'] = re.match(cls.__pattern__, url).groupdict() #: pattern groups will be saved here, please save api stuff to info['api'] + except Exception: + pass if not html: try: @@ -242,6 +248,11 @@ class SimpleHoster(Hoster): info['status'] = 1 raise + if _isDirectLink(url): + info['error'] = "direct link" + info['status'] = 2 + raise + try: html = getURL(url, cookies=cls.COOKIES, decode=not cls.TEXT_ENCODING) @@ -261,8 +272,6 @@ class SimpleHoster(Hoster): except: return info - online = False - if hasattr(cls, "OFFLINE_PATTERN") and re.search(cls.OFFLINE_PATTERN, html): info['status'] = 1 @@ -273,9 +282,7 @@ class SimpleHoster(Hoster): info['status'] = 6 else: - try: - info['pattern'] = re.match(cls.__pattern__, url).groupdict() #: pattern groups will be saved here, please save api stuff to info['api'] - except: + if not 'pattern' in info: info['pattern'] = {} for pattern in ("FILE_INFO_PATTERN", "INFO_PATTERN", @@ -381,7 +388,7 @@ class SimpleHoster(Hoster): if self.html is None: self.fail(_("No html retrieved")) - if self.premium and not self.CHECK_TRAFFIC or self.checkTrafficLeft(): + if self.premium and (not self.CHECK_TRAFFIC or self.checkTrafficLeft()): self.logDebug("Handled as premium download") self.handlePremium() -- cgit v1.2.3 From ff42cec46274b0f2019272424c1a57ec4b413507 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 26 Dec 2014 17:58:54 +0100 Subject: [PremiumTo] Fixup --- module/plugins/accounts/PremiumTo.py | 2 +- module/plugins/accounts/ShareonlineBiz.py | 2 +- module/plugins/hoster/PremiumTo.py | 17 +---------------- module/plugins/internal/MultiHook.py | 1 + 4 files changed, 4 insertions(+), 18 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/accounts/PremiumTo.py b/module/plugins/accounts/PremiumTo.py index efc64706b..ef3d0cc19 100644 --- a/module/plugins/accounts/PremiumTo.py +++ b/module/plugins/accounts/PremiumTo.py @@ -19,7 +19,7 @@ class PremiumTo(Account): api_r = req.load("http://premium.to/api/straffic.php", get={'username': self.username, 'password': self.password}) - trafficleft = float(sum(map(int, api_r.split(';')))) / 1024 #@TODO: Remove `/ 1024` in 0.4.10 + trafficleft = sum(map(float, api_r.split(';'))) / 1024 #@TODO: Remove `/ 1024` in 0.4.10 return {'premium': True, 'trafficleft': trafficleft, 'validuntil': -1} diff --git a/module/plugins/accounts/ShareonlineBiz.py b/module/plugins/accounts/ShareonlineBiz.py index c08d6f963..fea278559 100644 --- a/module/plugins/accounts/ShareonlineBiz.py +++ b/module/plugins/accounts/ShareonlineBiz.py @@ -49,7 +49,7 @@ class ShareonlineBiz(Account): validuntil = float(api['expire_date']) if 'traffic_1d' in api: - traffic = int(api['traffic_1d'].split(";")[0]) + traffic = float(api['traffic_1d'].split(";")[0]) maxtraffic = max(maxtraffic, traffic) trafficleft = maxtraffic - traffic diff --git a/module/plugins/hoster/PremiumTo.py b/module/plugins/hoster/PremiumTo.py index b6194ef73..fd5853f45 100644 --- a/module/plugins/hoster/PremiumTo.py +++ b/module/plugins/hoster/PremiumTo.py @@ -13,7 +13,7 @@ from module.utils import fs_encode class PremiumTo(MultiHoster): __name__ = "PremiumTo" __type__ = "hoster" - __version__ = "0.15" + __version__ = "0.16" __pattern__ = r'https?://(?:www\.)?premium\.to/.*' @@ -30,8 +30,6 @@ class PremiumTo(MultiHoster): def handlePremium(self): - tra = self.getTraffic() - #raise timeout to 2min self.req.setOption("timeout", 120) @@ -59,21 +57,8 @@ class PremiumTo(MultiHoster): err = f.read(256).strip() remove(lastDownload) - trb = self.getTraffic() - self.logInfo(_("Filesize: %d, Traffic used %d, traffic left %d") % (self.pyfile.size, tra - trb, trb)) - if err: self.fail(err) - def getTraffic(self): - try: - api_r = self.load("http://premium.to/api/straffic.php", - get={'username': self.account.username, 'password': self.account.password}) - traffic = sum(map(int, api_r.split(';'))) - except: - traffic = 0 - return traffic - - getInfo = create_getInfo(PremiumTo) diff --git a/module/plugins/internal/MultiHook.py b/module/plugins/internal/MultiHook.py index caac6c258..78de1ed0a 100644 --- a/module/plugins/internal/MultiHook.py +++ b/module/plugins/internal/MultiHook.py @@ -47,6 +47,7 @@ class MultiHook(Hook): """getConfig with default value - sublass may not implements all config options""" try: return self.getConf(option) + except KeyError: return default -- cgit v1.2.3 From c26db1f8fcd736d9de00095343779fd5519d565c Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 26 Dec 2014 18:48:10 +0100 Subject: [LomafileCom] Mark dead --- module/plugins/accounts/LomafileCom.py | 16 ---------------- module/plugins/hoster/LomafileCom.py | 16 +++------------- 2 files changed, 3 insertions(+), 29 deletions(-) delete mode 100644 module/plugins/accounts/LomafileCom.py (limited to 'module/plugins') diff --git a/module/plugins/accounts/LomafileCom.py b/module/plugins/accounts/LomafileCom.py deleted file mode 100644 index cfd21679c..000000000 --- a/module/plugins/accounts/LomafileCom.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.internal.XFSAccount import XFSAccount - - -class LomafileCom(XFSAccount): - __name__ = "LomafileCom" - __type__ = "account" - __version__ = "0.02" - - __description__ = """Lomafile.com account plugin""" - __license__ = "GPLv3" - __authors__ = [("guidobelix", "guidobelix@hotmail.it")] - - - HOSTER_DOMAIN = "lomafile.com" diff --git a/module/plugins/hoster/LomafileCom.py b/module/plugins/hoster/LomafileCom.py index 0abc8487d..475cdacaa 100644 --- a/module/plugins/hoster/LomafileCom.py +++ b/module/plugins/hoster/LomafileCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo -class LomafileCom(XFSHoster): +class LomafileCom(DeadHoster): __name__ = "LomafileCom" __type__ = "hoster" - __version__ = "0.51" + __version__ = "0.52" __pattern__ = r'http://lomafile\.com/\w{12}' @@ -16,14 +16,4 @@ class LomafileCom(XFSHoster): ("guidobelix", "guidobelix@hotmail.it")] - HOSTER_DOMAIN = "lomafile.com" - - NAME_PATTERN = r'
' - - OFFLINE_PATTERN = r'>(No such file|Software error:<)' - TEMP_OFFLINE_PATTERN = r'The page may have been renamed, removed or be temporarily unavailable.<' - - CAPTCHA_PATTERN = r'(http://lomafile\.com/captchas/[^"\']+)' - - getInfo = create_getInfo(LomafileCom) -- cgit v1.2.3 From 24bf61533574a5ff81559d60627a7a9b2a926696 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 26 Dec 2014 18:48:57 +0100 Subject: [NowVideoSx] Fixup --- module/plugins/accounts/NowVideoAt.py | 56 ----------------------------------- module/plugins/accounts/NowVideoSx.py | 56 +++++++++++++++++++++++++++++++++++ module/plugins/hoster/NowVideoSx.py | 6 ++-- 3 files changed, 59 insertions(+), 59 deletions(-) delete mode 100644 module/plugins/accounts/NowVideoAt.py create mode 100644 module/plugins/accounts/NowVideoSx.py (limited to 'module/plugins') diff --git a/module/plugins/accounts/NowVideoAt.py b/module/plugins/accounts/NowVideoAt.py deleted file mode 100644 index 234984b6b..000000000 --- a/module/plugins/accounts/NowVideoAt.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from time import gmtime, mktime, strptime - -from module.plugins.Account import Account - - -class NowVideoAt(Account): - __name__ = "NowVideoAt" - __type__ = "account" - __version__ = "0.01" - - __description__ = """NowVideo.at account plugin""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - - VALID_UNTIL_PATTERN = r'>Your premium membership expires on: (.+?)<' - - - def loadAccountInfo(self, user, req): - validuntil = None - trafficleft = -1 - premium = None - - html = req.load("http://www.nowvideo.at/premium.php") - - m = re.search(self.VALID_UNTIL_PATTERN, html) - if m: - expiredate = m.group(1).strip() - self.logDebug("Expire date: " + expiredate) - - try: - validuntil = mktime(strptime(expiredate, "%Y-%b-%d")) - - except Exception, e: - self.logError(e) - - else: - if validuntil > mktime(gmtime()): - premium = True - else: - premium = False - validuntil = -1 - - return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} - - - def login(self, user, data, req): - html = req.load("http://www.nowvideo.at/login.php", - post={'user': user, 'pass': data['password']}) - - if ">Invalid login details" is html: - self.wrongPassword() diff --git a/module/plugins/accounts/NowVideoSx.py b/module/plugins/accounts/NowVideoSx.py new file mode 100644 index 000000000..e2dcaba12 --- /dev/null +++ b/module/plugins/accounts/NowVideoSx.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- + +import re + +from time import gmtime, mktime, strptime + +from module.plugins.Account import Account + + +class NowVideoSx(Account): + __name__ = "NowVideoSx" + __type__ = "account" + __version__ = "0.02" + + __description__ = """NowVideo.at account plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + VALID_UNTIL_PATTERN = r'>Your premium membership expires on: (.+?)<' + + + def loadAccountInfo(self, user, req): + validuntil = None + trafficleft = -1 + premium = None + + html = req.load("http://www.nowvideo.sx/premium.php") + + m = re.search(self.VALID_UNTIL_PATTERN, html) + if m: + expiredate = m.group(1).strip() + self.logDebug("Expire date: " + expiredate) + + try: + validuntil = mktime(strptime(expiredate, "%Y-%b-%d")) + + except Exception, e: + self.logError(e) + + else: + if validuntil > mktime(gmtime()): + premium = True + else: + premium = False + validuntil = -1 + + return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} + + + def login(self, user, data, req): + html = req.load("http://www.nowvideo.sx/login.php", + post={'user': user, 'pass': data['password']}) + + if ">Invalid login details" is html: + self.wrongPassword() diff --git a/module/plugins/hoster/NowVideoSx.py b/module/plugins/hoster/NowVideoSx.py index b59bd79da..d0777ca4b 100644 --- a/module/plugins/hoster/NowVideoSx.py +++ b/module/plugins/hoster/NowVideoSx.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class NowVideoSx(SimpleHoster): __name__ = "NowVideoSx" __type__ = "hoster" - __version__ = "0.07" + __version__ = "0.08" __pattern__ = r'http://(?:www\.)?nowvideo\.(at|ch|co|eu|sx)/(video|mobile/#/videos)/(?P\w+)' @@ -17,7 +17,7 @@ class NowVideoSx(SimpleHoster): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - URL_REPLACEMENTS = [(__pattern__ + ".*", r'http://www.nowvideo.at/video/\g')] + URL_REPLACEMENTS = [(__pattern__ + ".*", r'http://www.nowvideo.sx/video/\g')] NAME_PATTERN = r'

(?P.+?)<' OFFLINE_PATTERN = r'>This file no longer exists' @@ -32,7 +32,7 @@ class NowVideoSx(SimpleHoster): def handleFree(self): - self.html = self.load("http://www.nowvideo.at/mobile/video.php", get={'id': self.info['pattern']['ID']}) + self.html = self.load("http://www.nowvideo.sx/mobile/video.php", get={'id': self.info['pattern']['ID']}) m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: -- cgit v1.2.3 From 4f287a307dd61afbbf1029065dcd6d1b9c304a15 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 27 Dec 2014 13:39:25 +0100 Subject: New plugin: SimpleDereferer --- module/plugins/internal/SimpleDereferer.py | 96 ++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 module/plugins/internal/SimpleDereferer.py (limited to 'module/plugins') diff --git a/module/plugins/internal/SimpleDereferer.py b/module/plugins/internal/SimpleDereferer.py new file mode 100644 index 000000000..0ad1098f4 --- /dev/null +++ b/module/plugins/internal/SimpleDereferer.py @@ -0,0 +1,96 @@ +# -*- coding: utf-8 -*- + +import re + +from urllib import unquote + +from module.plugins.Crypter import Crypter +from module.plugins.internal.SimpleHoster import _isDirectLink, set_cookies + + +class SimpleDereferer(Crypter): + __name__ = "SimpleDereferer" + __type__ = "crypter" + __version__ = "0.01" + + __pattern__ = r'^unmatchable$' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + + __description__ = """Simple dereferer plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + """ + Following patterns should be defined by each crypter: + + LINK_PATTERN: Regex to catch the redirect url in group(1) + example: LINK_PATTERN = r'

|

Naraz je z jednej IP adresy mo.n. s.ahova. iba jeden s.bor' + LINK_FREE_PATTERN = r'

Prebieha s.ahovanie|

Naraz je z jednej IP adresy mo.n. s.ahova. iba jeden s.bor' ERR_NOT_LOGGED_IN_PATTERN = r'href="/customer-zone/login/"' URL_REPLACEMENTS = [(r"(http://[^/]*\.)(sk|cz|hu|pl)/", r"\1eu/")] - def handlePremium(self): + def handlePremium(self, pyfile): if self.ERR_NOT_LOGGED_IN_PATTERN in self.html: self.account.relogin(self.user) self.retry(reason=_("User not logged in")) - self.download(self.pyfile.url.rstrip('/') + "/download/") + self.download(pyfile.url.rstrip('/') + "/download/") check = self.checkDownload({"login": re.compile(self.ERR_NOT_LOGGED_IN_PATTERN), - "json": re.compile(r'\{"status":"error".*?"message":"(.*?)"')}) + "json" : re.compile(r'\{"status":"error".*?"message":"(.*?)"')}) + if check == "login" or (check == "json" and self.lastCheck.group(1) == "Access token expired"): self.account.relogin(self.user) self.retry(reason=_("Access token expired")) + elif check == "json": self.fail(self.lastCheck.group(1)) - def handleFree(self): + def handleFree(self, pyfile): if re.search(self.ERR_PARDL_PATTERN, self.html) is not None: self.longWait(5 * 60, 12) - m = re.search(self.FREE_URL_PATTERN, self.html) + m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: - self.error(_("FREE_URL_PATTERN not found")) + self.error(_("LINK_FREE_PATTERN not found")) parsed_url = "http://euroshare.eu%s" % m.group(1) self.logDebug("URL", parsed_url) self.download(parsed_url, disposition=True) - check = self.checkDownload({"multi_dl": re.compile(self.ERR_PARDL_PATTERN)}) - if check == "multi_dl": + + def checkFile(): + if self.checkDownload({"multi-dl": re.compile(self.ERR_PARDL_PATTERN)}) self.longWait(5 * 60, 12) + return super(EuroshareEu, self).checkFile() + getInfo = create_getInfo(EuroshareEu) diff --git a/module/plugins/hoster/ExtabitCom.py b/module/plugins/hoster/ExtabitCom.py index 7609954d3..5c2976a29 100644 --- a/module/plugins/hoster/ExtabitCom.py +++ b/module/plugins/hoster/ExtabitCom.py @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, s class ExtabitCom(SimpleHoster): __name__ = "ExtabitCom" __type__ = "hoster" - __version__ = "0.63" + __version__ = "0.64" __pattern__ = r'http://(?:www\.)?extabit\.com/(file|go|fid)/(?P\w+)' @@ -25,10 +25,10 @@ class ExtabitCom(SimpleHoster): OFFLINE_PATTERN = r'>File not found<' TEMP_OFFLINE_PATTERN = r'>(File is temporary unavailable|No download mirror)<' - LINK_PATTERN = r'[\'"](http://guest\d+\.extabit\.com/\w+/.*?)[\'"]' + LINK_FREE_PATTERN = r'[\'"](http://guest\d+\.extabit\.com/\w+/.*?)[\'"]' - def handleFree(self): + def handleFree(self, pyfile): if r">Only premium users can download this file" in self.html: self.fail(_("Only premium users can download this file")) @@ -41,7 +41,7 @@ class ExtabitCom(SimpleHoster): self.logDebug("URL: " + self.req.http.lastEffectiveURL) m = re.match(self.__pattern__, self.req.http.lastEffectiveURL) - fileID = m.group('ID') if m else self.info('ID') + fileID = m.group('ID') if m else self.info['pattern']['ID'] m = re.search(r'recaptcha/api/challenge\?k=(\w+)', self.html) if m: @@ -67,9 +67,9 @@ class ExtabitCom(SimpleHoster): self.html = self.load("http://extabit.com/file/%s%s" % (fileID, res['href'])) - 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.error(_("LINK_FREE_PATTERN not found")) url = m.group(1) self.download(url) diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py index b68c79ebc..9a38f5a72 100644 --- a/module/plugins/hoster/FastixRu.py +++ b/module/plugins/hoster/FastixRu.py @@ -12,11 +12,11 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class FastixRu(MultiHoster): __name__ = "FastixRu" __type__ = "hoster" - __version__ = "0.08" + __version__ = "0.09" __pattern__ = r'http://(?:www\.)?fastix\.(ru|it)/file/\w{24}' - __description__ = """Fastix hoster plugin""" + __description__ = """Fastix multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("Massimo Rosamilia", "max@spiritix.eu")] @@ -35,12 +35,12 @@ class FastixRu(MultiHoster): self.chunkLimit = 3 - def handlePremium(self): + def handlePremium(self, pyfile): api_key = self.account.getAccountData(self.user) api_key = api_key['api'] page = self.load("http://fastix.ru/api_v2/", - get={'apikey': api_key, 'sub': "getdirectlink", 'link': self.pyfile.url}) + get={'apikey': api_key, 'sub': "getdirectlink", 'link': pyfile.url}) data = json_loads(page) self.logDebug("Json data", data) @@ -50,19 +50,19 @@ class FastixRu(MultiHoster): else: self.link = data['downloadlink'] - if self.link != self.pyfile.url: + if self.link != pyfile.url: self.logDebug("New URL: %s" % self.link) - if self.pyfile.name.startswith("http") or self.pyfile.name.startswith("Unknown"): + if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown"): #only use when name wasnt already set - self.pyfile.name = self.getFilename(self.link) + pyfile.name = self.getFilename(self.link) def checkFile(self): - super(FastixRu, self).checkFile() - - if self.checkDownload({"error": "An error occurred while processing your request"}) is "error": + if self.checkDownload({"error": "An error occurred while processing your request"}): self.retry(wait_time=60, reason=_("An error occurred while generating link")) + return super(FastixRu, self).checkFile() + getInfo = create_getInfo(FastixRu) diff --git a/module/plugins/hoster/FastshareCz.py b/module/plugins/hoster/FastshareCz.py index 31437c6e7..6fe871ad4 100644 --- a/module/plugins/hoster/FastshareCz.py +++ b/module/plugins/hoster/FastshareCz.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FastshareCz(SimpleHoster): __name__ = "FastshareCz" __type__ = "hoster" - __version__ = "0.26" + __version__ = "0.27" __pattern__ = r'http://(?:www\.)?fastshare\.cz/\d+/.+' @@ -45,7 +45,7 @@ class FastshareCz(SimpleHoster): self.info.pop('error', None) - def handleFree(self): + def handleFree(self, pyfile): m = re.search(self.FREE_URL_PATTERN, self.html) if m: action, captcha_src = m.groups() @@ -58,22 +58,22 @@ class FastshareCz(SimpleHoster): def checkFile(self): - super(FastshareCz, self).checkFile() - check = self.checkDownload({ - 'paralell_dl' : re.compile(r"FastShare.cz|', self.html) + if m is None: + self.fail(_("could not find required json data")) + + json = m.group(1) + + res = json_loads(json) + + yadisk_ver = yadisk_sk = yadisk_id = yadisk_size = yadisk_name = yadisk_hash = None + try: + for sect in res: + if 'model' in sect: + if sect['model'] == 'config': + yadisk_ver = sect['data']['version'] + yadisk_sk = sect['data']['sk'] + elif sect['model'] == 'resource': + yadisk_id = sect['data']['id'] + yadisk_size = sect['data']['meta']['size'] + yadisk_name = sect['data']['name'] + except: + self.fail(_("Unexpected server response")) + if yadisk_id is None or yadisk_sk is None or yadisk_id is None or yadisk_size is None or yadisk_name is None: + self.fail(_("json data is missing important information, cannot continue")) + + + self.pyfile.size = yadisk_size + self.pyfile.name = yadisk_name + + yadisk_idclient = "" + for i in range(1, 32): + yadisk_idclient += random.choice('0123456abcdef') + + post_data = {'idClient': yadisk_idclient, + 'version': yadisk_ver, + '_model.0': 'do-get-resource-url', + 'sk': yadisk_sk, + 'id.0': yadisk_id} + + result_json = self.load("https://yadi.sk/models/?_m=do-get-resource-url", post=post_data) + + res = json_loads(result_json) + try: + url = res['models'][0]['data']['file'] + except: + self.fail(_("faild to retrieve the download url")) + + self.download(url) + + +getInfo = create_getInfo(YadiSk) -- cgit v1.2.3 From a4a358ce15ecac4aaa35935a074819058e6333a8 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 7 Apr 2015 16:47:50 +0200 Subject: [YadiSk] Cleanup --- module/plugins/hoster/YadiSk | 84 ---------------------------------------- module/plugins/hoster/YadiSk.py | 85 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 84 deletions(-) delete mode 100644 module/plugins/hoster/YadiSk create mode 100644 module/plugins/hoster/YadiSk.py (limited to 'module/plugins') diff --git a/module/plugins/hoster/YadiSk b/module/plugins/hoster/YadiSk deleted file mode 100644 index 33f791352..000000000 --- a/module/plugins/hoster/YadiSk +++ /dev/null @@ -1,84 +0,0 @@ -# -*- coding: utf-8 -*- - -import re -import pycurl -import random - -from module.common.json_layer import json_loads -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo - - -class YadiSk(SimpleHoster): - __name__ = "YadiSk" - __type__ = "hoster" - __version__ = "0.01" - - __pattern__ = r'https?://yadi\.sk/d/.+' - - __description__ = """yadi.sk hoster plugin""" - __license__ = "GPLv3" - __authors__ = [("GammaC0de", "nomail@fakemailbox.com")] - - OFFLINE_PATTERN = r"Nothing found" - - - def setup(self): - self.resumeDownload = False - self.multiDL = False - self.chunkLimit = 1 - - def prepare(self): - self.req.http.c.setopt(pycurl.USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:36.0) Gecko/20100101 Firefox/36.0") - return super(YadiSk, self).prepare() - - def handleFree(self, pyfile): - m = re.search(r'', self.html) - if m is None: - self.fail(_("could not find required json data")) - - json = m.group(1) - - res = json_loads(json) - - yadisk_ver = yadisk_sk = yadisk_id = yadisk_size = yadisk_name = yadisk_hash = None - try: - for sect in res: - if 'model' in sect: - if sect['model'] == 'config': - yadisk_ver = sect['data']['version'] - yadisk_sk = sect['data']['sk'] - elif sect['model'] == 'resource': - yadisk_id = sect['data']['id'] - yadisk_size = sect['data']['meta']['size'] - yadisk_name = sect['data']['name'] - except: - self.fail(_("Unexpected server response")) - if yadisk_id is None or yadisk_sk is None or yadisk_id is None or yadisk_size is None or yadisk_name is None: - self.fail(_("json data is missing important information, cannot continue")) - - - self.pyfile.size = yadisk_size - self.pyfile.name = yadisk_name - - yadisk_idclient = "" - for i in range(1, 32): - yadisk_idclient += random.choice('0123456abcdef') - - post_data = {'idClient': yadisk_idclient, - 'version': yadisk_ver, - '_model.0': 'do-get-resource-url', - 'sk': yadisk_sk, - 'id.0': yadisk_id} - - result_json = self.load("https://yadi.sk/models/?_m=do-get-resource-url", post=post_data) - - res = json_loads(result_json) - try: - url = res['models'][0]['data']['file'] - except: - self.fail(_("faild to retrieve the download url")) - - self.download(url) - - -getInfo = create_getInfo(YadiSk) diff --git a/module/plugins/hoster/YadiSk.py b/module/plugins/hoster/YadiSk.py new file mode 100644 index 000000000..c71d16cf2 --- /dev/null +++ b/module/plugins/hoster/YadiSk.py @@ -0,0 +1,85 @@ +# -*- coding: utf-8 -*- + +import re +import pycurl +import random + +from module.common.json_layer import json_loads +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + + +class YadiSk(SimpleHoster): + __name__ = "YadiSk" + __type__ = "hoster" + __version__ = "0.02" + + __pattern__ = r'https?://yadi\.sk/d/\w+' + + __description__ = """Yadi.sk hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("GammaC0de", "nomail@fakemailbox.com")] + + + OFFLINE_PATTERN = r'Nothing found' + + + def setup(self): + self.resumeDownload = False + self.multiDL = False + self.chunkLimit = 1 + + + def handleFree(self, pyfile): + m = re.search(r'', self.html) + if m is None: + self.fail(_("could not find required json data")) + + res = json_loads(m.group(1)) + + yadisk_ver = None + yadisk_sk = None + yadisk_id = None + yadisk_size = None + yadisk_name = None + yadisk_hash = None + try: #@TODO: Copy to apiInfo method + for sect in res: + if 'model' in sect: + if sect['model'] == 'config': + yadisk_ver = sect['data']['version'] + yadisk_sk = sect['data']['sk'] + + elif sect['model'] == 'resource': + yadisk_id = sect['data']['id'] + yadisk_size = sect['data']['meta']['size'] + yadisk_name = sect['data']['name'] + + except Exception: + self.fail(_("Unexpected server response")) + + if None is in (yadisk_id, yadisk_sk, yadisk_id, yadisk_size, yadisk_name): + self.fail(_("json data is missing important information, cannot continue")) + + self.pyfile.size = yadisk_size + self.pyfile.name = yadisk_name + + yadisk_idclient = "" + for _i in range(1, 32): + yadisk_idclient += random.choice('0123456abcdef') + + result_json = self.load("https://yadi.sk/models/?_m=do-get-resource-url", + post={'idClient': yadisk_idclient, + 'version' : yadisk_ver, + '_model.0': 'do-get-resource-url', + 'sk' : yadisk_sk, + 'id.0' : yadisk_id}) + + res = json_loads(result_json) + try: + self.link = res['models'][0]['data']['file'] + + except Exception: + self.fail(_("faild to retrieve the download url")) + + +getInfo = create_getInfo(YadiSk) -- cgit v1.2.3 From 1cfc960fd3ec384364ffb1e09d3ee98fc657eddb Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 7 Apr 2015 16:51:14 +0200 Subject: [SimpleDereferer][SimpleHoster] Update user-agent --- module/plugins/hoster/Keep2ShareCc.py | 13 ++++++------- module/plugins/hoster/YadiSk.py | 2 +- module/plugins/internal/SimpleDereferer.py | 3 ++- module/plugins/internal/SimpleHoster.py | 6 ++++-- 4 files changed, 13 insertions(+), 11 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/Keep2ShareCc.py b/module/plugins/hoster/Keep2ShareCc.py index 296226e3c..65e9ddc2d 100644 --- a/module/plugins/hoster/Keep2ShareCc.py +++ b/module/plugins/hoster/Keep2ShareCc.py @@ -30,7 +30,7 @@ class Keep2ShareCc(SimpleHoster): 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 = r'"([^"]+url.html\?file=.+?)"|window\.location\.href = \'(.+?)\';' + LINK_FREE_PATTERN = r'"(.+?url.html\?file=.+?)"|window\.location\.href = \'(.+?)\';' LINK_PREMIUM_PATTERN = r'window\.location\.href = \'(.+?)\';' CAPTCHA_PATTERN = r'src="(/file/captcha\.html.+?)"' @@ -67,20 +67,18 @@ class Keep2ShareCc(SimpleHoster): def handleFree(self, pyfile): - self.fid = re.search(r'', self.html).group(1) + self.fid = re.search(r'', self.html).group(1) self.html = self.load(pyfile.url, post={'yt0': '', 'slow_id': self.fid}) - self.logDebug(self.fid) - self.logDebug(pyfile.url) + + # self.logDebug(self.fid) + # self.logDebug(pyfile.url) self.checkErrors() m = re.search(self.LINK_FREE_PATTERN, self.html) - if m is None: self.handleCaptcha() - self.wait(31) - self.html = self.load(pyfile.url) m = re.search(self.LINK_FREE_PATTERN, self.html) @@ -98,6 +96,7 @@ class Keep2ShareCc(SimpleHoster): m = re.search(r'id="(captcha\-form)"', self.html) self.logDebug("captcha-form found %s" % m) + m = re.search(self.CAPTCHA_PATTERN, self.html) self.logDebug("CAPTCHA_PATTERN found %s" % m) if m: diff --git a/module/plugins/hoster/YadiSk.py b/module/plugins/hoster/YadiSk.py index c71d16cf2..57d8ae786 100644 --- a/module/plugins/hoster/YadiSk.py +++ b/module/plugins/hoster/YadiSk.py @@ -70,7 +70,7 @@ class YadiSk(SimpleHoster): result_json = self.load("https://yadi.sk/models/?_m=do-get-resource-url", post={'idClient': yadisk_idclient, 'version' : yadisk_ver, - '_model.0': 'do-get-resource-url', + '_model.0': "do-get-resource-url", 'sk' : yadisk_sk, 'id.0' : yadisk_id}) diff --git a/module/plugins/internal/SimpleDereferer.py b/module/plugins/internal/SimpleDereferer.py index 360cd7c30..41c6aa985 100644 --- a/module/plugins/internal/SimpleDereferer.py +++ b/module/plugins/internal/SimpleDereferer.py @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import getFileURL, set_cookies class SimpleDereferer(Crypter): __name__ = "SimpleDereferer" __type__ = "crypter" - __version__ = "0.08" + __version__ = "0.09" __pattern__ = r'^unmatchable$' __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), @@ -70,6 +70,7 @@ class SimpleDereferer(Crypter): self.html = "" self.req.setOption("timeout", 120) + self.req.http.c.setopt(pycurl.USERAGENT, "Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0") if isinstance(self.COOKIES, list): set_cookies(self.req.cj, self.COOKIES) diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 6f1c7409d..4446eed00 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -3,6 +3,7 @@ import datetime import mimetypes import os +import pycurl import re import time import urllib2 @@ -247,7 +248,7 @@ def secondsToMidnight(gmt=0): class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "1.33" + __version__ = "1.34" __pattern__ = r'^unmatchable$' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -315,7 +316,7 @@ class SimpleHoster(Hoster): @classmethod - def parseInfos(cls, urls): #@TODO: Built-in in 0.4.10 core, then remove from plugins + def parseInfos(cls, urls): #@TODO: Built-in in 0.4.10 core (remove from plugins) for url in urls: url = replace_patterns(url, cls.URL_REPLACEMENTS) yield cls.getInfo(url) @@ -433,6 +434,7 @@ class SimpleHoster(Hoster): self.fail(_("Required account not found")) self.req.setOption("timeout", 120) + self.req.http.c.setopt(pycurl.USERAGENT, "Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0") if isinstance(self.COOKIES, list): set_cookies(self.req.cj, self.COOKIES) -- cgit v1.2.3 From 665770b16e6ace161e9c358c6b23f1f269b5dd4b Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 7 Apr 2015 16:59:23 +0200 Subject: [SimpleDereferer] Update user-agent (2) --- module/plugins/internal/SimpleDereferer.py | 5 +++-- module/plugins/internal/SimpleHoster.py | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/internal/SimpleDereferer.py b/module/plugins/internal/SimpleDereferer.py index 41c6aa985..bdb2d773c 100644 --- a/module/plugins/internal/SimpleDereferer.py +++ b/module/plugins/internal/SimpleDereferer.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- +import pycurl import re from urllib import unquote @@ -11,7 +12,7 @@ from module.plugins.internal.SimpleHoster import getFileURL, set_cookies class SimpleDereferer(Crypter): __name__ = "SimpleDereferer" __type__ = "crypter" - __version__ = "0.09" + __version__ = "0.10" __pattern__ = r'^unmatchable$' __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), @@ -70,7 +71,7 @@ class SimpleDereferer(Crypter): self.html = "" self.req.setOption("timeout", 120) - self.req.http.c.setopt(pycurl.USERAGENT, "Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0") + self.req.http.c.setopt(pycurl.USERAGENT, "Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0") #@NOTE: Work-around to old user-agent bug; remove in 0.4.10 if isinstance(self.COOKIES, list): set_cookies(self.req.cj, self.COOKIES) diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 4446eed00..0474a5af5 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -239,7 +239,7 @@ def secondsToMidnight(gmt=0): if hasattr(td, 'total_seconds'): res = td.total_seconds() - else: #: work-around for python 2.5 and 2.6 missing datetime.timedelta.total_seconds + else: #@NOTE: work-around for python 2.5 and 2.6 missing datetime.timedelta.total_seconds res = (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6 return int(res) @@ -434,7 +434,7 @@ class SimpleHoster(Hoster): self.fail(_("Required account not found")) self.req.setOption("timeout", 120) - self.req.http.c.setopt(pycurl.USERAGENT, "Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0") + self.req.http.c.setopt(pycurl.USERAGENT, "Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0") #@NOTE: Work-around to old user-agent bug; remove in 0.4.10 if isinstance(self.COOKIES, list): set_cookies(self.req.cj, self.COOKIES) @@ -500,7 +500,7 @@ class SimpleHoster(Hoster): raise Fail(e) - #: Work-around to `filename*=UTF-8` bug; remove in 0.4.10 + #@NOTE: Work-around to `filename*=UTF-8` bug; remove in 0.4.10 def download(self, url, get={}, post={}, ref=True, cookies=True, disposition=False): try: if disposition: -- cgit v1.2.3 From 795eb0814fcf6be6ca4ca0ec322e77f00a6efeab Mon Sep 17 00:00:00 2001 From: sraedler Date: Tue, 7 Apr 2015 17:34:01 +0200 Subject: Fixed RemixshareCom --- module/plugins/hoster/RemixshareCom.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/RemixshareCom.py b/module/plugins/hoster/RemixshareCom.py index 803256d86..b62db8af3 100644 --- a/module/plugins/hoster/RemixshareCom.py +++ b/module/plugins/hoster/RemixshareCom.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # # Test links: -# http://remixshare.com/download/p946u +# http://remixshare.com/download/z8uli # # Note: # The remixshare.com website is very very slow, so @@ -16,7 +16,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class RemixshareCom(SimpleHoster): __name__ = "RemixshareCom" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.04" __pattern__ = r'https?://remixshare\.com/(download|dl)/\w+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -24,15 +24,16 @@ class RemixshareCom(SimpleHoster): __description__ = """Remixshare.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de"), - ("Walter Purcaro", "vuolter@gmail.com")] + ("Walter Purcaro", "vuolter@gmail.com"), + ("sraedler", "simon.raedler@yahoo.de")] INFO_PATTERN = r'title=\'.+?\'>(?P.+?) \((?P\d+) (?P[\w^_]+)\)<' OFFLINE_PATTERN = r'

Ooops!<' - LINK_FREE_PATTERN = r'(http://remixshare\.com/downloadfinal/.+?)"' + LINK_FREE_PATTERN = r'(http:\/\/remixshare\.com\/startloading(\w|\/)+)' TOKEN_PATTERN = r'var acc = (\d+)' - WAIT_PATTERN = r'var XYZ = r"(\d+)"' + WAIT_PATTERN = r'var XYZ = "(\d+)"' def setup(self): @@ -49,13 +50,15 @@ class RemixshareCom(SimpleHoster): if not c: self.error(_("Cannot parse file token")) - self.link = b.group(1) + c.group(1) + self.link = b.group(1) + "/zzz/" + c.group(1) + self.logDebug(self.link) #Check if we have to wait seconds = re.search(self.WAIT_PATTERN, self.html) if seconds: - self.logDebug("Wait " + seconds.group(1)) + self.logDebug("Wait " + seconds.group(1) + " Seconds") self.wait(seconds.group(1)) + self.download(self.link) getInfo = create_getInfo(RemixshareCom) -- cgit v1.2.3 From 2f763ffd0c6f87c25ba814db3ed12e3504531efd Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 7 Apr 2015 19:22:11 +0200 Subject: [SimpleDereferer][SimpleHoster] Update user-agent (3) --- module/plugins/internal/SimpleDereferer.py | 3 ++- module/plugins/internal/SimpleHoster.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/internal/SimpleDereferer.py b/module/plugins/internal/SimpleDereferer.py index bdb2d773c..99077bfc3 100644 --- a/module/plugins/internal/SimpleDereferer.py +++ b/module/plugins/internal/SimpleDereferer.py @@ -71,7 +71,8 @@ class SimpleDereferer(Crypter): self.html = "" self.req.setOption("timeout", 120) - self.req.http.c.setopt(pycurl.USERAGENT, "Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0") #@NOTE: Work-around to old user-agent bug; remove in 0.4.10 + self.req.http.c.setopt(pycurl.USERAGENT, + "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:37.0) Gecko/20100101 Firefox/37.0") #@NOTE: Work-around to old user-agent bug; remove in 0.4.10 if isinstance(self.COOKIES, list): set_cookies(self.req.cj, self.COOKIES) diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 0474a5af5..87e136f08 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -434,7 +434,8 @@ class SimpleHoster(Hoster): self.fail(_("Required account not found")) self.req.setOption("timeout", 120) - self.req.http.c.setopt(pycurl.USERAGENT, "Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0") #@NOTE: Work-around to old user-agent bug; remove in 0.4.10 + self.req.http.c.setopt(pycurl.USERAGENT, + "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:37.0) Gecko/20100101 Firefox/37.0") #@NOTE: Work-around to old user-agent bug; remove in 0.4.10 if isinstance(self.COOKIES, list): set_cookies(self.req.cj, self.COOKIES) -- cgit v1.2.3 From e948054ea4eb6bbba8091482cca52fd2454322a5 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 7 Apr 2015 19:30:29 +0200 Subject: New plugin: UserAgentSwitcher Fix https://github.com/pyload/pyload/issues/1305 --- module/plugins/hooks/UserAgentSwitcher.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 module/plugins/hooks/UserAgentSwitcher.py (limited to 'module/plugins') diff --git a/module/plugins/hooks/UserAgentSwitcher.py b/module/plugins/hooks/UserAgentSwitcher.py new file mode 100644 index 000000000..56c605bac --- /dev/null +++ b/module/plugins/hooks/UserAgentSwitcher.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- + +import pycurl + +from module.plugins.Hook import Hook + + +class UserAgentSwitcher(Hook): + __name__ = "UserAgentSwitcher" + __type__ = "hook" + __version__ = "0.01" + + __config__ = [("ua", "str", "Custom user-agent string", "")] + + __description__ = """Custom user-agent""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + interval = 0 #@TODO: Remove in 0.4.10 + + + def setup(self): + self.info = {} #@TODO: Remove in 0.4.10 + + + def downloadPreparing(self, pyfile): + ua = self.getConfig('ua') + if ua: + self.logDebug("Use custom user-agent string: " + ua) + pyfile.plugin.req.http.c.setopt(pycurl.USERAGENT, ua) -- cgit v1.2.3 From 0d2ae48fae0abb4274e477f54235d4f389b5e6b2 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 7 Apr 2015 19:36:10 +0200 Subject: [AntiVirus] Recycle bin support --- module/plugins/hooks/AntiVirus.py | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/AntiVirus.py b/module/plugins/hooks/AntiVirus.py index cc3c5c754..f94d8d205 100644 --- a/module/plugins/hooks/AntiVirus.py +++ b/module/plugins/hooks/AntiVirus.py @@ -11,15 +11,16 @@ from module.utils import fs_encode, save_join class AntiVirus(Hook): __name__ = "AntiVirus" __type__ = "hook" - __version__ = "0.05" + __version__ = "0.06" #@TODO: add trash option (use Send2Trash lib) - __config__ = [("action" , "Antivirus default;Delete;Quarantine", "Manage infected files" , "Antivirus default"), - ("quardir" , "folder" , "Quarantine folder" , "" ), - ("scanfailed", "bool" , "Scan incompleted files (failed downloads)", False ), - ("cmdfile" , "file" , "Antivirus executable" , "" ), - ("cmdargs" , "str" , "Scan options" , "" ), - ("ignore-err", "bool" , "Ignore scan errors" , False )] + __config__ = [("action" , "Antivirus default;Delete;Quarantine", "Manage infected files" , "Antivirus default"), + ("quardir" , "folder" , "Quarantine folder" , "" ), + ("deltotrash", "bool" , "Move to trash (recycle bin) instead delete", True ), + ("scanfailed", "bool" , "Scan incompleted files (failed downloads)" , False ), + ("cmdfile" , "file" , "Antivirus executable" , "" ), + ("cmdargs" , "str" , "Scan options" , "" ), + ("ignore-err", "bool" , "Ignore scan errors" , False )] __description__ = """Scan downloaded files with antivirus program""" __license__ = "GPLv3" @@ -32,6 +33,16 @@ class AntiVirus(Hook): def setup(self): self.info = {} #@TODO: Remove in 0.4.10 + try: + import send2trash + + except ImportError: + self.logDebug(name, _("Send2Trash lib not found")) + self.trashable = False + + else: + self.trashable = True + @Expose @threaded @@ -46,6 +57,7 @@ class AntiVirus(Hook): thread.addActive(pyfile) pyfile.setCustomStatus(_("virus scanning")) + pyfile.setProgress(0) try: p = subprocess.Popen([cmdfile, cmdargs, file], bufsize=-1, stdout=subprocess.PIPE, stderr=subprocess.PIPE) @@ -66,11 +78,19 @@ class AntiVirus(Hook): action = self.getConfig('action') try: if action == "Delete": - os.remove(file) + if not self.getConfig('deltotrash'): + os.remove(file) + + elif self.trashable: + send2trash.send2trash(file) + + else: + self.logWarning("Unable to move file to trash, move to quarantine instead") + pyfile.setCustomStatus(_("file moving")) + shutil.move(file, self.getConfig('quardir')) elif action == "Quarantine": pyfile.setCustomStatus(_("file moving")) - pyfile.setProgress(0) shutil.move(file, self.getConfig('quardir')) except (IOError, shutil.Error), e: -- cgit v1.2.3 From a01a2dcb91bb2020aa4c7548a52ba98dbe43ceef Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 7 Apr 2015 21:12:09 +0200 Subject: [ExtractArchive] Improve send2trash feature --- module/plugins/hooks/ExtractArchive.py | 81 ++++++++++++++++++---------------- 1 file changed, 43 insertions(+), 38 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 8c40667c2..8b6a140cd 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -106,24 +106,25 @@ class ArchiveQueue(object): class ExtractArchive(Hook): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.38" - - __config__ = [("activated" , "bool" , "Activated" , True ), - ("fullpath" , "bool" , "Extract with full paths" , True ), - ("overwrite" , "bool" , "Overwrite files" , False ), - ("keepbroken" , "bool" , "Try to extract broken archives" , False ), - ("repair" , "bool" , "Repair broken archives (RAR required)" , False ), - ("test" , "bool" , "Test archive before extracting" , False ), - ("usepasswordfile", "bool" , "Use password file" , True ), - ("passwordfile" , "file" , "Password file" , "archive_password.txt" ), - ("delete" , "No;Permanent;Trash", "Delete archive after extraction" , "No" ), - ("subfolder" , "bool" , "Create subfolder for each package" , False ), - ("destination" , "folder" , "Extract files to folder" , "" ), - ("extensions" , "str" , "Extract archives ending with extension", "7z,bz2,bzip2,gz,gzip,lha,lzh,lzma,rar,tar,taz,tbz,tbz2,tgz,xar,xz,z,zip"), - ("excludefiles" , "str" , "Don't extract the following files" , "*.nfo,*.DS_Store,index.dat,thumb.db" ), - ("recursive" , "bool" , "Extract archives in archives" , True ), - ("waitall" , "bool" , "Run after all downloads was processed" , False ), - ("renice" , "int" , "CPU priority" , 0 )] + __version__ = "1.39" + + __config__ = [("activated" , "bool" , "Activated" , True ), + ("fullpath" , "bool" , "Extract with full paths" , True ), + ("overwrite" , "bool" , "Overwrite files" , False ), + ("keepbroken" , "bool" , "Try to extract broken archives" , False ), + ("repair" , "bool" , "Repair broken archives (RAR required)" , False ), + ("test" , "bool" , "Test archive before extracting" , False ), + ("usepasswordfile", "bool" , "Use password file" , True ), + ("passwordfile" , "file" , "Password file" , "archive_password.txt" ), + ("delete" , "bool" , "Delete archive after extraction" , True ), + ("deltotrash" , "bool" , "Move to trash (recycle bin) instead delete", True ), + ("subfolder" , "bool" , "Create subfolder for each package" , False ), + ("destination" , "folder" , "Extract files to folder" , "" ), + ("extensions" , "str" , "Extract archives ending with extension" , "7z,bz2,bzip2,gz,gzip,lha,lzh,lzma,rar,tar,taz,tbz,tbz2,tgz,xar,xz,z,zip"), + ("excludefiles" , "str" , "Don't extract the following files" , "*.nfo,*.DS_Store,index.dat,thumb.db" ), + ("recursive" , "bool" , "Extract archives in archives" , True ), + ("waitall" , "bool" , "Run after all downloads was processed" , False ), + ("renice" , "int" , "CPU priority" , 0 )] __description__ = """Extract different kind of archives""" __license__ = "GPLv3" @@ -148,7 +149,16 @@ class ExtractArchive(Hook): self.extractors = [] self.passwords = [] self.repair = False - self.trash = False + + try: + import send2trash + + except ImportError: + self.logDebug(name, _("Send2Trash lib not found")) + self.trashable = False + + else: + self.trashable = True def coreReady(self): @@ -321,6 +331,7 @@ class ExtractArchive(Hook): new_files = self._extract(pyfile, archive, pypack.password) finally: + pyfile.setProgress(100) thread.finishFile(pyfile) except Exception, e: @@ -449,31 +460,25 @@ class ExtractArchive(Hook): pyfile.setStatus("processing") delfiles = archive.getDeleteFiles() - if self.core.debug: - self.logDebug("Would delete: %s" % ", ".join(delfiles)) + self.logDebug("Would delete: " + ", ".join(delfiles)) - if self.getConfig('delete') != 'No': - try: - from send2trash import send2trash - if self.getConfig('delete') == "Trash": - self.trash = True - self.logInfo(_("Sending %s files to trash") % len(delfiles)) - except ImportError: - self.logError(name, _("Send2Trash not installed, no files deleted")) - self.trash = False - - if self.getConfig('delete') == "Permanent": - self.trash = False - self.logInfo(_("Deleting %s files") % len(delfiles)) + if self.getConfig('delete'): + self.logInfo(_("Deleting %s files") % len(delfiles)) + deltotrash = self.getConfig('deltotrash') for f in delfiles: file = fs_encode(f) - if os.path.exists(file) and self.trash: - send2trash(file) - elif os.path.exists(file): + if not os.path.exists(file) + continue + + if not deltotrash: os.remove(file) + + elif self.trashable: + send2trash.send2trash(file) + else: - self.logDebug("%s does not exists" % f) + self.logWarning("Unable to move %s to trash" % os.path.basename(f)) self.logInfo(name, _("Extracting finished")) extracted_files = archive.files or archive.list() -- cgit v1.2.3 From 034d87c836f9fba82142a06b5f666c84ca10bd50 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 7 Apr 2015 21:26:23 +0200 Subject: [YadiSk] Fix https://github.com/pyload/pyload/issues/1321 --- module/plugins/hooks/AntiVirus.py | 2 +- module/plugins/hooks/ExtractArchive.py | 2 +- module/plugins/hoster/YadiSk.py | 45 +++++++++++++++++----------------- 3 files changed, 24 insertions(+), 25 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/AntiVirus.py b/module/plugins/hooks/AntiVirus.py index f94d8d205..78f5aaa23 100644 --- a/module/plugins/hooks/AntiVirus.py +++ b/module/plugins/hooks/AntiVirus.py @@ -85,7 +85,7 @@ class AntiVirus(Hook): send2trash.send2trash(file) else: - self.logWarning("Unable to move file to trash, move to quarantine instead") + self.logWarning(_("Unable to move file to trash, move to quarantine instead")) pyfile.setCustomStatus(_("file moving")) shutil.move(file, self.getConfig('quardir')) diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 8b6a140cd..2f981d06b 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -478,7 +478,7 @@ class ExtractArchive(Hook): send2trash.send2trash(file) else: - self.logWarning("Unable to move %s to trash" % os.path.basename(f)) + self.logWarning(_("Unable to move %s to trash") % os.path.basename(f)) self.logInfo(name, _("Extracting finished")) extracted_files = archive.files or archive.list() diff --git a/module/plugins/hoster/YadiSk.py b/module/plugins/hoster/YadiSk.py index 57d8ae786..c3749d30d 100644 --- a/module/plugins/hoster/YadiSk.py +++ b/module/plugins/hoster/YadiSk.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- import re -import pycurl import random from module.common.json_layer import json_loads @@ -11,13 +10,13 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class YadiSk(SimpleHoster): __name__ = "YadiSk" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" __pattern__ = r'https?://yadi\.sk/d/\w+' __description__ = """Yadi.sk hoster plugin""" __license__ = "GPLv3" - __authors__ = [("GammaC0de", "nomail@fakemailbox.com")] + __authors__ = [("GammaC0de", None)] OFFLINE_PATTERN = r'Nothing found' @@ -32,7 +31,7 @@ class YadiSk(SimpleHoster): def handleFree(self, pyfile): m = re.search(r'', self.html) if m is None: - self.fail(_("could not find required json data")) + self.error(_("could not find required json data")) res = json_loads(m.group(1)) @@ -41,45 +40,45 @@ class YadiSk(SimpleHoster): yadisk_id = None yadisk_size = None yadisk_name = None - yadisk_hash = None - try: #@TODO: Copy to apiInfo method + + try: #@TODO: Copy to apiInfo for sect in res: if 'model' in sect: - if sect['model'] == 'config': + if sect['model'] == "config": yadisk_ver = sect['data']['version'] yadisk_sk = sect['data']['sk'] - elif sect['model'] == 'resource': + elif sect['model'] == "resource": yadisk_id = sect['data']['id'] yadisk_size = sect['data']['meta']['size'] yadisk_name = sect['data']['name'] - except Exception: - self.fail(_("Unexpected server response")) + except Exception, e: + self.fail(_("Unexpected server response"), e) - if None is in (yadisk_id, yadisk_sk, yadisk_id, yadisk_size, yadisk_name): - self.fail(_("json data is missing important information, cannot continue")) + if None in (yadisk_id, yadisk_sk, yadisk_id, yadisk_size, yadisk_name): + self.error(_("Missing JSON data")) self.pyfile.size = yadisk_size self.pyfile.name = yadisk_name yadisk_idclient = "" - for _i in range(1, 32): + for _i in range(32): yadisk_idclient += random.choice('0123456abcdef') - result_json = self.load("https://yadi.sk/models/?_m=do-get-resource-url", - post={'idClient': yadisk_idclient, - 'version' : yadisk_ver, - '_model.0': "do-get-resource-url", - 'sk' : yadisk_sk, - 'id.0' : yadisk_id}) - - res = json_loads(result_json) try: - self.link = res['models'][0]['data']['file'] + self.html = self.load("https://yadi.sk/models/", + get={'_m': "do-get-resource-url"}, + post={'idClient': yadisk_idclient, + 'version' : yadisk_ver, + '_model.0': "do-get-resource-url", + 'sk' : yadisk_sk, + 'id.0' : yadisk_id}) + + self.link = json_loads(self.html)['models'][0]['data']['file'] except Exception: - self.fail(_("faild to retrieve the download url")) + pass getInfo = create_getInfo(YadiSk) -- cgit v1.2.3 From c99421d6385e0f6b8bd9095c705becbc35f873a0 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 7 Apr 2015 22:08:58 +0200 Subject: Traceback code cosmetics --- module/plugins/hooks/ExtractArchive.py | 8 ++++---- module/plugins/hooks/IRCInterface.py | 4 ++-- module/plugins/hooks/MergeFiles.py | 5 ++--- module/plugins/internal/MultiHook.py | 5 +++-- 4 files changed, 11 insertions(+), 11 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 2f981d06b..595512c12 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -4,9 +4,9 @@ from __future__ import with_statement import os import sys +import traceback from copy import copy -from traceback import print_exc # monkey patch bug in python 2.6 and lower # http://bugs.python.org/issue6122 , http://bugs.python.org/issue1236 , http://bugs.python.org/issue1731717 @@ -177,12 +177,12 @@ class ExtractArchive(Hook): else: self.logWarning(_("Could not activate: %s") % p, e) if self.core.debug: - print_exc() + traceback.print_exc() except Exception, e: self.logWarning(_("Could not activate: %s") % p, e) if self.core.debug: - print_exc() + traceback.print_exc() if self.extractors: self.logInfo(_("Activated") + " " + "|".join("%s %s" % (Extractor.__name__, Extractor.VERSION) for Extractor in self.extractors)) @@ -497,7 +497,7 @@ class ExtractArchive(Hook): except Exception, e: self.logError(name, _("Unknown error"), e) if self.core.debug: - print_exc() + traceback.print_exc() self.manager.dispatchEvent("archive_extract_failed", pyfile, archive) diff --git a/module/plugins/hooks/IRCInterface.py b/module/plugins/hooks/IRCInterface.py index d76b9cb85..9e2f670e6 100644 --- a/module/plugins/hooks/IRCInterface.py +++ b/module/plugins/hooks/IRCInterface.py @@ -4,11 +4,11 @@ import re import socket import ssl import time +import traceback from pycurl import FORM_FILE from select import select from threading import Thread -from traceback import print_exc from module.Api import PackageDoesNotExists, FileDoesNotExists from module.network.RequestFactory import getURL @@ -106,7 +106,7 @@ class IRCInterface(Thread, Hook): except IRCError, ex: self.sock.send("QUIT :byebye\r\n") - print_exc() + traceback.print_exc() self.sock.close() diff --git a/module/plugins/hooks/MergeFiles.py b/module/plugins/hooks/MergeFiles.py index 2900b0d29..941938920 100644 --- a/module/plugins/hooks/MergeFiles.py +++ b/module/plugins/hooks/MergeFiles.py @@ -4,8 +4,7 @@ from __future__ import with_statement import os import re - -from traceback import print_exc +import traceback from module.plugins.Hook import Hook, threaded from module.utils import save_join @@ -75,7 +74,7 @@ class MergeFiles(Hook): self.logDebug("Finished merging part", splitted_file) except Exception, e: - print_exc() + traceback.print_exc() finally: pyfile.setProgress(100) diff --git a/module/plugins/internal/MultiHook.py b/module/plugins/internal/MultiHook.py index 291063268..942c044c2 100644 --- a/module/plugins/internal/MultiHook.py +++ b/module/plugins/internal/MultiHook.py @@ -2,6 +2,7 @@ import re import time +import traceback from module.plugins.Hook import Hook from module.utils import decode, remove_chars @@ -10,7 +11,7 @@ from module.utils import decode, remove_chars class MultiHook(Hook): __name__ = "MultiHook" __type__ = "hook" - __version__ = "0.41" + __version__ = "0.42" __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)", "" ), @@ -188,7 +189,7 @@ class MultiHook(Hook): except Exception, e: self.core.log.error(_("Error executing hooks: %s") % str(e)) if self.core.debug: - print_exc() + traceback.print_exc() self.cb = self.core.scheduler.addJob(self.interval, self._periodical) -- cgit v1.2.3 From 48abd898139b3f40d52b17680c9d5b8a674545c6 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 8 Apr 2015 00:10:43 +0200 Subject: [UserAgentSwitcher] Default activated set to True --- module/plugins/hooks/UserAgentSwitcher.py | 5 +++-- module/plugins/internal/SimpleDereferer.py | 5 +---- module/plugins/internal/SimpleHoster.py | 5 +---- 3 files changed, 5 insertions(+), 10 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/UserAgentSwitcher.py b/module/plugins/hooks/UserAgentSwitcher.py index 56c605bac..31eac9820 100644 --- a/module/plugins/hooks/UserAgentSwitcher.py +++ b/module/plugins/hooks/UserAgentSwitcher.py @@ -8,9 +8,10 @@ from module.plugins.Hook import Hook class UserAgentSwitcher(Hook): __name__ = "UserAgentSwitcher" __type__ = "hook" - __version__ = "0.01" + __version__ = "0.02" - __config__ = [("ua", "str", "Custom user-agent string", "")] + __config__ = [("activated", "bool", "Activated" , True ), + ("ua" , "str" , "Custom user-agent string", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:37.0) Gecko/20100101 Firefox/37.0")] __description__ = """Custom user-agent""" __license__ = "GPLv3" diff --git a/module/plugins/internal/SimpleDereferer.py b/module/plugins/internal/SimpleDereferer.py index 99077bfc3..743a98721 100644 --- a/module/plugins/internal/SimpleDereferer.py +++ b/module/plugins/internal/SimpleDereferer.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- -import pycurl import re from urllib import unquote @@ -12,7 +11,7 @@ from module.plugins.internal.SimpleHoster import getFileURL, set_cookies class SimpleDereferer(Crypter): __name__ = "SimpleDereferer" __type__ = "crypter" - __version__ = "0.10" + __version__ = "0.11" __pattern__ = r'^unmatchable$' __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), @@ -71,8 +70,6 @@ class SimpleDereferer(Crypter): self.html = "" self.req.setOption("timeout", 120) - self.req.http.c.setopt(pycurl.USERAGENT, - "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:37.0) Gecko/20100101 Firefox/37.0") #@NOTE: Work-around to old user-agent bug; remove in 0.4.10 if isinstance(self.COOKIES, list): set_cookies(self.req.cj, self.COOKIES) diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 87e136f08..79b7c0534 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -3,7 +3,6 @@ import datetime import mimetypes import os -import pycurl import re import time import urllib2 @@ -248,7 +247,7 @@ def secondsToMidnight(gmt=0): class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "1.34" + __version__ = "1.35" __pattern__ = r'^unmatchable$' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -434,8 +433,6 @@ class SimpleHoster(Hoster): self.fail(_("Required account not found")) self.req.setOption("timeout", 120) - self.req.http.c.setopt(pycurl.USERAGENT, - "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:37.0) Gecko/20100101 Firefox/37.0") #@NOTE: Work-around to old user-agent bug; remove in 0.4.10 if isinstance(self.COOKIES, list): set_cookies(self.req.cj, self.COOKIES) -- cgit v1.2.3 From 41a9fc39c201f663ee308840b8443f760b3678da Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 8 Apr 2015 00:30:57 +0200 Subject: [ExtractArchive] Fix https://github.com/pyload/pyload/issues/1322 --- module/plugins/hooks/ExtractArchive.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 595512c12..b418f802f 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -106,7 +106,7 @@ class ArchiveQueue(object): class ExtractArchive(Hook): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.39" + __version__ = "1.40" __config__ = [("activated" , "bool" , "Activated" , True ), ("fullpath" , "bool" , "Extract with full paths" , True ), @@ -468,7 +468,7 @@ class ExtractArchive(Hook): deltotrash = self.getConfig('deltotrash') for f in delfiles: file = fs_encode(f) - if not os.path.exists(file) + if not os.path.exists(file): continue if not deltotrash: -- cgit v1.2.3 From f33c80efb9437b815deea56a03897a57ae255d06 Mon Sep 17 00:00:00 2001 From: sraedler Date: Wed, 8 Apr 2015 02:00:00 +0200 Subject: Added Solidfiles Hoster --- module/plugins/hoster/Solidfiles.py | 42 +++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 module/plugins/hoster/Solidfiles.py (limited to 'module/plugins') diff --git a/module/plugins/hoster/Solidfiles.py b/module/plugins/hoster/Solidfiles.py new file mode 100644 index 000000000..54631ee50 --- /dev/null +++ b/module/plugins/hoster/Solidfiles.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +# +# Test links: +# http://www.solidfiles.com/d/609cdb4b1b + +import re + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + + +class solidfiles(SimpleHoster): + __name__ = "solidfiles" + __type__ = "hoster" + __version__ = "0.01" + + __pattern__ = r'http:\/\/(?:www\.)?solidfiles\.com\/\w+\/(\w)+\/(\w|.|\d)*' + + __description__ = """ solidfiles.com hoster plugin """ + __license__ = "GPLv3" + __authors__ = [("sraedler", "simon.raedler@yahoo.de")] + + + NAME_PATTERN = r'

(?P(\d|\.)+) (?P(\w)+)' + OFFLINE_PATTERN = r'

404<\/h1>' + + LINK_FREE_PATTERN = r'id="ddl-text" href="(https:\/\/(\w|\d|\.|\/)+)"' + + def setup(self): + self.multiDL = True + self.chunkLimit = 1 + + + def handleFree(self, pyfile): + # Search for Download URL + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m is None: + self.error(_("LINK_FREE_PATTERN not found")) + self.logDebug("Downloadlink: " + m.group(1)) + self.download(m.group(1)) + +getInfo = create_getInfo(solidfiles) \ No newline at end of file -- cgit v1.2.3 From bc2ec03799dbb8479b8e519bb30eb5bf316dec57 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 8 Apr 2015 03:14:32 +0200 Subject: [UserAgentSwitcher] Fix https://github.com/pyload/pyload/issues/1324 --- module/plugins/hooks/UserAgentSwitcher.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/UserAgentSwitcher.py b/module/plugins/hooks/UserAgentSwitcher.py index 31eac9820..b0cf66709 100644 --- a/module/plugins/hooks/UserAgentSwitcher.py +++ b/module/plugins/hooks/UserAgentSwitcher.py @@ -8,7 +8,7 @@ from module.plugins.Hook import Hook class UserAgentSwitcher(Hook): __name__ = "UserAgentSwitcher" __type__ = "hook" - __version__ = "0.02" + __version__ = "0.03" __config__ = [("activated", "bool", "Activated" , True ), ("ua" , "str" , "Custom user-agent string", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:37.0) Gecko/20100101 Firefox/37.0")] @@ -29,4 +29,4 @@ class UserAgentSwitcher(Hook): ua = self.getConfig('ua') if ua: self.logDebug("Use custom user-agent string: " + ua) - pyfile.plugin.req.http.c.setopt(pycurl.USERAGENT, ua) + pyfile.plugin.req.http.c.setopt(pycurl.USERAGENT, ua.encode('utf-8')) -- cgit v1.2.3 From eb9edff095dd9f83966723be506a4fd91f64a8c9 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 8 Apr 2015 03:23:09 +0200 Subject: [SolidfilesCom] Cleanup --- module/plugins/hoster/Solidfiles.py | 42 ---------------------------------- module/plugins/hoster/SolidfilesCom.py | 33 ++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 42 deletions(-) delete mode 100644 module/plugins/hoster/Solidfiles.py create mode 100644 module/plugins/hoster/SolidfilesCom.py (limited to 'module/plugins') diff --git a/module/plugins/hoster/Solidfiles.py b/module/plugins/hoster/Solidfiles.py deleted file mode 100644 index 54631ee50..000000000 --- a/module/plugins/hoster/Solidfiles.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Test links: -# http://www.solidfiles.com/d/609cdb4b1b - -import re - -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo - - -class solidfiles(SimpleHoster): - __name__ = "solidfiles" - __type__ = "hoster" - __version__ = "0.01" - - __pattern__ = r'http:\/\/(?:www\.)?solidfiles\.com\/\w+\/(\w)+\/(\w|.|\d)*' - - __description__ = """ solidfiles.com hoster plugin """ - __license__ = "GPLv3" - __authors__ = [("sraedler", "simon.raedler@yahoo.de")] - - - NAME_PATTERN = r'

(?P(\d|\.)+) (?P(\w)+)' - OFFLINE_PATTERN = r'

404<\/h1>' - - LINK_FREE_PATTERN = r'id="ddl-text" href="(https:\/\/(\w|\d|\.|\/)+)"' - - def setup(self): - self.multiDL = True - self.chunkLimit = 1 - - - def handleFree(self, pyfile): - # Search for Download URL - m = re.search(self.LINK_FREE_PATTERN, self.html) - if m is None: - self.error(_("LINK_FREE_PATTERN not found")) - self.logDebug("Downloadlink: " + m.group(1)) - self.download(m.group(1)) - -getInfo = create_getInfo(solidfiles) \ No newline at end of file diff --git a/module/plugins/hoster/SolidfilesCom.py b/module/plugins/hoster/SolidfilesCom.py new file mode 100644 index 000000000..d359577d6 --- /dev/null +++ b/module/plugins/hoster/SolidfilesCom.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# +# Test links: +# http://www.solidfiles.com/d/609cdb4b1b + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + + +class SolidfilesCom(SimpleHoster): + __name__ = "SolidfilesCom" + __type__ = "hoster" + __version__ = "0.02" + + __pattern__ = r'http://(?:www\.)?solidfiles\.com\/d/\w+' + + __description__ = """Solidfiles.com hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("sraedler", "simon.raedler@yahoo.de")] + + + NAME_PATTERN = r'

(?P[\d.,]+) (?P[\w_^]+)' + OFFLINE_PATTERN = r'

404' + + LINK_FREE_PATTERN = r'id="ddl-text" href="(.+?)"' + + + def setup(self): + self.multiDL = True + self.chunkLimit = 1 + + +getInfo = create_getInfo(SolidfilesCom) -- cgit v1.2.3 From a667e20cfc029672801f28e6db3b05483658c13d Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 8 Apr 2015 03:37:42 +0200 Subject: [RemixshareCom] Cleanup --- module/plugins/hoster/RemixshareCom.py | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/RemixshareCom.py b/module/plugins/hoster/RemixshareCom.py index b62db8af3..d60101aed 100644 --- a/module/plugins/hoster/RemixshareCom.py +++ b/module/plugins/hoster/RemixshareCom.py @@ -16,23 +16,25 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class RemixshareCom(SimpleHoster): __name__ = "RemixshareCom" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.05" __pattern__ = r'https?://remixshare\.com/(download|dl)/\w+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Remixshare.com hoster plugin""" __license__ = "GPLv3" - __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de"), - ("Walter Purcaro", "vuolter@gmail.com"), - ("sraedler", "simon.raedler@yahoo.de")] + __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de" ), + ("Walter Purcaro", "vuolter@gmail.com" ), + ("sraedler" , "simon.raedler@yahoo.de")] - INFO_PATTERN = r'title=\'.+?\'>(?P.+?) \((?P\d+) (?P[\w^_]+)\)<' - OFFLINE_PATTERN = r'

Ooops!<' + INFO_PATTERN = r'title=\'.+?\'>(?P.+?) \((?P\d+) (?P[\w^_]+)\)<' + HASHSUM_PATTERN = r'>(?PMD5): (?P\w+)' + OFFLINE_PATTERN = r'

Ooops!' - LINK_FREE_PATTERN = r'(http:\/\/remixshare\.com\/startloading(\w|\/)+)' + LINK_PATTERN = r'var uri = "(.+?)"' TOKEN_PATTERN = r'var acc = (\d+)' + WAIT_PATTERN = r'var XYZ = "(\d+)"' @@ -42,23 +44,15 @@ class RemixshareCom(SimpleHoster): def handleFree(self, pyfile): - b = re.search(self.LINK_FREE_PATTERN, self.html) + b = re.search(self.LINK_PATTERN, self.html) if not b: - self.error(_("Cannot parse download url")) + self.error(_("File url")) c = re.search(self.TOKEN_PATTERN, self.html) if not c: - self.error(_("Cannot parse file token")) + self.error(_("File token")) self.link = b.group(1) + "/zzz/" + c.group(1) - self.logDebug(self.link) - - #Check if we have to wait - seconds = re.search(self.WAIT_PATTERN, self.html) - if seconds: - self.logDebug("Wait " + seconds.group(1) + " Seconds") - self.wait(seconds.group(1)) - self.download(self.link) getInfo = create_getInfo(RemixshareCom) -- cgit v1.2.3 From c5bd9e25f08248834aa6192b60ab968e95a10dc1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 8 Apr 2015 04:32:51 +0200 Subject: [AntiVirus][ExtractArchive] Fixup --- module/plugins/hooks/AntiVirus.py | 4 ++-- module/plugins/hooks/ExtractArchive.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/AntiVirus.py b/module/plugins/hooks/AntiVirus.py index 78f5aaa23..27e3801b5 100644 --- a/module/plugins/hooks/AntiVirus.py +++ b/module/plugins/hooks/AntiVirus.py @@ -11,7 +11,7 @@ from module.utils import fs_encode, save_join class AntiVirus(Hook): __name__ = "AntiVirus" __type__ = "hook" - __version__ = "0.06" + __version__ = "0.07" #@TODO: add trash option (use Send2Trash lib) __config__ = [("action" , "Antivirus default;Delete;Quarantine", "Manage infected files" , "Antivirus default"), @@ -37,7 +37,7 @@ class AntiVirus(Hook): import send2trash except ImportError: - self.logDebug(name, _("Send2Trash lib not found")) + self.logDebug("Send2Trash lib not found") self.trashable = False else: diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index b418f802f..9e6f2d379 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -106,7 +106,7 @@ class ArchiveQueue(object): class ExtractArchive(Hook): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.40" + __version__ = "1.41" __config__ = [("activated" , "bool" , "Activated" , True ), ("fullpath" , "bool" , "Extract with full paths" , True ), @@ -154,7 +154,7 @@ class ExtractArchive(Hook): import send2trash except ImportError: - self.logDebug(name, _("Send2Trash lib not found")) + self.logDebug("Send2Trash lib not found") self.trashable = False else: -- cgit v1.2.3 From 58980accb36660d200d2239f7c801173ec899b56 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 8 Apr 2015 14:22:26 +0200 Subject: [CatShareNet] https://github.com/pyload/pyload/issues/1325 --- module/plugins/hoster/CatShareNet.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/CatShareNet.py b/module/plugins/hoster/CatShareNet.py index ec9c62a23..9e3f28cfa 100644 --- a/module/plugins/hoster/CatShareNet.py +++ b/module/plugins/hoster/CatShareNet.py @@ -9,7 +9,7 @@ from module.plugins.internal.CaptchaService import ReCaptcha class CatShareNet(SimpleHoster): __name__ = "CatShareNet" __type__ = "hoster" - __version__ = "0.12" + __version__ = "0.13" __pattern__ = r'http://(?:www\.)?catshare\.net/\w{16}' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -24,12 +24,13 @@ class CatShareNet(SimpleHoster): TEXT_ENCODING = True INFO_PATTERN = r'(?P<N>.+) \((?P<S>[\d.,]+) (?P<U>[\w^_]+)\)<' - OFFLINE_PATTERN = ur'Podany plik został usunięty\s*</div>' + OFFLINE_PATTERN = r'<div class="alert alert-error"' IP_BLOCKED_PATTERN = ur'>Nasz serwis wykrył że Twój adres IP nie pochodzi z Polski.<' WAIT_PATTERN = r'var\scount\s=\s(\d+);' - LINK_FREE_PATTERN = LINK_PREMIUM_PATTERN = r'<form action="(.+?)" method="GET">' + LINK_FREE_PATTERN = r'<form action="(.+?)" method="GET">' + LINK_PREMIUM_PATTERN = r'<form action="(.+?)" method="GET">' def setup(self): @@ -54,11 +55,8 @@ class CatShareNet(SimpleHoster): 'recaptcha_response_field' : response}) m = re.search(self.LINK_FREE_PATTERN, self.html) - if m is None: - self.invalidCaptcha() - self.retry(reason=_("Wrong captcha entered")) - - self.link = m.group(1) + if m: + self.link = m.group(1) getInfo = create_getInfo(CatShareNet) -- cgit v1.2.3 From 138e514ce4dd9ccce8af5b4dfbecdfcc03b62cbe Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@users.noreply.github.com> Date: Wed, 8 Apr 2015 14:29:06 +0200 Subject: [RapiduNet] https://github.com/pyload/pyload/issues/1326 --- module/plugins/hoster/RapiduNet.py | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/RapiduNet.py b/module/plugins/hoster/RapiduNet.py index f43eda0cb..8a85bc844 100644 --- a/module/plugins/hoster/RapiduNet.py +++ b/module/plugins/hoster/RapiduNet.py @@ -13,7 +13,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class RapiduNet(SimpleHoster): __name__ = "RapiduNet" __type__ = "hoster" - __version__ = "0.07" + __version__ = "0.08" __pattern__ = r'https?://(?:www\.)?rapidu\.net/(?P<ID>\d{10})' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -26,7 +26,7 @@ class RapiduNet(SimpleHoster): COOKIES = [("rapidu.net", "rapidu_lang", "en")] INFO_PATTERN = r'<h1 title="(?P<N>.*)">.*</h1>\s*<small>(?P<S>\d+(\.\d+)?)\s(?P<U>\w+)</small>' - OFFLINE_PATTERN = r'404 - File not found' + OFFLINE_PATTERN = r'<h1>404' ERROR_PATTERN = r'<div class="error">' @@ -58,20 +58,18 @@ class RapiduNet(SimpleHoster): self.wait(int(jsvars['timeToDownload']) - int(time.time())) recaptcha = ReCaptcha(self) + response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) - for _i in xrange(10): - response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) - - jsvars = self.getJsonResponse("https://rapidu.net/ajax.php", - get={'a': "getCheckCaptcha"}, - post={'_go' : "", - 'captcha1': challenge, - 'captcha2': response, - 'fileId' : self.info['pattern']['ID']}, - decode=True) - if jsvars['message'] == 'success': - self.download(jsvars['url']) - break + jsvars = self.getJsonResponse("https://rapidu.net/ajax.php", + get={'a': "getCheckCaptcha"}, + post={'_go' : "", + 'captcha1': challenge, + 'captcha2': response, + 'fileId' : self.info['pattern']['ID']}, + decode=True) + + if jsvars['message'] == 'success': + self.link = jsvars['url'] def getJsonResponse(self, *args, **kwargs): -- cgit v1.2.3 From 77ef36eae8c6d930656c5b060bf2e41b6f7fc743 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@users.noreply.github.com> Date: Wed, 8 Apr 2015 15:10:43 +0200 Subject: [UserAgentSwitcher] Random user-agent feature --- module/plugins/hooks/UpdateManager.py | 4 ++-- module/plugins/hooks/UserAgentSwitcher.py | 27 +++++++++++++++++++++------ 2 files changed, 23 insertions(+), 8 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/UpdateManager.py b/module/plugins/hooks/UpdateManager.py index 643b5c2d1..d66810d6d 100644 --- a/module/plugins/hooks/UpdateManager.py +++ b/module/plugins/hooks/UpdateManager.py @@ -117,7 +117,7 @@ class UpdateManager(Hook): return getURL(self.SERVER_URL, get={'v': self.core.api.getServerVersion()}).splitlines() except Exception: - self.logWarning(_("Unable to contact server to get updates")) + self.logWarning(_("Unable to retrieve server to get updates")) @Expose @@ -258,7 +258,7 @@ class UpdateManager(Hook): if self.core.pluginManager.reloadPlugins(updated): exitcode = 1 else: - self.logWarning(_("pyLoad restart required to reload the updated plugins")) + self.logWarning(_("Restart pyLoad to reload the updated plugins")) self.info['plugins'] = True exitcode = 2 diff --git a/module/plugins/hooks/UserAgentSwitcher.py b/module/plugins/hooks/UserAgentSwitcher.py index b0cf66709..912c2ef09 100644 --- a/module/plugins/hooks/UserAgentSwitcher.py +++ b/module/plugins/hooks/UserAgentSwitcher.py @@ -1,17 +1,24 @@ # -*- coding: utf-8 -*- +from __future__ import with_statement + +import os import pycurl +import random from module.plugins.Hook import Hook +from module.utils import fs_encode class UserAgentSwitcher(Hook): __name__ = "UserAgentSwitcher" __type__ = "hook" - __version__ = "0.03" + __version__ = "0.04" __config__ = [("activated", "bool", "Activated" , True ), - ("ua" , "str" , "Custom user-agent string", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:37.0) Gecko/20100101 Firefox/37.0")] + ("uaf" , "file", "Random user-agents file" , "" ), + ("uar" , "bool", "Random user-agent" , False ), + ("uas" , "str" , "Custom user-agent string", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:37.0) Gecko/20100101 Firefox/37.0")] __description__ = """Custom user-agent""" __license__ = "GPLv3" @@ -26,7 +33,15 @@ class UserAgentSwitcher(Hook): def downloadPreparing(self, pyfile): - ua = self.getConfig('ua') - if ua: - self.logDebug("Use custom user-agent string: " + ua) - pyfile.plugin.req.http.c.setopt(pycurl.USERAGENT, ua.encode('utf-8')) + uar = self.getConfig('uar') + uaf = fs_encode(self.getConfig('uaf')) + + if uar and os.path.isfile(uaf): + with open(uaf) as f: + uas = random.choice([ua for ua in f.read().splitlines()]) + else: + uas = self.getConfig('uas') + + if uas: + self.logDebug("Use custom user-agent string: " + uas) + pyfile.plugin.req.http.c.setopt(pycurl.USERAGENT, uas.encode('utf-8')) -- cgit v1.2.3 From 02e3ede3edcf4415ac466fbea9d4f25d9ccc8671 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@users.noreply.github.com> Date: Wed, 8 Apr 2015 15:38:01 +0200 Subject: Spare code cosmetics --- module/plugins/crypter/NCryptIn.py | 2 +- module/plugins/crypter/RelinkUs.py | 6 +++--- module/plugins/crypter/ShareLinksBiz.py | 2 +- module/plugins/hoster/EuroshareEu.py | 2 +- module/plugins/hoster/FreakshareCom.py | 20 +++++++++++--------- module/plugins/hoster/NetloadIn.py | 2 +- module/plugins/hoster/OverLoadMe.py | 2 +- module/plugins/hoster/PornhubCom.py | 2 +- module/plugins/hoster/RealdebridCom.py | 2 +- module/plugins/hoster/RedtubeCom.py | 2 +- module/plugins/hoster/ShareplaceCom.py | 2 +- module/plugins/hoster/XHamsterCom.py | 2 +- module/plugins/hoster/YoupornCom.py | 2 +- module/plugins/hoster/YourfilesTo.py | 2 +- module/plugins/internal/SimpleHoster.py | 2 +- 15 files changed, 27 insertions(+), 25 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/crypter/NCryptIn.py b/module/plugins/crypter/NCryptIn.py index 7de2c0df7..8ceb9d3c8 100644 --- a/module/plugins/crypter/NCryptIn.py +++ b/module/plugins/crypter/NCryptIn.py @@ -108,7 +108,7 @@ class NCryptIn(Crypter): def isProtected(self): form = re.search(r'<form.*?name.*?protected.*?>(.*?)</form>', self.cleanedHtml, re.S) - if form is not None: + if form: content = form.group(1) for keyword in ("password", "captcha"): if keyword in content: diff --git a/module/plugins/crypter/RelinkUs.py b/module/plugins/crypter/RelinkUs.py index e3082be00..ed3da1f9b 100644 --- a/module/plugins/crypter/RelinkUs.py +++ b/module/plugins/crypter/RelinkUs.py @@ -153,7 +153,7 @@ class RelinkUs(Crypter): # Try to get info from web m = re.search(self.FILE_TITLE_REGEX, self.html) - if m is not None: + if m: title = m.group(1).strip() if not self.FILE_NOTITLE in title: name = folder = title @@ -198,7 +198,7 @@ class RelinkUs(Crypter): self.logDebug("Search for CNL2 links") package_links = [] m = re.search(self.CNL2_FORM_REGEX, self.html, re.S) - if m is not None: + if m: cnl2_form = m.group(1) try: (vcrypted, vjk) = self._getCipherParams(cnl2_form) @@ -213,7 +213,7 @@ class RelinkUs(Crypter): self.logDebug("Search for DLC links") package_links = [] m = re.search(self.DLC_LINK_REGEX, self.html) - if m is not None: + if m: container_url = self.DLC_DOWNLOAD_URL + "?id=%s&dlc=1" % self.fileid self.logDebug("Downloading DLC container link [%s]" % container_url) try: diff --git a/module/plugins/crypter/ShareLinksBiz.py b/module/plugins/crypter/ShareLinksBiz.py index 4a0b61b5f..f17ba54d7 100644 --- a/module/plugins/crypter/ShareLinksBiz.py +++ b/module/plugins/crypter/ShareLinksBiz.py @@ -164,7 +164,7 @@ class ShareLinksBiz(Crypter): # Extract from web package header title_re = r'<h2><img.*?/>(.*)</h2>' m = re.search(title_re, self.html, re.S) - if m is not None: + if m: title = m.group(1).strip() if 'unnamed' not in title: name = folder = title diff --git a/module/plugins/hoster/EuroshareEu.py b/module/plugins/hoster/EuroshareEu.py index c5059e69e..922665c2e 100644 --- a/module/plugins/hoster/EuroshareEu.py +++ b/module/plugins/hoster/EuroshareEu.py @@ -48,7 +48,7 @@ class EuroshareEu(SimpleHoster): def handleFree(self, pyfile): - if re.search(self.ERR_PARDL_PATTERN, self.html) is not None: + if re.search(self.ERR_PARDL_PATTERN, self.html): self.longWait(5 * 60, 12) m = re.search(self.LINK_FREE_PATTERN, self.html) diff --git a/module/plugins/hoster/FreakshareCom.py b/module/plugins/hoster/FreakshareCom.py index 9a11f933d..6a595e75b 100644 --- a/module/plugins/hoster/FreakshareCom.py +++ b/module/plugins/hoster/FreakshareCom.py @@ -107,12 +107,14 @@ class FreakshareCom(Hoster): def get_file_name(self): if not self.html: self.download_html() + if not self.wantReconnect: - file_name = re.search(r"<h1\sclass=\"box_heading\"\sstyle=\"text-align:center;\">([^ ]+)", self.html) - if file_name is not None: - file_name = file_name.group(1) + m = re.search(r"<h1\sclass=\"box_heading\"\sstyle=\"text-align:center;\">([^ ]+)", self.html) + if m: + file_name = m.group(1) else: file_name = self.pyfile.url + return file_name else: return self.pyfile.url @@ -122,12 +124,12 @@ class FreakshareCom(Hoster): size = 0 if not self.html: self.download_html() + if not self.wantReconnect: - file_size_check = re.search( - r"<h1\sclass=\"box_heading\"\sstyle=\"text-align:center;\">[^ ]+ - ([^ ]+) (\w\w)yte", self.html) - if file_size_check is not None: - units = float(file_size_check.group(1).replace(",", "")) - pow = {'KB': 1, 'MB': 2, 'GB': 3}[file_size_check.group(2)] + m = re.search(r"<h1\sclass=\"box_heading\"\sstyle=\"text-align:center;\">[^ ]+ - ([^ ]+) (\w\w)yte", self.html) + if m: + units = float(m.group(1).replace(",", "")) + pow = {'KB': 1, 'MB': 2, 'GB': 3}[m.group(2)] size = int(units * 1024 ** pow) return size @@ -153,7 +155,7 @@ class FreakshareCom(Hoster): """ if not self.html: self.download_html() - if re.search(r"This file does not exist!", self.html) is not None: + if re.search(r"This file does not exist!", self.html): return False else: return True diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index 0ff3c25d3..57af3f18e 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -268,7 +268,7 @@ class NetloadIn(Hoster): try: file_url_pattern = r'<a class="Orange_Link" href="(http://.+)".?>Or click here' attempt = re.search(file_url_pattern, page) - if attempt is not None: + if attempt: return attempt.group(1) else: self.logDebug("Backup try for final link") diff --git a/module/plugins/hoster/OverLoadMe.py b/module/plugins/hoster/OverLoadMe.py index 398946e43..934de5746 100644 --- a/module/plugins/hoster/OverLoadMe.py +++ b/module/plugins/hoster/OverLoadMe.py @@ -42,7 +42,7 @@ class OverLoadMe(MultiHoster): self.logWarning(data['msg']) self.tempOffline() else: - if pyfile.name is not None and pyfile.name.endswith('.tmp') and data['filename']: + if pyfile.name and pyfile.name.endswith('.tmp') and data['filename']: pyfile.name = data['filename'] pyfile.size = parseFileSize(data['filesize']) diff --git a/module/plugins/hoster/PornhubCom.py b/module/plugins/hoster/PornhubCom.py index 9e0b16a85..16ce36ea9 100644 --- a/module/plugins/hoster/PornhubCom.py +++ b/module/plugins/hoster/PornhubCom.py @@ -83,7 +83,7 @@ class PornhubCom(Hoster): if not self.html: self.download_html() - if re.search(r'This video is no longer in our database or is in conversion', self.html) is not None: + if re.search(r'This video is no longer in our database or is in conversion', self.html): return False else: return True diff --git a/module/plugins/hoster/RealdebridCom.py b/module/plugins/hoster/RealdebridCom.py index 1a8715e0e..f35eb5e03 100644 --- a/module/plugins/hoster/RealdebridCom.py +++ b/module/plugins/hoster/RealdebridCom.py @@ -44,7 +44,7 @@ class RealdebridCom(MultiHoster): self.logWarning(data['message']) self.tempOffline() else: - if pyfile.name is not None and pyfile.name.endswith('.tmp') and data['file_name']: + if pyfile.name and pyfile.name.endswith('.tmp') and data['file_name']: pyfile.name = data['file_name'] pyfile.size = parseFileSize(data['file_size']) self.link = data['generated_links'][0][-1] diff --git a/module/plugins/hoster/RedtubeCom.py b/module/plugins/hoster/RedtubeCom.py index d68fbe262..9051c498a 100644 --- a/module/plugins/hoster/RedtubeCom.py +++ b/module/plugins/hoster/RedtubeCom.py @@ -56,7 +56,7 @@ class RedtubeCom(Hoster): if not self.html: self.download_html() - if re.search(r'This video has been removed.', self.html) is not None: + if re.search(r'This video has been removed.', self.html): return False else: return True diff --git a/module/plugins/hoster/ShareplaceCom.py b/module/plugins/hoster/ShareplaceCom.py index 07724a9d1..c540dd2df 100644 --- a/module/plugins/hoster/ShareplaceCom.py +++ b/module/plugins/hoster/ShareplaceCom.py @@ -83,7 +83,7 @@ class ShareplaceCom(Hoster): if not self.html: self.download_html() - if re.search(r"HTTP Status 404", self.html) is not None: + if re.search(r"HTTP Status 404", self.html): return False else: return True diff --git a/module/plugins/hoster/XHamsterCom.py b/module/plugins/hoster/XHamsterCom.py index fd494e099..9004dbac0 100644 --- a/module/plugins/hoster/XHamsterCom.py +++ b/module/plugins/hoster/XHamsterCom.py @@ -123,7 +123,7 @@ class XHamsterCom(Hoster): """ if not self.html: self.download_html() - if re.search(r"(.*Video not found.*)", self.html) is not None: + if re.search(r"(.*Video not found.*)", self.html): return False else: return True diff --git a/module/plugins/hoster/YoupornCom.py b/module/plugins/hoster/YoupornCom.py index 4bb2520e6..19d07fa36 100644 --- a/module/plugins/hoster/YoupornCom.py +++ b/module/plugins/hoster/YoupornCom.py @@ -54,7 +54,7 @@ class YoupornCom(Hoster): """ if not self.html: self.download_html() - if re.search(r"(.*invalid video_id.*)", self.html) is not None: + if re.search(r"(.*invalid video_id.*)", self.html): return False else: return True diff --git a/module/plugins/hoster/YourfilesTo.py b/module/plugins/hoster/YourfilesTo.py index e0def108e..fd65a6a41 100644 --- a/module/plugins/hoster/YourfilesTo.py +++ b/module/plugins/hoster/YourfilesTo.py @@ -81,7 +81,7 @@ class YourfilesTo(Hoster): if not self.html: self.download_html() - if re.search(r"HTTP Status 404", self.html) is not None: + if re.search(r"HTTP Status 404", self.html): return False else: return True diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 79b7c0534..8b1527b3e 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -30,7 +30,7 @@ def _error(self, reason, type): type = "unknown" msg = _("%s error") % type.strip().capitalize() if type else _("Error") - msg += ": %s" % reason.strip() if reason else "" + msg += (": %s" % reason.strip()) if reason else "" msg += _(" | Plugin may be out of date") raise Fail(msg) -- cgit v1.2.3 From 348a386486d081d86363774e64525484ef159cd6 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@users.noreply.github.com> Date: Wed, 8 Apr 2015 19:23:06 +0200 Subject: Fix https://github.com/pyload/pyload/issues/1157 --- module/plugins/hooks/AlldebridCom.py | 27 ---------- module/plugins/hooks/AlldebridComHook.py | 27 ++++++++++ module/plugins/hooks/DebridItaliaCom.py | 26 --------- module/plugins/hooks/DebridItaliaComHook.py | 26 +++++++++ module/plugins/hooks/EasybytezCom.py | 30 ----------- module/plugins/hooks/EasybytezComHook.py | 30 +++++++++++ module/plugins/hooks/FastixRu.py | 29 ---------- module/plugins/hooks/FastixRuHook.py | 29 ++++++++++ module/plugins/hooks/FreeWayMe.py | 32 ----------- module/plugins/hooks/FreeWayMeHook.py | 32 +++++++++++ module/plugins/hooks/LinkdecrypterCom.py | 25 --------- module/plugins/hooks/LinkdecrypterComHook.py | 26 +++++++++ module/plugins/hooks/LinksnappyCom.py | 27 ---------- module/plugins/hooks/LinksnappyComHook.py | 27 ++++++++++ module/plugins/hooks/MegaDebridEu.py | 33 ------------ module/plugins/hooks/MegaDebridEuHook.py | 33 ++++++++++++ module/plugins/hooks/MegaRapidoNet.py | 81 ---------------------------- module/plugins/hooks/MegaRapidoNetHook.py | 81 ++++++++++++++++++++++++++++ module/plugins/hooks/MultihostersCom.py | 18 ------- module/plugins/hooks/MultihostersComHook.py | 18 +++++++ module/plugins/hooks/MultishareCz.py | 29 ---------- module/plugins/hooks/MultishareCzHook.py | 29 ++++++++++ module/plugins/hooks/MyfastfileCom.py | 28 ---------- module/plugins/hooks/MyfastfileComHook.py | 28 ++++++++++ module/plugins/hooks/NoPremiumPl.py | 29 ---------- module/plugins/hooks/NoPremiumPlHook.py | 29 ++++++++++ module/plugins/hooks/OverLoadMe.py | 29 ---------- module/plugins/hooks/OverLoadMeHook.py | 29 ++++++++++ module/plugins/hooks/PremiumTo.py | 27 ---------- module/plugins/hooks/PremiumToHook.py | 27 ++++++++++ module/plugins/hooks/PremiumizeMe.py | 38 ------------- module/plugins/hooks/PremiumizeMeHook.py | 38 +++++++++++++ module/plugins/hooks/PutdriveCom.py | 18 ------- module/plugins/hooks/PutdriveComHook.py | 18 +++++++ module/plugins/hooks/RPNetBiz.py | 36 ------------- module/plugins/hooks/RPNetBizHook.py | 36 +++++++++++++ module/plugins/hooks/RapideoPl.py | 29 ---------- module/plugins/hooks/RapideoPlHook.py | 29 ++++++++++ module/plugins/hooks/RealdebridCom.py | 27 ---------- module/plugins/hooks/RealdebridComHook.py | 27 ++++++++++ module/plugins/hooks/RehostTo.py | 27 ---------- module/plugins/hooks/RehostToHook.py | 27 ++++++++++ module/plugins/hooks/SimplyPremiumCom.py | 29 ---------- module/plugins/hooks/SimplyPremiumComHook.py | 29 ++++++++++ module/plugins/hooks/SimplydebridCom.py | 24 --------- module/plugins/hooks/SimplydebridComHook.py | 24 +++++++++ module/plugins/hooks/SmoozedCom.py | 24 --------- module/plugins/hooks/SmoozedComHook.py | 24 +++++++++ module/plugins/hooks/UnrestrictLi.py | 28 ---------- module/plugins/hooks/UnrestrictLiHook.py | 28 ++++++++++ module/plugins/hooks/ZeveraCom.py | 25 --------- module/plugins/hooks/ZeveraComHook.py | 25 +++++++++ module/plugins/internal/MultiHook.py | 15 +++--- 53 files changed, 783 insertions(+), 783 deletions(-) delete mode 100644 module/plugins/hooks/AlldebridCom.py create mode 100644 module/plugins/hooks/AlldebridComHook.py delete mode 100644 module/plugins/hooks/DebridItaliaCom.py create mode 100644 module/plugins/hooks/DebridItaliaComHook.py delete mode 100644 module/plugins/hooks/EasybytezCom.py create mode 100644 module/plugins/hooks/EasybytezComHook.py delete mode 100644 module/plugins/hooks/FastixRu.py create mode 100644 module/plugins/hooks/FastixRuHook.py delete mode 100644 module/plugins/hooks/FreeWayMe.py create mode 100644 module/plugins/hooks/FreeWayMeHook.py delete mode 100644 module/plugins/hooks/LinkdecrypterCom.py create mode 100644 module/plugins/hooks/LinkdecrypterComHook.py delete mode 100644 module/plugins/hooks/LinksnappyCom.py create mode 100644 module/plugins/hooks/LinksnappyComHook.py delete mode 100644 module/plugins/hooks/MegaDebridEu.py create mode 100644 module/plugins/hooks/MegaDebridEuHook.py delete mode 100644 module/plugins/hooks/MegaRapidoNet.py create mode 100644 module/plugins/hooks/MegaRapidoNetHook.py delete mode 100644 module/plugins/hooks/MultihostersCom.py create mode 100644 module/plugins/hooks/MultihostersComHook.py delete mode 100644 module/plugins/hooks/MultishareCz.py create mode 100644 module/plugins/hooks/MultishareCzHook.py delete mode 100644 module/plugins/hooks/MyfastfileCom.py create mode 100644 module/plugins/hooks/MyfastfileComHook.py delete mode 100644 module/plugins/hooks/NoPremiumPl.py create mode 100644 module/plugins/hooks/NoPremiumPlHook.py delete mode 100644 module/plugins/hooks/OverLoadMe.py create mode 100644 module/plugins/hooks/OverLoadMeHook.py delete mode 100644 module/plugins/hooks/PremiumTo.py create mode 100644 module/plugins/hooks/PremiumToHook.py delete mode 100644 module/plugins/hooks/PremiumizeMe.py create mode 100644 module/plugins/hooks/PremiumizeMeHook.py delete mode 100644 module/plugins/hooks/PutdriveCom.py create mode 100644 module/plugins/hooks/PutdriveComHook.py delete mode 100644 module/plugins/hooks/RPNetBiz.py create mode 100644 module/plugins/hooks/RPNetBizHook.py delete mode 100644 module/plugins/hooks/RapideoPl.py create mode 100644 module/plugins/hooks/RapideoPlHook.py delete mode 100644 module/plugins/hooks/RealdebridCom.py create mode 100644 module/plugins/hooks/RealdebridComHook.py delete mode 100644 module/plugins/hooks/RehostTo.py create mode 100644 module/plugins/hooks/RehostToHook.py delete mode 100644 module/plugins/hooks/SimplyPremiumCom.py create mode 100644 module/plugins/hooks/SimplyPremiumComHook.py delete mode 100644 module/plugins/hooks/SimplydebridCom.py create mode 100644 module/plugins/hooks/SimplydebridComHook.py delete mode 100644 module/plugins/hooks/SmoozedCom.py create mode 100644 module/plugins/hooks/SmoozedComHook.py delete mode 100644 module/plugins/hooks/UnrestrictLi.py create mode 100644 module/plugins/hooks/UnrestrictLiHook.py delete mode 100644 module/plugins/hooks/ZeveraCom.py create mode 100644 module/plugins/hooks/ZeveraComHook.py (limited to 'module/plugins') diff --git a/module/plugins/hooks/AlldebridCom.py b/module/plugins/hooks/AlldebridCom.py deleted file mode 100644 index 34f44c91d..000000000 --- a/module/plugins/hooks/AlldebridCom.py +++ /dev/null @@ -1,27 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.internal.MultiHook import MultiHook - - -class AlldebridCom(MultiHook): - __name__ = "AlldebridCom" - __type__ = "hook" - __version__ = "0.16" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), - ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 ), - ("ssl" , "bool" , "Use HTTPS" , True )] - - __description__ = """Alldebrid.com hook plugin""" - __license__ = "GPLv3" - __authors__ = [("Andy Voigt", "spamsales@online.de")] - - - def getHosters(self): - https = "https" if self.getConfig('ssl') else "http" - html = self.getURL(https + "://www.alldebrid.com/api.php", get={'action': "get_host"}).replace("\"", "").strip() - - return [x.strip() for x in html.split(",") if x.strip()] diff --git a/module/plugins/hooks/AlldebridComHook.py b/module/plugins/hooks/AlldebridComHook.py new file mode 100644 index 000000000..092921134 --- /dev/null +++ b/module/plugins/hooks/AlldebridComHook.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.MultiHook import MultiHook + + +class AlldebridComHook(MultiHook): + __name__ = "AlldebridComHook" + __type__ = "hook" + __version__ = "0.16" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 ), + ("ssl" , "bool" , "Use HTTPS" , True )] + + __description__ = """Alldebrid.com hook plugin""" + __license__ = "GPLv3" + __authors__ = [("Andy Voigt", "spamsales@online.de")] + + + def getHosters(self): + https = "https" if self.getConfig('ssl') else "http" + html = self.getURL(https + "://www.alldebrid.com/api.php", get={'action': "get_host"}).replace("\"", "").strip() + + return [x.strip() for x in html.split(",") if x.strip()] diff --git a/module/plugins/hooks/DebridItaliaCom.py b/module/plugins/hooks/DebridItaliaCom.py deleted file mode 100644 index a970ae195..000000000 --- a/module/plugins/hooks/DebridItaliaCom.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from module.plugins.internal.MultiHook import MultiHook - - -class DebridItaliaCom(MultiHook): - __name__ = "DebridItaliaCom" - __type__ = "hook" - __version__ = "0.12" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), - ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """Debriditalia.com hook plugin""" - __license__ = "GPLv3" - __authors__ = [("stickell" , "l.stickell@yahoo.it"), - ("Walter Purcaro", "vuolter@gmail.com" )] - - - def getHosters(self): - return self.getURL("http://debriditalia.com/api.php", get={'hosts': ""}).replace('"', '').split(',') diff --git a/module/plugins/hooks/DebridItaliaComHook.py b/module/plugins/hooks/DebridItaliaComHook.py new file mode 100644 index 000000000..36b307696 --- /dev/null +++ b/module/plugins/hooks/DebridItaliaComHook.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- + +import re + +from module.plugins.internal.MultiHook import MultiHook + + +class DebridItaliaComHook(MultiHook): + __name__ = "DebridItaliaComHook" + __type__ = "hook" + __version__ = "0.12" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] + + __description__ = """Debriditalia.com hook plugin""" + __license__ = "GPLv3" + __authors__ = [("stickell" , "l.stickell@yahoo.it"), + ("Walter Purcaro", "vuolter@gmail.com" )] + + + def getHosters(self): + return self.getURL("http://debriditalia.com/api.php", get={'hosts': ""}).replace('"', '').split(',') diff --git a/module/plugins/hooks/EasybytezCom.py b/module/plugins/hooks/EasybytezCom.py deleted file mode 100644 index 04da21ee2..000000000 --- a/module/plugins/hooks/EasybytezCom.py +++ /dev/null @@ -1,30 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from module.plugins.internal.MultiHook import MultiHook - - -class EasybytezCom(MultiHook): - __name__ = "EasybytezCom" - __type__ = "hook" - __version__ = "0.07" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), - ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """EasyBytez.com hook plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - - def getHosters(self): - user, data = self.account.selectAccount() - - req = self.account.getAccountRequest(user) - html = req.load("http://www.easybytez.com") - - return re.search(r'</textarea>\s*Supported sites:(.*)', html).group(1).split(',') diff --git a/module/plugins/hooks/EasybytezComHook.py b/module/plugins/hooks/EasybytezComHook.py new file mode 100644 index 000000000..43efb5048 --- /dev/null +++ b/module/plugins/hooks/EasybytezComHook.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- + +import re + +from module.plugins.internal.MultiHook import MultiHook + + +class EasybytezComHook(MultiHook): + __name__ = "EasybytezComHook" + __type__ = "hook" + __version__ = "0.07" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] + + __description__ = """EasyBytez.com hook plugin""" + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + + + def getHosters(self): + user, data = self.account.selectAccount() + + req = self.account.getAccountRequest(user) + html = req.load("http://www.easybytez.com") + + return re.search(r'</textarea>\s*Supported sites:(.*)', html).group(1).split(',') diff --git a/module/plugins/hooks/FastixRu.py b/module/plugins/hooks/FastixRu.py deleted file mode 100644 index 9e74587ac..000000000 --- a/module/plugins/hooks/FastixRu.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.common.json_layer import json_loads -from module.plugins.internal.MultiHook import MultiHook - - -class FastixRu(MultiHook): - __name__ = "FastixRu" - __type__ = "hook" - __version__ = "0.05" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), - ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """Fastix.ru hook plugin""" - __license__ = "GPLv3" - __authors__ = [("Massimo Rosamilia", "max@spiritix.eu")] - - - def getHosters(self): - html = self.getURL("http://fastix.ru/api_v2", - get={'apikey': "5182964c3f8f9a7f0b00000a_kelmFB4n1IrnCDYuIFn2y", - 'sub' : "allowed_sources"}) - host_list = json_loads(html) - host_list = host_list['allow'] - return host_list diff --git a/module/plugins/hooks/FastixRuHook.py b/module/plugins/hooks/FastixRuHook.py new file mode 100644 index 000000000..16e30e93a --- /dev/null +++ b/module/plugins/hooks/FastixRuHook.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- + +from module.common.json_layer import json_loads +from module.plugins.internal.MultiHook import MultiHook + + +class FastixRuHook(MultiHook): + __name__ = "FastixRuHook" + __type__ = "hook" + __version__ = "0.05" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] + + __description__ = """Fastix.ru hook plugin""" + __license__ = "GPLv3" + __authors__ = [("Massimo Rosamilia", "max@spiritix.eu")] + + + def getHosters(self): + html = self.getURL("http://fastix.ru/api_v2", + get={'apikey': "5182964c3f8f9a7f0b00000a_kelmFB4n1IrnCDYuIFn2y", + 'sub' : "allowed_sources"}) + host_list = json_loads(html) + host_list = host_list['allow'] + return host_list diff --git a/module/plugins/hooks/FreeWayMe.py b/module/plugins/hooks/FreeWayMe.py deleted file mode 100644 index 31ef8201f..000000000 --- a/module/plugins/hooks/FreeWayMe.py +++ /dev/null @@ -1,32 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.internal.MultiHook import MultiHook - - -class FreeWayMe(MultiHook): - __name__ = "FreeWayMe" - __type__ = "hook" - __version__ = "0.15" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), - ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """FreeWay.me hook plugin""" - __license__ = "GPLv3" - __authors__ = [("Nicolas Giese", "james@free-way.me")] - - - def getHosters(self): - # Get account data - if not self.account or not self.account.canUse(): - hostis = self.getURL("https://www.free-way.me/ajax/jd.php", get={"id": 3}).replace("\"", "").strip() - else: - self.logDebug("AccountInfo available - Get HosterList with User Pass") - (user, data) = self.account.selectAccount() - hostis = self.getURL("https://www.free-way.me/ajax/jd.php", get={"id": 3, "user": user, "pass": data['password']}).replace("\"", "").strip() - - self.logDebug("hosters: %s" % hostis) - return [x.strip() for x in hostis.split(",") if x.strip()] diff --git a/module/plugins/hooks/FreeWayMeHook.py b/module/plugins/hooks/FreeWayMeHook.py new file mode 100644 index 000000000..baea44540 --- /dev/null +++ b/module/plugins/hooks/FreeWayMeHook.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.MultiHook import MultiHook + + +class FreeWayMeHook(MultiHook): + __name__ = "FreeWayMeHook" + __type__ = "hook" + __version__ = "0.15" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] + + __description__ = """FreeWay.me hook plugin""" + __license__ = "GPLv3" + __authors__ = [("Nicolas Giese", "james@free-way.me")] + + + def getHosters(self): + # Get account data + if not self.account or not self.account.canUse(): + hostis = self.getURL("https://www.free-way.me/ajax/jd.php", get={"id": 3}).replace("\"", "").strip() + else: + self.logDebug("AccountInfo available - Get HosterList with User Pass") + (user, data) = self.account.selectAccount() + hostis = self.getURL("https://www.free-way.me/ajax/jd.php", get={"id": 3, "user": user, "pass": data['password']}).replace("\"", "").strip() + + self.logDebug("hosters: %s" % hostis) + return [x.strip() for x in hostis.split(",") if x.strip()] diff --git a/module/plugins/hooks/LinkdecrypterCom.py b/module/plugins/hooks/LinkdecrypterCom.py deleted file mode 100644 index 769e63e81..000000000 --- a/module/plugins/hooks/LinkdecrypterCom.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from module.plugins.internal.MultiHook import MultiHook - - -class LinkdecrypterCom(MultiHook): - __name__ = "LinkdecrypterCom" - __type__ = "hook" - __version__ = "1.03" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """Linkdecrypter.com hook plugin""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - - def getCrypters(self): - return re.search(r'>Supported\(\d+\)</b>: <i>(.[\w.\-, ]+)', - self.getURL("http://linkdecrypter.com/", decode=True).replace("(g)", "")).group(1).split(', ') diff --git a/module/plugins/hooks/LinkdecrypterComHook.py b/module/plugins/hooks/LinkdecrypterComHook.py new file mode 100644 index 000000000..596a397a4 --- /dev/null +++ b/module/plugins/hooks/LinkdecrypterComHook.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- + +import re + +from module.plugins.internal.MultiHook import MultiHook + + +class LinkdecrypterComHook(MultiHook): + __name__ = "LinkdecrypterComHook" + __type__ = "hook" + __version__ = "1.04" + + __config__ = [("activated" , "bool" , "Activated" , True ), + ("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)", "" ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] + + __description__ = """Linkdecrypter.com hook plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + def getCrypters(self): + return re.search(r'>Supported\(\d+\)</b>: <i>(.[\w.\-, ]+)', + self.getURL("http://linkdecrypter.com/", decode=True).replace("(g)", "")).group(1).split(', ') diff --git a/module/plugins/hooks/LinksnappyCom.py b/module/plugins/hooks/LinksnappyCom.py deleted file mode 100644 index a5b77b93f..000000000 --- a/module/plugins/hooks/LinksnappyCom.py +++ /dev/null @@ -1,27 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.common.json_layer import json_loads -from module.plugins.internal.MultiHook import MultiHook - - -class LinksnappyCom(MultiHook): - __name__ = "LinksnappyCom" - __type__ = "hook" - __version__ = "0.04" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), - ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """Linksnappy.com hook plugin""" - __license__ = "GPLv3" - __authors__ = [("stickell", "l.stickell@yahoo.it")] - - - def getHosters(self): - json_data = self.getURL("http://gen.linksnappy.com/lseAPI.php", get={'act': "FILEHOSTS"}) - json_data = json_loads(json_data) - - return json_data['return'].keys() diff --git a/module/plugins/hooks/LinksnappyComHook.py b/module/plugins/hooks/LinksnappyComHook.py new file mode 100644 index 000000000..72282575b --- /dev/null +++ b/module/plugins/hooks/LinksnappyComHook.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- + +from module.common.json_layer import json_loads +from module.plugins.internal.MultiHook import MultiHook + + +class LinksnappyComHook(MultiHook): + __name__ = "LinksnappyComHook" + __type__ = "hook" + __version__ = "0.04" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] + + __description__ = """Linksnappy.com hook plugin""" + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] + + + def getHosters(self): + json_data = self.getURL("http://gen.linksnappy.com/lseAPI.php", get={'act': "FILEHOSTS"}) + json_data = json_loads(json_data) + + return json_data['return'].keys() diff --git a/module/plugins/hooks/MegaDebridEu.py b/module/plugins/hooks/MegaDebridEu.py deleted file mode 100644 index b32656019..000000000 --- a/module/plugins/hooks/MegaDebridEu.py +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.common.json_layer import json_loads -from module.plugins.internal.MultiHook import MultiHook - - -class MegaDebridEu(MultiHook): - __name__ = "MegaDebridEu" - __type__ = "hook" - __version__ = "0.05" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), - ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """Mega-debrid.eu hook plugin""" - __license__ = "GPLv3" - __authors__ = [("D.Ducatel", "dducatel@je-geek.fr")] - - - def getHosters(self): - reponse = self.getURL("http://www.mega-debrid.eu/api.php", get={'action': "getHosters"}) - json_data = json_loads(reponse) - - if json_data['response_code'] == "ok": - host_list = [element[0] for element in json_data['hosters']] - else: - self.logError(_("Unable to retrieve hoster list")) - host_list = list() - - return host_list diff --git a/module/plugins/hooks/MegaDebridEuHook.py b/module/plugins/hooks/MegaDebridEuHook.py new file mode 100644 index 000000000..0de7b4dcf --- /dev/null +++ b/module/plugins/hooks/MegaDebridEuHook.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- + +from module.common.json_layer import json_loads +from module.plugins.internal.MultiHook import MultiHook + + +class MegaDebridEuHook(MultiHook): + __name__ = "MegaDebridEuHook" + __type__ = "hook" + __version__ = "0.05" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] + + __description__ = """Mega-debrid.eu hook plugin""" + __license__ = "GPLv3" + __authors__ = [("D.Ducatel", "dducatel@je-geek.fr")] + + + def getHosters(self): + reponse = self.getURL("http://www.mega-debrid.eu/api.php", get={'action': "getHosters"}) + json_data = json_loads(reponse) + + if json_data['response_code'] == "ok": + host_list = [element[0] for element in json_data['hosters']] + else: + self.logError(_("Unable to retrieve hoster list")) + host_list = list() + + return host_list diff --git a/module/plugins/hooks/MegaRapidoNet.py b/module/plugins/hooks/MegaRapidoNet.py deleted file mode 100644 index fb5e77994..000000000 --- a/module/plugins/hooks/MegaRapidoNet.py +++ /dev/null @@ -1,81 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from module.plugins.internal.MultiHook import MultiHook - - -class MegaRapidoNet(MultiHook): - __name__ = "MegaRapidoNet" - __type__ = "hook" - __version__ = "0.02" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)", "" ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """MegaRapido.net hook plugin""" - __license__ = "GPLv3" - __authors__ = [("Kagenoshin", "kagenoshin@gmx.ch")] - - - def getHosters(self): - hosters = {'1fichier' : [],#leave it there are so many possible addresses? - '1st-files' : ['1st-files.com'], - '2shared' : ['2shared.com'], - '4shared' : ['4shared.com', '4shared-china.com'], - 'asfile' : ['http://asfile.com/'], - 'bitshare' : ['bitshare.com'], - 'brupload' : ['brupload.net'], - 'crocko' : ['crocko.com','easy-share.com'], - 'dailymotion' : ['dailymotion.com'], - 'depfile' : ['depfile.com'], - 'depositfiles': ['depositfiles.com', 'dfiles.eu'], - 'dizzcloud' : ['dizzcloud.com'], - 'dl.dropbox' : [], - 'extabit' : ['extabit.com'], - 'extmatrix' : ['extmatrix.com'], - 'facebook' : [], - 'file4go' : ['file4go.com'], - 'filecloud' : ['filecloud.io','ifile.it','mihd.net'], - 'filefactory' : ['filefactory.com'], - 'fileom' : ['fileom.com'], - 'fileparadox' : ['fileparadox.in'], - 'filepost' : ['filepost.com', 'fp.io'], - 'filerio' : ['filerio.in','filerio.com','filekeen.com'], - 'filesflash' : ['filesflash.com'], - 'firedrive' : ['firedrive.com', 'putlocker.com'], - 'flashx' : [], - 'freakshare' : ['freakshare.net', 'freakshare.com'], - 'gigasize' : ['gigasize.com'], - 'hipfile' : ['hipfile.com'], - 'junocloud' : ['junocloud.me'], - 'letitbit' : ['letitbit.net','shareflare.net'], - 'mediafire' : ['mediafire.com'], - 'mega' : ['mega.co.nz'], - 'megashares' : ['megashares.com'], - 'metacafe' : ['metacafe.com'], - 'netload' : ['netload.in'], - 'oboom' : ['oboom.com'], - 'rapidgator' : ['rapidgator.net'], - 'rapidshare' : ['rapidshare.com'], - 'rarefile' : ['rarefile.net'], - 'ryushare' : ['ryushare.com'], - 'sendspace' : ['sendspace.com'], - 'turbobit' : ['turbobit.net', 'unextfiles.com'], - 'uploadable' : ['uploadable.ch'], - 'uploadbaz' : ['uploadbaz.com'], - 'uploaded' : ['uploaded.to', 'uploaded.net', 'ul.to'], - 'uploadhero' : ['uploadhero.com'], - 'uploading' : ['uploading.com'], - 'uptobox' : ['uptobox.com'], - 'xvideos' : ['xvideos.com'], - 'youtube' : ['youtube.com']} - - hoster_list = [] - - for item in hosters.itervalues(): - hoster_list.extend(item) - - return hoster_list diff --git a/module/plugins/hooks/MegaRapidoNetHook.py b/module/plugins/hooks/MegaRapidoNetHook.py new file mode 100644 index 000000000..e113b305e --- /dev/null +++ b/module/plugins/hooks/MegaRapidoNetHook.py @@ -0,0 +1,81 @@ +# -*- coding: utf-8 -*- + +import re + +from module.plugins.internal.MultiHook import MultiHook + + +class MegaRapidoNetHook(MultiHook): + __name__ = "MegaRapidoNetHook" + __type__ = "hook" + __version__ = "0.02" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)", "" ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] + + __description__ = """MegaRapido.net hook plugin""" + __license__ = "GPLv3" + __authors__ = [("Kagenoshin", "kagenoshin@gmx.ch")] + + + def getHosters(self): + hosters = {'1fichier' : [],#leave it there are so many possible addresses? + '1st-files' : ['1st-files.com'], + '2shared' : ['2shared.com'], + '4shared' : ['4shared.com', '4shared-china.com'], + 'asfile' : ['http://asfile.com/'], + 'bitshare' : ['bitshare.com'], + 'brupload' : ['brupload.net'], + 'crocko' : ['crocko.com','easy-share.com'], + 'dailymotion' : ['dailymotion.com'], + 'depfile' : ['depfile.com'], + 'depositfiles': ['depositfiles.com', 'dfiles.eu'], + 'dizzcloud' : ['dizzcloud.com'], + 'dl.dropbox' : [], + 'extabit' : ['extabit.com'], + 'extmatrix' : ['extmatrix.com'], + 'facebook' : [], + 'file4go' : ['file4go.com'], + 'filecloud' : ['filecloud.io','ifile.it','mihd.net'], + 'filefactory' : ['filefactory.com'], + 'fileom' : ['fileom.com'], + 'fileparadox' : ['fileparadox.in'], + 'filepost' : ['filepost.com', 'fp.io'], + 'filerio' : ['filerio.in','filerio.com','filekeen.com'], + 'filesflash' : ['filesflash.com'], + 'firedrive' : ['firedrive.com', 'putlocker.com'], + 'flashx' : [], + 'freakshare' : ['freakshare.net', 'freakshare.com'], + 'gigasize' : ['gigasize.com'], + 'hipfile' : ['hipfile.com'], + 'junocloud' : ['junocloud.me'], + 'letitbit' : ['letitbit.net','shareflare.net'], + 'mediafire' : ['mediafire.com'], + 'mega' : ['mega.co.nz'], + 'megashares' : ['megashares.com'], + 'metacafe' : ['metacafe.com'], + 'netload' : ['netload.in'], + 'oboom' : ['oboom.com'], + 'rapidgator' : ['rapidgator.net'], + 'rapidshare' : ['rapidshare.com'], + 'rarefile' : ['rarefile.net'], + 'ryushare' : ['ryushare.com'], + 'sendspace' : ['sendspace.com'], + 'turbobit' : ['turbobit.net', 'unextfiles.com'], + 'uploadable' : ['uploadable.ch'], + 'uploadbaz' : ['uploadbaz.com'], + 'uploaded' : ['uploaded.to', 'uploaded.net', 'ul.to'], + 'uploadhero' : ['uploadhero.com'], + 'uploading' : ['uploading.com'], + 'uptobox' : ['uptobox.com'], + 'xvideos' : ['xvideos.com'], + 'youtube' : ['youtube.com']} + + hoster_list = [] + + for item in hosters.itervalues(): + hoster_list.extend(item) + + return hoster_list diff --git a/module/plugins/hooks/MultihostersCom.py b/module/plugins/hooks/MultihostersCom.py deleted file mode 100644 index bf88cfae7..000000000 --- a/module/plugins/hooks/MultihostersCom.py +++ /dev/null @@ -1,18 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.hooks.ZeveraCom import ZeveraCom - - -class MultihostersCom(ZeveraCom): - __name__ = "MultihostersCom" - __type__ = "hook" - __version__ = "0.02" - - __config__ = [("mode" , "all;listed;unlisted", "Use for plugins (if supported)" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), - ("revertfailed", "bool" , "Revert to standard download if download fails", False), - ("interval" , "int" , "Reload interval in hours (0 to disable)" , 12 )] - - __description__ = """Multihosters.com hook plugin""" - __license__ = "GPLv3" - __authors__ = [("tjeh", "tjeh@gmx.net")] diff --git a/module/plugins/hooks/MultihostersComHook.py b/module/plugins/hooks/MultihostersComHook.py new file mode 100644 index 000000000..7b5e49c49 --- /dev/null +++ b/module/plugins/hooks/MultihostersComHook.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +from module.plugins.hooks.ZeveraComHook import ZeveraComHook + + +class MultihostersComHook(ZeveraComHook): + __name__ = "MultihostersComHook" + __type__ = "hook" + __version__ = "0.02" + + __config__ = [("mode" , "all;listed;unlisted", "Use for plugins (if supported)" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed", "bool" , "Revert to standard download if download fails", False), + ("interval" , "int" , "Reload interval in hours (0 to disable)" , 12 )] + + __description__ = """Multihosters.com hook plugin""" + __license__ = "GPLv3" + __authors__ = [("tjeh", "tjeh@gmx.net")] diff --git a/module/plugins/hooks/MultishareCz.py b/module/plugins/hooks/MultishareCz.py deleted file mode 100644 index 6ead88c34..000000000 --- a/module/plugins/hooks/MultishareCz.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from module.plugins.internal.MultiHook import MultiHook - - -class MultishareCz(MultiHook): - __name__ = "MultishareCz" - __type__ = "hook" - __version__ = "0.07" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), - ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """MultiShare.cz hook plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - - HOSTER_PATTERN = r'<img class="logo-shareserveru"[^>]*?alt="(.+?)"></td>\s*<td class="stav">[^>]*?alt="OK"' - - - def getHosters(self): - html = self.getURL("http://www.multishare.cz/monitoring/") - return re.findall(self.HOSTER_PATTERN, html) diff --git a/module/plugins/hooks/MultishareCzHook.py b/module/plugins/hooks/MultishareCzHook.py new file mode 100644 index 000000000..6052b7673 --- /dev/null +++ b/module/plugins/hooks/MultishareCzHook.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- + +import re + +from module.plugins.internal.MultiHook import MultiHook + + +class MultishareCzHook(MultiHook): + __name__ = "MultishareCzHook" + __type__ = "hook" + __version__ = "0.07" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] + + __description__ = """MultiShare.cz hook plugin""" + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + + + HOSTER_PATTERN = r'<img class="logo-shareserveru"[^>]*?alt="(.+?)"></td>\s*<td class="stav">[^>]*?alt="OK"' + + + def getHosters(self): + html = self.getURL("http://www.multishare.cz/monitoring/") + return re.findall(self.HOSTER_PATTERN, html) diff --git a/module/plugins/hooks/MyfastfileCom.py b/module/plugins/hooks/MyfastfileCom.py deleted file mode 100644 index 1e7a6421d..000000000 --- a/module/plugins/hooks/MyfastfileCom.py +++ /dev/null @@ -1,28 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.common.json_layer import json_loads -from module.plugins.internal.MultiHook import MultiHook - - -class MyfastfileCom(MultiHook): - __name__ = "MyfastfileCom" - __type__ = "hook" - __version__ = "0.05" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), - ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """Myfastfile.com hook plugin""" - __license__ = "GPLv3" - __authors__ = [("stickell", "l.stickell@yahoo.it")] - - - def getHosters(self): - json_data = self.getURL("http://myfastfile.com/api.php", get={'hosts': ""}, decode=True) - self.logDebug("JSON data", json_data) - json_data = json_loads(json_data) - - return json_data['hosts'] diff --git a/module/plugins/hooks/MyfastfileComHook.py b/module/plugins/hooks/MyfastfileComHook.py new file mode 100644 index 000000000..20a1cfac2 --- /dev/null +++ b/module/plugins/hooks/MyfastfileComHook.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- + +from module.common.json_layer import json_loads +from module.plugins.internal.MultiHook import MultiHook + + +class MyfastfileComHook(MultiHook): + __name__ = "MyfastfileComHook" + __type__ = "hook" + __version__ = "0.05" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] + + __description__ = """Myfastfile.com hook plugin""" + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] + + + def getHosters(self): + json_data = self.getURL("http://myfastfile.com/api.php", get={'hosts': ""}, decode=True) + self.logDebug("JSON data", json_data) + json_data = json_loads(json_data) + + return json_data['hosts'] diff --git a/module/plugins/hooks/NoPremiumPl.py b/module/plugins/hooks/NoPremiumPl.py deleted file mode 100644 index 77ee83cb1..000000000 --- a/module/plugins/hooks/NoPremiumPl.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.common.json_layer import json_loads -from module.plugins.internal.MultiHook import MultiHook - - -class NoPremiumPl(MultiHook): - __name__ = "NoPremiumPl" - __type__ = "hook" - __version__ = "0.03" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), - ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """NoPremium.pl hook plugin""" - __license__ = "GPLv3" - __authors__ = [("goddie", "dev@nopremium.pl")] - - - def getHosters(self): - hostings = json_loads(self.getURL("https://www.nopremium.pl/clipboard.php?json=3").strip()) - hostings_domains = [domain for row in hostings for domain in row["domains"] if row["sdownload"] == "0"] - - self.logDebug(hostings_domains) - - return hostings_domains diff --git a/module/plugins/hooks/NoPremiumPlHook.py b/module/plugins/hooks/NoPremiumPlHook.py new file mode 100644 index 000000000..b5a007ff9 --- /dev/null +++ b/module/plugins/hooks/NoPremiumPlHook.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- + +from module.common.json_layer import json_loads +from module.plugins.internal.MultiHook import MultiHook + + +class NoPremiumPlHook(MultiHook): + __name__ = "NoPremiumPlHook" + __type__ = "hook" + __version__ = "0.03" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] + + __description__ = """NoPremium.pl hook plugin""" + __license__ = "GPLv3" + __authors__ = [("goddie", "dev@nopremium.pl")] + + + def getHosters(self): + hostings = json_loads(self.getURL("https://www.nopremium.pl/clipboard.php?json=3").strip()) + hostings_domains = [domain for row in hostings for domain in row["domains"] if row["sdownload"] == "0"] + + self.logDebug(hostings_domains) + + return hostings_domains diff --git a/module/plugins/hooks/OverLoadMe.py b/module/plugins/hooks/OverLoadMe.py deleted file mode 100644 index 7b9a1f414..000000000 --- a/module/plugins/hooks/OverLoadMe.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.internal.MultiHook import MultiHook - - -class OverLoadMe(MultiHook): - __name__ = "OverLoadMe" - __type__ = "hook" - __version__ = "0.04" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), - ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 ), - ("ssl" , "bool" , "Use HTTPS" , True )] - - __description__ = """Over-Load.me hook plugin""" - __license__ = "GPLv3" - __authors__ = [("marley", "marley@over-load.me")] - - - def getHosters(self): - https = "https" if self.getConfig('ssl') else "http" - html = self.getURL(https + "://api.over-load.me/hoster.php", - get={'auth': "0001-cb1f24dadb3aa487bda5afd3b76298935329be7700cd7-5329be77-00cf-1ca0135f"}).replace("\"", "").strip() - self.logDebug("Hosterlist", html) - - return [x.strip() for x in html.split(",") if x.strip()] diff --git a/module/plugins/hooks/OverLoadMeHook.py b/module/plugins/hooks/OverLoadMeHook.py new file mode 100644 index 000000000..d608a2ecd --- /dev/null +++ b/module/plugins/hooks/OverLoadMeHook.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.MultiHook import MultiHook + + +class OverLoadMeHook(MultiHook): + __name__ = "OverLoadMeHook" + __type__ = "hook" + __version__ = "0.04" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 ), + ("ssl" , "bool" , "Use HTTPS" , True )] + + __description__ = """Over-Load.me hook plugin""" + __license__ = "GPLv3" + __authors__ = [("marley", "marley@over-load.me")] + + + def getHosters(self): + https = "https" if self.getConfig('ssl') else "http" + html = self.getURL(https + "://api.over-load.me/hoster.php", + get={'auth': "0001-cb1f24dadb3aa487bda5afd3b76298935329be7700cd7-5329be77-00cf-1ca0135f"}).replace("\"", "").strip() + self.logDebug("Hosterlist", html) + + return [x.strip() for x in html.split(",") if x.strip()] diff --git a/module/plugins/hooks/PremiumTo.py b/module/plugins/hooks/PremiumTo.py deleted file mode 100644 index f5636cb72..000000000 --- a/module/plugins/hooks/PremiumTo.py +++ /dev/null @@ -1,27 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.internal.MultiHook import MultiHook - - -class PremiumTo(MultiHook): - __name__ = "PremiumTo" - __type__ = "hook" - __version__ = "0.08" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), - ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """Premium.to hook plugin""" - __license__ = "GPLv3" - __authors__ = [("RaNaN" , "RaNaN@pyload.org" ), - ("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it")] - - - def getHosters(self): - html = self.getURL("http://premium.to/api/hosters.php", - get={'username': self.account.username, 'password': self.account.password}) - return [x.strip() for x in html.replace("\"", "").split(";")] diff --git a/module/plugins/hooks/PremiumToHook.py b/module/plugins/hooks/PremiumToHook.py new file mode 100644 index 000000000..ef2a84223 --- /dev/null +++ b/module/plugins/hooks/PremiumToHook.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.MultiHook import MultiHook + + +class PremiumToHook(MultiHook): + __name__ = "PremiumToHook" + __type__ = "hook" + __version__ = "0.08" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] + + __description__ = """Premium.to hook plugin""" + __license__ = "GPLv3" + __authors__ = [("RaNaN" , "RaNaN@pyload.org" ), + ("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it")] + + + def getHosters(self): + html = self.getURL("http://premium.to/api/hosters.php", + get={'username': self.account.username, 'password': self.account.password}) + return [x.strip() for x in html.replace("\"", "").split(";")] diff --git a/module/plugins/hooks/PremiumizeMe.py b/module/plugins/hooks/PremiumizeMe.py deleted file mode 100644 index 266c62549..000000000 --- a/module/plugins/hooks/PremiumizeMe.py +++ /dev/null @@ -1,38 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.common.json_layer import json_loads -from module.plugins.internal.MultiHook import MultiHook - - -class PremiumizeMe(MultiHook): - __name__ = "PremiumizeMe" - __type__ = "hook" - __version__ = "0.17" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), - ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """Premiumize.me hook plugin""" - __license__ = "GPLv3" - __authors__ = [("Florian Franzen", "FlorianFranzen@gmail.com")] - - - def getHosters(self): - # Get account data - user, data = self.account.selectAccount() - - # Get supported hosters list from premiumize.me using the - # json API v1 (see https://secure.premiumize.me/?show=api) - answer = self.getURL("https://api.premiumize.me/pm-api/v1.php", - get={'method': "hosterlist", 'params[login]': user, 'params[pass]': data['password']}) - data = json_loads(answer) - - # If account is not valid thera are no hosters available - if data['status'] != 200: - return [] - - # Extract hosters from json file - return data['result']['hosterlist'] diff --git a/module/plugins/hooks/PremiumizeMeHook.py b/module/plugins/hooks/PremiumizeMeHook.py new file mode 100644 index 000000000..e081fb389 --- /dev/null +++ b/module/plugins/hooks/PremiumizeMeHook.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- + +from module.common.json_layer import json_loads +from module.plugins.internal.MultiHook import MultiHook + + +class PremiumizeMeHook(MultiHook): + __name__ = "PremiumizeMeHook" + __type__ = "hook" + __version__ = "0.17" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] + + __description__ = """Premiumize.me hook plugin""" + __license__ = "GPLv3" + __authors__ = [("Florian Franzen", "FlorianFranzen@gmail.com")] + + + def getHosters(self): + # Get account data + user, data = self.account.selectAccount() + + # Get supported hosters list from premiumize.me using the + # json API v1 (see https://secure.premiumize.me/?show=api) + answer = self.getURL("https://api.premiumize.me/pm-api/v1.php", + get={'method': "hosterlist", 'params[login]': user, 'params[pass]': data['password']}) + data = json_loads(answer) + + # If account is not valid thera are no hosters available + if data['status'] != 200: + return [] + + # Extract hosters from json file + return data['result']['hosterlist'] diff --git a/module/plugins/hooks/PutdriveCom.py b/module/plugins/hooks/PutdriveCom.py deleted file mode 100644 index f665dabee..000000000 --- a/module/plugins/hooks/PutdriveCom.py +++ /dev/null @@ -1,18 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.hooks.ZeveraCom import ZeveraCom - - -class PutdriveCom(ZeveraCom): - __name__ = "PutdriveCom" - __type__ = "hook" - __version__ = "0.01" - - __config__ = [("mode" , "all;listed;unlisted", "Use for plugins (if supported)" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), - ("revertfailed", "bool" , "Revert to standard download if download fails", False), - ("interval" , "int" , "Reload interval in hours (0 to disable)" , 12 )] - - __description__ = """Putdrive.com hook plugin""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] diff --git a/module/plugins/hooks/PutdriveComHook.py b/module/plugins/hooks/PutdriveComHook.py new file mode 100644 index 000000000..c3ebf4ff3 --- /dev/null +++ b/module/plugins/hooks/PutdriveComHook.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +from module.plugins.hooks.ZeveraComHook import ZeveraComHook + + +class PutdriveComHook(ZeveraComHook): + __name__ = "PutdriveComHook" + __type__ = "hook" + __version__ = "0.01" + + __config__ = [("mode" , "all;listed;unlisted", "Use for plugins (if supported)" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed", "bool" , "Revert to standard download if download fails", False), + ("interval" , "int" , "Reload interval in hours (0 to disable)" , 12 )] + + __description__ = """Putdrive.com hook plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] diff --git a/module/plugins/hooks/RPNetBiz.py b/module/plugins/hooks/RPNetBiz.py deleted file mode 100644 index a24697265..000000000 --- a/module/plugins/hooks/RPNetBiz.py +++ /dev/null @@ -1,36 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.common.json_layer import json_loads -from module.plugins.internal.MultiHook import MultiHook - - -class RPNetBiz(MultiHook): - __name__ = "RPNetBiz" - __type__ = "hook" - __version__ = "0.14" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), - ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """RPNet.biz hook plugin""" - __license__ = "GPLv3" - __authors__ = [("Dman", "dmanugm@gmail.com")] - - - def getHosters(self): - # Get account data - user, data = self.account.selectAccount() - - res = self.getURL("https://premium.rpnet.biz/client_api.php", - get={'username': user, 'password': data['password'], 'action': "showHosterList"}) - hoster_list = json_loads(res) - - # If account is not valid thera are no hosters available - if 'error' in hoster_list: - return [] - - # Extract hosters from json file - return hoster_list['hosters'] diff --git a/module/plugins/hooks/RPNetBizHook.py b/module/plugins/hooks/RPNetBizHook.py new file mode 100644 index 000000000..10332948d --- /dev/null +++ b/module/plugins/hooks/RPNetBizHook.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +from module.common.json_layer import json_loads +from module.plugins.internal.MultiHook import MultiHook + + +class RPNetBizHook(MultiHook): + __name__ = "RPNetBizHook" + __type__ = "hook" + __version__ = "0.14" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] + + __description__ = """RPNet.biz hook plugin""" + __license__ = "GPLv3" + __authors__ = [("Dman", "dmanugm@gmail.com")] + + + def getHosters(self): + # Get account data + user, data = self.account.selectAccount() + + res = self.getURL("https://premium.rpnet.biz/client_api.php", + get={'username': user, 'password': data['password'], 'action': "showHosterList"}) + hoster_list = json_loads(res) + + # If account is not valid thera are no hosters available + if 'error' in hoster_list: + return [] + + # Extract hosters from json file + return hoster_list['hosters'] diff --git a/module/plugins/hooks/RapideoPl.py b/module/plugins/hooks/RapideoPl.py deleted file mode 100644 index 70d499de5..000000000 --- a/module/plugins/hooks/RapideoPl.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.common.json_layer import json_loads -from module.plugins.internal.MultiHook import MultiHook - - -class RapideoPl(MultiHook): - __name__ = "RapideoPl" - __type__ = "hook" - __version__ = "0.03" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), - ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """Rapideo.pl hook plugin""" - __license__ = "GPLv3" - __authors__ = [("goddie", "dev@rapideo.pl")] - - - def getHosters(self): - hostings = json_loads(self.getURL("https://www.rapideo.pl/clipboard.php?json=3").strip()) - hostings_domains = [domain for row in hostings for domain in row["domains"] if row["sdownload"] == "0"] - - self.logDebug(hostings_domains) - - return hostings_domains diff --git a/module/plugins/hooks/RapideoPlHook.py b/module/plugins/hooks/RapideoPlHook.py new file mode 100644 index 000000000..0400f07ba --- /dev/null +++ b/module/plugins/hooks/RapideoPlHook.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- + +from module.common.json_layer import json_loads +from module.plugins.internal.MultiHook import MultiHook + + +class RapideoPlHook(MultiHook): + __name__ = "RapideoPlHook" + __type__ = "hook" + __version__ = "0.03" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] + + __description__ = """Rapideo.pl hook plugin""" + __license__ = "GPLv3" + __authors__ = [("goddie", "dev@rapideo.pl")] + + + def getHosters(self): + hostings = json_loads(self.getURL("https://www.rapideo.pl/clipboard.php?json=3").strip()) + hostings_domains = [domain for row in hostings for domain in row["domains"] if row["sdownload"] == "0"] + + self.logDebug(hostings_domains) + + return hostings_domains diff --git a/module/plugins/hooks/RealdebridCom.py b/module/plugins/hooks/RealdebridCom.py deleted file mode 100644 index 4260940d0..000000000 --- a/module/plugins/hooks/RealdebridCom.py +++ /dev/null @@ -1,27 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.internal.MultiHook import MultiHook - - -class RealdebridCom(MultiHook): - __name__ = "RealdebridCom" - __type__ = "hook" - __version__ = "0.46" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), - ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 ), - ("ssl" , "bool" , "Use HTTPS" , True )] - - __description__ = """Real-Debrid.com hook plugin""" - __license__ = "GPLv3" - __authors__ = [("Devirex Hazzard", "naibaf_11@yahoo.de")] - - - def getHosters(self): - https = "https" if self.getConfig('ssl') else "http" - html = self.getURL(https + "://real-debrid.com/api/hosters.php").replace("\"", "").strip() - - return [x.strip() for x in html.split(",") if x.strip()] diff --git a/module/plugins/hooks/RealdebridComHook.py b/module/plugins/hooks/RealdebridComHook.py new file mode 100644 index 000000000..aa0c9f640 --- /dev/null +++ b/module/plugins/hooks/RealdebridComHook.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.MultiHook import MultiHook + + +class RealdebridComHook(MultiHook): + __name__ = "RealdebridComHook" + __type__ = "hook" + __version__ = "0.46" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 ), + ("ssl" , "bool" , "Use HTTPS" , True )] + + __description__ = """Real-Debrid.com hook plugin""" + __license__ = "GPLv3" + __authors__ = [("Devirex Hazzard", "naibaf_11@yahoo.de")] + + + def getHosters(self): + https = "https" if self.getConfig('ssl') else "http" + html = self.getURL(https + "://real-debrid.com/api/hosters.php").replace("\"", "").strip() + + return [x.strip() for x in html.split(",") if x.strip()] diff --git a/module/plugins/hooks/RehostTo.py b/module/plugins/hooks/RehostTo.py deleted file mode 100644 index 1e608f87a..000000000 --- a/module/plugins/hooks/RehostTo.py +++ /dev/null @@ -1,27 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.internal.MultiHook import MultiHook - - -class RehostTo(MultiHook): - __name__ = "RehostTo" - __type__ = "hook" - __version__ = "0.50" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), - ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """Rehost.to hook plugin""" - __license__ = "GPLv3" - __authors__ = [("RaNaN", "RaNaN@pyload.org")] - - - def getHosters(self): - user, data = self.account.selectAccount() - html = self.getURL("http://rehost.to/api.php", - get={'cmd' : "get_supported_och_dl", - 'long_ses': self.account.getAccountInfo(user)['session']}) - return [x.strip() for x in html.replace("\"", "").split(",")] diff --git a/module/plugins/hooks/RehostToHook.py b/module/plugins/hooks/RehostToHook.py new file mode 100644 index 000000000..a2415129a --- /dev/null +++ b/module/plugins/hooks/RehostToHook.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.MultiHook import MultiHook + + +class RehostToHook(MultiHook): + __name__ = "RehostToHook" + __type__ = "hook" + __version__ = "0.50" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] + + __description__ = """Rehost.to hook plugin""" + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org")] + + + def getHosters(self): + user, data = self.account.selectAccount() + html = self.getURL("http://rehost.to/api.php", + get={'cmd' : "get_supported_och_dl", + 'long_ses': self.account.getAccountInfo(user)['session']}) + return [x.strip() for x in html.replace("\"", "").split(",")] diff --git a/module/plugins/hooks/SimplyPremiumCom.py b/module/plugins/hooks/SimplyPremiumCom.py deleted file mode 100644 index a5173dbfa..000000000 --- a/module/plugins/hooks/SimplyPremiumCom.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.common.json_layer import json_loads -from module.plugins.internal.MultiHook import MultiHook - - -class SimplyPremiumCom(MultiHook): - __name__ = "SimplyPremiumCom" - __type__ = "hook" - __version__ = "0.05" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), - ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """Simply-Premium.com hook plugin""" - __license__ = "GPLv3" - __authors__ = [("EvolutionClip", "evolutionclip@live.de")] - - - def getHosters(self): - json_data = self.getURL("http://www.simply-premium.com/api/hosts.php", get={'format': "json", 'online': 1}) - json_data = json_loads(json_data) - - host_list = [element['regex'] for element in json_data['result']] - - return host_list diff --git a/module/plugins/hooks/SimplyPremiumComHook.py b/module/plugins/hooks/SimplyPremiumComHook.py new file mode 100644 index 000000000..116e3a76e --- /dev/null +++ b/module/plugins/hooks/SimplyPremiumComHook.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- + +from module.common.json_layer import json_loads +from module.plugins.internal.MultiHook import MultiHook + + +class SimplyPremiumComHook(MultiHook): + __name__ = "SimplyPremiumComHook" + __type__ = "hook" + __version__ = "0.05" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] + + __description__ = """Simply-Premium.com hook plugin""" + __license__ = "GPLv3" + __authors__ = [("EvolutionClip", "evolutionclip@live.de")] + + + def getHosters(self): + json_data = self.getURL("http://www.simply-premium.com/api/hosts.php", get={'format': "json", 'online': 1}) + json_data = json_loads(json_data) + + host_list = [element['regex'] for element in json_data['result']] + + return host_list diff --git a/module/plugins/hooks/SimplydebridCom.py b/module/plugins/hooks/SimplydebridCom.py deleted file mode 100644 index a37a6eb7f..000000000 --- a/module/plugins/hooks/SimplydebridCom.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.internal.MultiHook import MultiHook - - -class SimplydebridCom(MultiHook): - __name__ = "SimplydebridCom" - __type__ = "hook" - __version__ = "0.04" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), - ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """Simply-Debrid.com hook plugin""" - __license__ = "GPLv3" - __authors__ = [("Kagenoshin", "kagenoshin@gmx.ch")] - - - def getHosters(self): - html = self.getURL("http://simply-debrid.com/api.php", get={'list': 1}) - return [x.strip() for x in html.rstrip(';').replace("\"", "").split(";")] diff --git a/module/plugins/hooks/SimplydebridComHook.py b/module/plugins/hooks/SimplydebridComHook.py new file mode 100644 index 000000000..01629df99 --- /dev/null +++ b/module/plugins/hooks/SimplydebridComHook.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.MultiHook import MultiHook + + +class SimplydebridComHook(MultiHook): + __name__ = "SimplydebridComHook" + __type__ = "hook" + __version__ = "0.04" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] + + __description__ = """Simply-Debrid.com hook plugin""" + __license__ = "GPLv3" + __authors__ = [("Kagenoshin", "kagenoshin@gmx.ch")] + + + def getHosters(self): + html = self.getURL("http://simply-debrid.com/api.php", get={'list': 1}) + return [x.strip() for x in html.rstrip(';').replace("\"", "").split(";")] diff --git a/module/plugins/hooks/SmoozedCom.py b/module/plugins/hooks/SmoozedCom.py deleted file mode 100644 index cd9b2fa6e..000000000 --- a/module/plugins/hooks/SmoozedCom.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.internal.MultiHook import MultiHook - - -class SmoozedCom(MultiHook): - __name__ = "SmoozedCom" - __type__ = "hook" - __version__ = "0.03" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), - ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """Smoozed.com hook plugin""" - __license__ = "GPLv3" - __authors__ = [("", "")] - - - def getHosters(self): - user, data = self.account.selectAccount() - return self.account.getAccountInfo(user)["hosters"] diff --git a/module/plugins/hooks/SmoozedComHook.py b/module/plugins/hooks/SmoozedComHook.py new file mode 100644 index 000000000..24b7c8df0 --- /dev/null +++ b/module/plugins/hooks/SmoozedComHook.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.MultiHook import MultiHook + + +class SmoozedComHook(MultiHook): + __name__ = "SmoozedComHook" + __type__ = "hook" + __version__ = "0.03" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] + + __description__ = """Smoozed.com hook plugin""" + __license__ = "GPLv3" + __authors__ = [("", "")] + + + def getHosters(self): + user, data = self.account.selectAccount() + return self.account.getAccountInfo(user)["hosters"] diff --git a/module/plugins/hooks/UnrestrictLi.py b/module/plugins/hooks/UnrestrictLi.py deleted file mode 100644 index 58f31f2aa..000000000 --- a/module/plugins/hooks/UnrestrictLi.py +++ /dev/null @@ -1,28 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.common.json_layer import json_loads -from module.plugins.internal.MultiHook import MultiHook - - -class UnrestrictLi(MultiHook): - __name__ = "UnrestrictLi" - __type__ = "hook" - __version__ = "0.05" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), - ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 ), - ("history" , "bool" , "Delete History" , False)] - - __description__ = """Unrestrict.li hook plugin""" - __license__ = "GPLv3" - __authors__ = [("stickell", "l.stickell@yahoo.it")] - - - def getHosters(self): - json_data = self.getURL("http://unrestrict.li/api/jdownloader/hosts.php", get={'format': "json"}) - json_data = json_loads(json_data) - - return [element['host'] for element in json_data['result']] diff --git a/module/plugins/hooks/UnrestrictLiHook.py b/module/plugins/hooks/UnrestrictLiHook.py new file mode 100644 index 000000000..f1ffd1886 --- /dev/null +++ b/module/plugins/hooks/UnrestrictLiHook.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- + +from module.common.json_layer import json_loads +from module.plugins.internal.MultiHook import MultiHook + + +class UnrestrictLiHook(MultiHook): + __name__ = "UnrestrictLiHook" + __type__ = "hook" + __version__ = "0.05" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 ), + ("history" , "bool" , "Delete History" , False)] + + __description__ = """Unrestrict.li hook plugin""" + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] + + + def getHosters(self): + json_data = self.getURL("http://unrestrict.li/api/jdownloader/hosts.php", get={'format': "json"}) + json_data = json_loads(json_data) + + return [element['host'] for element in json_data['result']] diff --git a/module/plugins/hooks/ZeveraCom.py b/module/plugins/hooks/ZeveraCom.py deleted file mode 100644 index 7fcfb18da..000000000 --- a/module/plugins/hooks/ZeveraCom.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.internal.MultiHook import MultiHook - - -class ZeveraCom(MultiHook): - __name__ = "ZeveraCom" - __type__ = "hook" - __version__ = "0.05" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), - ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """Zevera.com hook plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg" , "zoidberg@mujmail.cz"), - ("Walter Purcaro", "vuolter@gmail.com" )] - - - def getHosters(self): - html = self.account.api_response(pyreq.getHTTPRequest(timeout=120), cmd="gethosters") - return [x.strip() for x in html.split(",")] diff --git a/module/plugins/hooks/ZeveraComHook.py b/module/plugins/hooks/ZeveraComHook.py new file mode 100644 index 000000000..21c1741d2 --- /dev/null +++ b/module/plugins/hooks/ZeveraComHook.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.MultiHook import MultiHook + + +class ZeveraComHook(MultiHook): + __name__ = "ZeveraComHook" + __type__ = "hook" + __version__ = "0.05" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] + + __description__ = """Zevera.com hook plugin""" + __license__ = "GPLv3" + __authors__ = [("zoidberg" , "zoidberg@mujmail.cz"), + ("Walter Purcaro", "vuolter@gmail.com" )] + + + def getHosters(self): + html = self.account.api_response(pyreq.getHTTPRequest(timeout=120), cmd="gethosters") + return [x.strip() for x in html.split(",")] diff --git a/module/plugins/internal/MultiHook.py b/module/plugins/internal/MultiHook.py index 942c044c2..6ef803f7a 100644 --- a/module/plugins/internal/MultiHook.py +++ b/module/plugins/internal/MultiHook.py @@ -11,7 +11,7 @@ from module.utils import decode, remove_chars class MultiHook(Hook): __name__ = "MultiHook" __type__ = "hook" - __version__ = "0.42" + __version__ = "0.43" __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)", "" ), @@ -71,16 +71,15 @@ class MultiHook(Hook): def initPlugin(self): - plugin, type = self.core.pluginManager.findPlugin(self.__name__) + self.pluginname = self.__name__.rsplit("Hook", 1)[0] + plugin, self.plugintype = self.core.pluginManager.findPlugin(self.pluginname) - if not plugin: + if plugin: + self.pluginmodule = self.core.pluginManager.loadModule(type, self.pluginname) + self.pluginclass = getattr(self.pluginmodule, self.pluginname) + else: self.logWarning("Hook plugin will be deactivated due missing plugin reference") self.setConfig('activated', False) - else: - self.pluginname = self.__name__ - self.plugintype = type - self.pluginmodule = self.core.pluginManager.loadModule(type, self.__name__) - self.pluginclass = getattr(self.pluginmodule, self.__name__) def loadAccount(self): -- cgit v1.2.3 From 944f0d42fcc335e5727e6e2e0b42f1177d9c6a18 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@users.noreply.github.com> Date: Wed, 8 Apr 2015 19:43:51 +0200 Subject: Fix https://github.com/pyload/pyload/issues/1157 (2) --- module/plugins/internal/MultiHook.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/internal/MultiHook.py b/module/plugins/internal/MultiHook.py index 6ef803f7a..51c8ea89f 100644 --- a/module/plugins/internal/MultiHook.py +++ b/module/plugins/internal/MultiHook.py @@ -11,7 +11,7 @@ from module.utils import decode, remove_chars class MultiHook(Hook): __name__ = "MultiHook" __type__ = "hook" - __version__ = "0.43" + __version__ = "0.44" __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)", "" ), @@ -75,7 +75,7 @@ class MultiHook(Hook): plugin, self.plugintype = self.core.pluginManager.findPlugin(self.pluginname) if plugin: - self.pluginmodule = self.core.pluginManager.loadModule(type, self.pluginname) + self.pluginmodule = self.core.pluginManager.loadModule(self.plugintype, self.pluginname) self.pluginclass = getattr(self.pluginmodule, self.pluginname) else: self.logWarning("Hook plugin will be deactivated due missing plugin reference") -- cgit v1.2.3 From e5ab79dc23dd5a50a4b4a3d5a51427eed55dcad5 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@users.noreply.github.com> Date: Wed, 8 Apr 2015 23:19:29 +0200 Subject: [ZippyshareCom] Fix https://github.com/pyload/pyload/issues/1311 --- module/plugins/hoster/ZippyshareCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py index 3f392133a..7af2c3370 100644 --- a/module/plugins/hoster/ZippyshareCom.py +++ b/module/plugins/hoster/ZippyshareCom.py @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class ZippyshareCom(SimpleHoster): __name__ = "ZippyshareCom" __type__ = "hoster" - __version__ = "0.77" + __version__ = "0.78" __pattern__ = r'http://www\d{0,2}\.zippyshare\.com/v(/|iew\.jsp.*key=)(?P<KEY>[\w^_]+)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -24,7 +24,7 @@ class ZippyshareCom(SimpleHoster): COOKIES = [("zippyshare.com", "ziplocale", "en")] - NAME_PATTERN = r'("/|<title>Zippyshare.com - )(?P<N>[^/]+?)("\);|)' + NAME_PATTERN = r'(Zippyshare.com - |"/)(?P<N>[^/]+)(|";)' SIZE_PATTERN = r'>Size:.+?">(?P[\d.,]+) (?P[\w^_]+)' OFFLINE_PATTERN = r'does not exist (anymore )?on this server<' -- cgit v1.2.3 From 73f99ea811d01a2e113a882fe5ab86b0aa9c4f4c Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 9 Apr 2015 00:22:51 +0200 Subject: [SimpleHoster] Improve file name handling --- module/plugins/crypter/LinkdecrypterCom.py | 1 + module/plugins/hooks/ExtractArchive.py | 4 ++-- module/plugins/hoster/ZippyshareCom.py | 6 ++--- module/plugins/internal/SimpleHoster.py | 37 +++++++++++++++--------------- 4 files changed, 24 insertions(+), 24 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/crypter/LinkdecrypterCom.py b/module/plugins/crypter/LinkdecrypterCom.py index c2e3ed91d..0704214d0 100644 --- a/module/plugins/crypter/LinkdecrypterCom.py +++ b/module/plugins/crypter/LinkdecrypterCom.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- import re + from module.plugins.Crypter import Crypter diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 9e6f2d379..d40b52aa7 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -173,7 +173,7 @@ class ExtractArchive(Hook): except OSError, e: if e.errno == 2: - self.logInfo(_("No %s installed") % p) + self.logWarning(_("No %s installed") % p) else: self.logWarning(_("Could not activate: %s") % p, e) if self.core.debug: @@ -185,7 +185,7 @@ class ExtractArchive(Hook): traceback.print_exc() if self.extractors: - self.logInfo(_("Activated") + " " + "|".join("%s %s" % (Extractor.__name__, Extractor.VERSION) for Extractor in self.extractors)) + self.logDebug(*["Found %s %s" % (Extractor.__name__, Extractor.VERSION) for Extractor in self.extractors]) self.extractQueued() #: Resume unfinished extractions else: self.logInfo(_("No Extract plugins activated")) diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py index cdb37a18c..fbac432cd 100644 --- a/module/plugins/hoster/ZippyshareCom.py +++ b/module/plugins/hoster/ZippyshareCom.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import re -from urllib import unquote +import urllib from BeautifulSoup import BeautifulSoup @@ -53,8 +53,8 @@ class ZippyshareCom(SimpleHoster): else: self.link = self.get_link() - if pyfile.name == 'file.html' and self.link: - pyfile.name = unquote(self.link.split('/')[-1]) + if self.link and pyfile.name == 'file.html': + pyfile.name = urllib.unquote(self.link.split('/')[-1]) def get_link(self): diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 8b1527b3e..ac5fbf391 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -5,11 +5,9 @@ import mimetypes import os import re import time +import urllib import urllib2 - -from inspect import isclass -from urllib import unquote -from urlparse import urljoin, urlparse +import urlparse from module.PyFile import statusMap as _statusMap from module.network.CookieJar import CookieJar @@ -109,8 +107,8 @@ def parseFileInfo(plugin, url="", html=""): info = plugin.getInfo(url, html) res = info['name'], info['size'], info['status'], info['url'] else: - url = unquote(url) - url_p = urlparse(url) + url = urllib.unquote(url) + url_p = urlparse.urlparse(url) res = ((url_p.path.split('/')[-1] or url_p.query.split('=', 1)[::-1][0].split('&', 1)[0] or url_p.netloc.split('.', 1)[0]), @@ -186,10 +184,10 @@ def getFileURL(self, url, follow_location=None): elif 'location' in header and header['location'].strip(): location = header['location'] - if not urlparse(location).scheme: - url_p = urlparse(url) + if not urlparse.urlparse(location).scheme: + url_p = urlparse.urlparse(url) baseurl = "%s://%s" % (url_p.scheme, url_p.netloc) - location = urljoin(baseurl, location) + location = urlparse.urljoin(baseurl, location) if 'code' in header and header['code'] == 302: link = location @@ -199,7 +197,7 @@ def getFileURL(self, url, follow_location=None): continue else: - extension = os.path.splitext(urlparse(url).path.split('/')[-1])[-1] + extension = os.path.splitext(urlparse.urlparse(url).path.split('/')[-1])[-1] if 'content-type' in header and header['content-type'].strip(): mimetype = header['content-type'].split(';')[0].strip() @@ -247,7 +245,7 @@ def secondsToMidnight(gmt=0): class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "1.35" + __version__ = "1.36" __pattern__ = r'^unmatchable$' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -323,8 +321,8 @@ class SimpleHoster(Hoster): @classmethod def apiInfo(cls, url="", get={}, post={}): - url = unquote(url) - url_p = urlparse(url) + url = urllib.unquote(url) + url_p = urlparse.urlparse(url) return {'name' : (url_p.path.split('/')[-1] or url_p.query.split('=', 1)[::-1][0].split('&', 1)[0] or url_p.netloc.split('.', 1)[0]), @@ -391,7 +389,7 @@ class SimpleHoster(Hoster): info['status'] = 2 if 'N' in info['pattern']: - info['name'] = replace_patterns(unquote(info['pattern']['N'].strip()), + info['name'] = replace_patterns(urllib.unquote(info['pattern']['N'].strip()), cls.NAME_REPLACEMENTS) if 'S' in info['pattern']: @@ -503,7 +501,9 @@ class SimpleHoster(Hoster): try: if disposition: content = urllib2.urlopen(url).info()['Content-Disposition'].split(';') - self.pyfile.name = content[1].split('filename=')[1][1:-1] or self.pyfile.name + self.pyfile.name = (content[1].split('filename=')[1][1:-1] + or urlparse.urlparse(urllib.unquote(url)).path.split('/')[-1] + or self.pyfile.name) finally: return super(SimpleHoster, self).download(url, get, post, ref, cookies, False) @@ -512,10 +512,10 @@ class SimpleHoster(Hoster): if link and isinstance(link, basestring): self.correctCaptcha() - if not urlparse(link).scheme: - url_p = urlparse(self.pyfile.url) + if not urlparse.urlparse(link).scheme: + url_p = urlparse.urlparse(self.pyfile.url) baseurl = "%s://%s" % (url_p.scheme, url_p.netloc) - link = urljoin(baseurl, link) + link = urlparse.urljoin(baseurl, link) self.download(link, ref=False, disposition=disposition) @@ -679,7 +679,6 @@ class SimpleHoster(Hoster): if link: self.logInfo(_("Direct download link detected")) - self.link = link else: self.logDebug("Direct download link not found") -- cgit v1.2.3 From 0099cce1f73598ad271bbb8685362f8e10a6c3ba Mon Sep 17 00:00:00 2001 From: zapp-brannigan Date: Thu, 9 Apr 2015 11:28:01 +0200 Subject: Update CaptchaService.py Fix ReCaptchaV2 --- module/plugins/internal/CaptchaService.py | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/internal/CaptchaService.py b/module/plugins/internal/CaptchaService.py index 3978a96c4..ec938079a 100644 --- a/module/plugins/internal/CaptchaService.py +++ b/module/plugins/internal/CaptchaService.py @@ -15,7 +15,7 @@ from module.plugins.Plugin import Base class CaptchaService(Base): __name__ = "CaptchaService" __type__ = "captcha" - __version__ = "0.25" + __version__ = "0.26" __description__ = """Base captcha service plugin""" __license__ = "GPLv3" @@ -45,7 +45,7 @@ class CaptchaService(Base): class ReCaptcha(CaptchaService): __name__ = "ReCaptcha" __type__ = "captcha" - __version__ = "0.14" + __version__ = "0.15" __description__ = """ReCaptcha captcha service plugin""" __license__ = "GPLv3" @@ -201,21 +201,12 @@ class ReCaptcha(CaptchaService): token2 = re.search(r'"finput","(.*?)",', html) self.logDebug("Token #2: %s" % token2.group(1)) - token3 = re.search(r'."asconf".\s,".*?".\s,"(.*?)".', html) + token3 = re.search(r'"rresp","(.*?)",', html) self.logDebug("Token #3: %s" % token3.group(1)) - html = self.plugin.req.load("https://www.google.com/recaptcha/api2/reload", - post={'k' : key, - 'c' : token2.group(1), - 'reason': "fi", - 'fbg' : token3.group(1)}) - - token4 = re.search(r'"rresp","(.*?)",', html) - self.logDebug("Token #4: %s" % token4.group(1)) - millis_captcha_loading = int(round(time.time() * 1000)) captcha_response = self.plugin.decryptCaptcha("https://www.google.com/recaptcha/api2/payload", - get={'c':token4.group(1), 'k':key}, + get={'c':token3.group(1), 'k':key}, cookies=True, forceUser=True) response = b64encode('{"response":"%s"}' % captcha_response) @@ -227,16 +218,16 @@ class ReCaptcha(CaptchaService): html = self.plugin.req.load("https://www.google.com/recaptcha/api2/userverify", post={'k' : key, - 'c' : token4.group(1), + 'c' : token3.group(1), 'response': response, 't' : timeToSolve, 'ct' : timeToSolveMore, 'bg' : botguardstring}) - token5 = re.search(r'"uvresp","(.*?)",', html) - self.logDebug("Token #5: %s" % token5.group(1)) + token4 = re.search(r'"uvresp","(.*?)",', html) + self.logDebug("Token #4: %s" % token4.group(1)) - result = token5.group(1) + result = token4.group(1) return result, None -- cgit v1.2.3 From 686d51fb3a43cb49ee4c3f44ea48b052d36616e0 Mon Sep 17 00:00:00 2001 From: valdi74 Date: Fri, 10 Apr 2015 00:06:18 +0200 Subject: Update - new links pattern --- module/plugins/hoster/FileSharkPl.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/FileSharkPl.py b/module/plugins/hoster/FileSharkPl.py index 63475958a..9f6070806 100644 --- a/module/plugins/hoster/FileSharkPl.py +++ b/module/plugins/hoster/FileSharkPl.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FileSharkPl(SimpleHoster): __name__ = "FileSharkPl" __type__ = "hoster" - __version__ = "0.09" + __version__ = "0.10" __pattern__ = r'http://(?:www\.)?fileshark\.pl/pobierz/\d+/\w+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -25,8 +25,8 @@ class FileSharkPl(SimpleHoster): SIZE_PATTERN = r'

(.*?)(?P\d+\.?\d*)\s(?P\w+)

' OFFLINE_PATTERN = r'(P|p)lik zosta. (usuni.ty|przeniesiony)' - LINK_FREE_PATTERN = r'' - LINK_PREMIUM_PATTERN = r'' + LINK_FREE_PATTERN = r'' + LINK_PREMIUM_PATTERN = r'' WAIT_PATTERN = r'var timeToDownload = (\d+);' ERROR_PATTERN = r'

(.*?)

' -- cgit v1.2.3 From d3f6b9936d45c5eb0308c0d2542dea6e3c001507 Mon Sep 17 00:00:00 2001 From: GammaC0de Date: Fri, 10 Apr 2015 03:02:37 +0300 Subject: Update DepositfilesCom.py --- module/plugins/hoster/DepositfilesCom.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'module/plugins') diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py index 95fd7c1b1..48b325b48 100644 --- a/module/plugins/hoster/DepositfilesCom.py +++ b/module/plugins/hoster/DepositfilesCom.py @@ -52,7 +52,9 @@ class DepositfilesCom(SimpleHoster): params = {'fid': m.group(1)} self.logDebug("FID: %s" % params['fid']) + self.setWait(60) self.wait() + recaptcha = ReCaptcha(self) captcha_key = recaptcha.detect_key() if captcha_key is None: -- cgit v1.2.3 From d9846612baf0ae82548e6cb7b9176ec1d5dd48f3 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 10 Apr 2015 03:28:03 +0200 Subject: [RestartSlow] Remove (temp) --- module/plugins/hooks/RestartSlow.py | 58 ------------------------------------- 1 file changed, 58 deletions(-) delete mode 100644 module/plugins/hooks/RestartSlow.py (limited to 'module/plugins') diff --git a/module/plugins/hooks/RestartSlow.py b/module/plugins/hooks/RestartSlow.py deleted file mode 100644 index db535b3d1..000000000 --- a/module/plugins/hooks/RestartSlow.py +++ /dev/null @@ -1,58 +0,0 @@ -# -*- coding: utf-8 -*- - -import pycurl - -from module.plugins.Hook import Hook - - -class RestartSlow(Hook): - __name__ = "RestartSlow" - __type__ = "hook" - __version__ = "0.04" - - __config__ = [("free_limit" , "int" , "Transfer speed threshold in kilobytes" , 100 ), - ("free_time" , "int" , "Sample interval in minutes" , 5 ), - ("premium_limit", "int" , "Transfer speed threshold for premium download in kilobytes", 300 ), - ("premium_time" , "int" , "Sample interval for premium download in minutes" , 2 ), - ("safe_mode" , "bool", "Don't restart if download is not resumable" , True)] - - __description__ = """Restart slow downloads""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - - event_list = ["downloadStarts"] - interval = 0 #@TODO: Remove in 0.4.10 - - - def setup(self): - self.info = {'chunk': {}} - - - def periodical(self): - if not self.pyfile.plugin.req.dl: - return - - if self.getConfig('safe_mode') and not self.pyfile.plugin.resumeDownload: - time = 30 - limit = 5 - else: - type = "premium" if self.pyfile.plugin.premium else "free" - time = max(30, self.getConfig("%s_time" % type) * 60) - limit = max(5, self.getConfig("%s_limit" % type) * 1024) - - chunks = [chunk for chunk in self.pyfile.plugin.req.dl.chunks \ - if chunk.id not in self.info['chunk'] or self.info['chunk'][chunk.id] is not (time, limit)] - - for chunk in chunks: - chunk.c.setopt(pycurl.LOW_SPEED_TIME , time) - chunk.c.setopt(pycurl.LOW_SPEED_LIMIT, limit) - - self.info['chunk'][chunk.id] = (time, limit) - - - def downloadStarts(self, pyfile, url, filename): - if self.cb or (self.getConfig('safe_mode') and not pyfile.plugin.resumeDownload): - return - self.pyfile = pyfile - super(RestartSlow, self).initPeriodical() -- cgit v1.2.3 From b92e851691faa9f1f8af5226c77a80c21f55b30e Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 10 Apr 2015 03:32:41 +0200 Subject: [DepositfilesCom] Update --- module/plugins/hoster/DepositfilesCom.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py index 48b325b48..cc24e351e 100644 --- a/module/plugins/hoster/DepositfilesCom.py +++ b/module/plugins/hoster/DepositfilesCom.py @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DepositfilesCom(SimpleHoster): __name__ = "DepositfilesCom" __type__ = "hoster" - __version__ = "0.54" + __version__ = "0.55" __pattern__ = r'https?://(?:www\.)?(depositfiles\.com|dfiles\.(eu|ru))(/\w{1,3})?/files/(?P\w+)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -28,7 +28,7 @@ class DepositfilesCom(SimpleHoster): OFFLINE_PATTERN = r'' NAME_REPLACEMENTS = [(r'\%u([0-9A-Fa-f]{4})', lambda m: unichr(int(m.group(1), 16))), - (r'.*")] + (r'.*")] URL_REPLACEMENTS = [(__pattern__ + ".*", "https://dfiles.eu/files/\g")] COOKIES = [("dfiles.eu", "lang_current", "en")] @@ -52,8 +52,7 @@ class DepositfilesCom(SimpleHoster): params = {'fid': m.group(1)} self.logDebug("FID: %s" % params['fid']) - self.setWait(60) - self.wait() + self.checkErrors() recaptcha = ReCaptcha(self) captcha_key = recaptcha.detect_key() @@ -68,9 +67,6 @@ class DepositfilesCom(SimpleHoster): m = re.search(self.LINK_FREE_PATTERN, self.html) if m: - if 'response' in params: - self.correctCaptcha() - self.link = unquote(m.group(1)) -- cgit v1.2.3 From ac24e99387460201cad5848bf325638aef2fed0b Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 10 Apr 2015 11:50:06 +0200 Subject: [SimpleHoster] Fix https://github.com/pyload/pyload/issues/1341 --- module/plugins/internal/SimpleHoster.py | 6 +++--- module/plugins/internal/XFSHoster.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index ac5fbf391..910731f95 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -245,7 +245,7 @@ def secondsToMidnight(gmt=0): class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "1.36" + __version__ = "1.37" __pattern__ = r'^unmatchable$' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -599,8 +599,8 @@ class SimpleHoster(Hoster): except Exception: waitmsg = m.group(0).strip() - wait_time = sum(int(v) * {"hr": 3600, "hour": 3600, "min": 60, "sec": 1}[u.lower()] for v, u in - re.findall(r'(\d+)\s*(hr|hour|min|sec)', waitmsg, re.I)) + wait_time = sum(int(v) * {"hr": 3600, "hour": 3600, "min": 60, "sec": 1, "": 1}[u.lower()] for v, u in + re.findall(r'(\d+)\s*(hr|hour|min|sec|)', waitmsg, re.I)) self.wait(wait_time, wait_time > 300) self.info.pop('error', None) diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py index 9e60a5aa5..027e68236 100644 --- a/module/plugins/internal/XFSHoster.py +++ b/module/plugins/internal/XFSHoster.py @@ -16,7 +16,7 @@ from module.utils import html_unescape class XFSHoster(SimpleHoster): __name__ = "XFSHoster" __type__ = "hoster" - __version__ = "0.45" + __version__ = "0.46" __pattern__ = r'^unmatchable$' @@ -193,8 +193,8 @@ class XFSHoster(SimpleHoster): self.logWarning(re.sub(r"<.*?>", " ", self.errmsg)) if 'wait' in self.errmsg: - wait_time = sum(int(v) * {"hr": 3600, "hour": 3600, "min": 60, "sec": 1}[u.lower()] for v, u in - re.findall(r'(\d+)\s*(hr|hour|min|sec)', self.errmsg, re.I)) + wait_time = sum(int(v) * {"hr": 3600, "hour": 3600, "min": 60, "sec": 1, "": 1}[u.lower()] for v, u in + re.findall(r'(\d+)\s*(hr|hour|min|sec|)', self.errmsg, re.I)) self.wait(wait_time, wait_time > 300) elif 'country' in self.errmsg: -- cgit v1.2.3 From 1e6846b3c435b0d71be83670d09bd019a84823ec Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 10 Apr 2015 14:36:59 +0200 Subject: Spare code cosmetics --- module/plugins/hoster/BezvadataCz.py | 2 +- module/plugins/hoster/BitshareCom.py | 2 +- module/plugins/hoster/DataportCz.py | 2 +- module/plugins/hoster/DateiTo.py | 2 +- module/plugins/hoster/DropboxCom.py | 4 ++-- module/plugins/hoster/EdiskCz.py | 2 +- module/plugins/hoster/EuroshareEu.py | 2 +- module/plugins/hoster/ExtabitCom.py | 3 +-- module/plugins/hoster/FilecloudIo.py | 3 +-- module/plugins/hoster/FilepostCom.py | 11 +---------- module/plugins/hoster/FlyFilesNet.py | 4 +--- module/plugins/hoster/GigapetaCom.py | 3 +-- module/plugins/hoster/GooIm.py | 2 +- module/plugins/hoster/LetitbitNet.py | 11 +---------- module/plugins/hoster/LoadTo.py | 8 +++----- module/plugins/hoster/LuckyShareNet.py | 2 +- module/plugins/hoster/MegasharesCom.py | 5 ++--- module/plugins/hoster/NarodRu.py | 4 +--- module/plugins/hoster/NowDownloadSx.py | 6 +++--- module/plugins/hoster/NowVideoSx.py | 2 +- module/plugins/hoster/QuickshareCz.py | 10 ++++------ module/plugins/hoster/SendspaceCom.py | 4 +--- module/plugins/hoster/ShareonlineBiz.py | 13 +++++-------- module/plugins/hoster/UloziskoSk.py | 3 +-- module/plugins/hoster/UnibytesCom.py | 6 ++---- module/plugins/hoster/UploadingCom.py | 5 ++--- module/plugins/hoster/VeohCom.py | 3 +-- module/plugins/hoster/VimeoCom.py | 4 ++-- module/plugins/hoster/WrzucTo.py | 3 +-- module/plugins/hoster/YibaishiwuCom.py | 5 ++--- 30 files changed, 47 insertions(+), 89 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/BezvadataCz.py b/module/plugins/hoster/BezvadataCz.py index 37dd38e02..fbb17635c 100644 --- a/module/plugins/hoster/BezvadataCz.py +++ b/module/plugins/hoster/BezvadataCz.py @@ -76,7 +76,7 @@ class BezvadataCz(SimpleHoster): wait_time = (int(m.group(1)) * 60 + int(m.group(2))) if m else 120 self.wait(wait_time, False) - self.download(url) + self.link = url def checkErrors(self): diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index 43f29c41f..79aaedcd9 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -72,7 +72,7 @@ class BitshareCom(SimpleHoster): self.logDebug("File ajax id is [%s]" % self.ajaxid) # This may either download our file or forward us to an error page - self.download(self.getDownloadUrl()) + self.link = self.getDownloadUrl() if self.checkDownload({"error": ">Error occured<"}): self.retry(5, 5 * 60, "Bitshare host : Error occured") diff --git a/module/plugins/hoster/DataportCz.py b/module/plugins/hoster/DataportCz.py index 89882d7f1..ad514f5eb 100644 --- a/module/plugins/hoster/DataportCz.py +++ b/module/plugins/hoster/DataportCz.py @@ -38,7 +38,7 @@ class DataportCz(SimpleHoster): else: self.error(_("captcha")) - self.html = self.download("http://www.dataport.cz%s" % action, post=inputs) + self.download("http://www.dataport.cz%s" % action, post=inputs) check = self.checkDownload({"captcha": 'alert("\u0160patn\u011b opsan\u00fd k\u00f3d z obr\u00e1zu");', "slot" : 'alert("Je n\u00e1m l\u00edto, ale moment\u00e1ln\u011b nejsou'}) diff --git a/module/plugins/hoster/DateiTo.py b/module/plugins/hoster/DateiTo.py index e93ebcf04..71a9eb4bf 100644 --- a/module/plugins/hoster/DateiTo.py +++ b/module/plugins/hoster/DateiTo.py @@ -57,7 +57,7 @@ class DateiTo(SimpleHoster): else: self.fail(_("Too bad...")) - self.download(self.html) + self.link = self.html def checkErrors(self): diff --git a/module/plugins/hoster/DropboxCom.py b/module/plugins/hoster/DropboxCom.py index c948039ac..eec968f5a 100644 --- a/module/plugins/hoster/DropboxCom.py +++ b/module/plugins/hoster/DropboxCom.py @@ -27,8 +27,8 @@ class DropboxCom(SimpleHoster): def setup(self): - self.multiDL = True - self.chunkLimit = 1 + self.multiDL = True + self.chunkLimit = 1 self.resumeDownload = True diff --git a/module/plugins/hoster/EdiskCz.py b/module/plugins/hoster/EdiskCz.py index cfa6da4eb..b8485001e 100644 --- a/module/plugins/hoster/EdiskCz.py +++ b/module/plugins/hoster/EdiskCz.py @@ -51,7 +51,7 @@ class EdiskCz(SimpleHoster): if not re.match(self.LINK_FREE_PATTERN, url): self.fail(_("Unexpected server response")) - self.download(url) + self.link = url getInfo = create_getInfo(EdiskCz) diff --git a/module/plugins/hoster/EuroshareEu.py b/module/plugins/hoster/EuroshareEu.py index 922665c2e..842e0cb87 100644 --- a/module/plugins/hoster/EuroshareEu.py +++ b/module/plugins/hoster/EuroshareEu.py @@ -34,7 +34,7 @@ class EuroshareEu(SimpleHoster): self.account.relogin(self.user) self.retry(reason=_("User not logged in")) - self.download(pyfile.url.rstrip('/') + "/download/") + self.link = pyfile.url.rstrip('/') + "/download/" check = self.checkDownload({"login": re.compile(self.ERR_NOT_LOGGED_IN_PATTERN), "json" : re.compile(r'\{"status":"error".*?"message":"(.*?)"')}) diff --git a/module/plugins/hoster/ExtabitCom.py b/module/plugins/hoster/ExtabitCom.py index a485f0c4d..f3b4d28be 100644 --- a/module/plugins/hoster/ExtabitCom.py +++ b/module/plugins/hoster/ExtabitCom.py @@ -72,8 +72,7 @@ class ExtabitCom(SimpleHoster): if m is None: self.error(_("LINK_FREE_PATTERN not found")) - url = m.group(1) - self.download(url) + self.link = m.group(1) getInfo = create_getInfo(ExtabitCom) diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index f4c8fedd6..38d2972a1 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -104,8 +104,7 @@ class FilecloudIo(SimpleHoster): if "size" in self.info and self.info['size']: self.check_data = {"size": int(self.info['size'])} - download_url = m.group(1) - self.download(download_url) + self.link = m.group(1) else: self.fail(_("Unexpected server response")) diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index 78960dc6d..2a9e3dc26 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -79,20 +79,11 @@ class FilepostCom(SimpleHoster): self.logDebug(u"RECAPTCHA: %s : %s : %s" % ( captcha_key, post_dict['recaptcha_challenge_field'], post_dict['recaptcha_response_field'])) - download_url = self.getJsonResponse(get_dict, post_dict, 'link') - if download_url: - if i: - self.correctCaptcha() - break - elif i: - self.invalidCaptcha() + self.link = self.getJsonResponse(get_dict, post_dict, 'link') else: self.fail(_("Invalid captcha")) - # Download - self.download(download_url) - def getJsonResponse(self, get_dict, post_dict, field): res = json_loads(self.load('https://filepost.com/files/get/', get=get_dict, post=post_dict)) diff --git a/module/plugins/hoster/FlyFilesNet.py b/module/plugins/hoster/FlyFilesNet.py index bcfaaab69..4420d5d60 100644 --- a/module/plugins/hoster/FlyFilesNet.py +++ b/module/plugins/hoster/FlyFilesNet.py @@ -41,6 +41,4 @@ class FlyFilesNet(SimpleHoster): self.wait(10 * 60, True) self.retry() - download_url = parsed_url.replace('#downlink|', '') - - self.download(download_url) + self.link = parsed_url.replace('#downlink|', '') diff --git a/module/plugins/hoster/GigapetaCom.py b/module/plugins/hoster/GigapetaCom.py index bb53a12ee..2fe44ca85 100644 --- a/module/plugins/hoster/GigapetaCom.py +++ b/module/plugins/hoster/GigapetaCom.py @@ -45,7 +45,7 @@ class GigapetaCom(SimpleHoster): m = re.search(r'Location\s*:\s*(.+)', self.req.http.header, re.I) if m: - download_url = m.group(1).rstrip() #@TODO: Remove .rstrip() in 0.4.10 + self.link = m.group(1).rstrip() #@TODO: Remove .rstrip() in 0.4.10 break elif "Entered figures don`t coincide with the picture" in self.html: self.invalidCaptcha() @@ -53,7 +53,6 @@ class GigapetaCom(SimpleHoster): self.fail(_("No valid captcha code entered")) self.req.http.c.setopt(FOLLOWLOCATION, 1) - self.download(download_url) def checkErrors(self): diff --git a/module/plugins/hoster/GooIm.py b/module/plugins/hoster/GooIm.py index c6d8ce83d..4b27e6cc8 100644 --- a/module/plugins/hoster/GooIm.py +++ b/module/plugins/hoster/GooIm.py @@ -32,7 +32,7 @@ class GooIm(SimpleHoster): def handleFree(self, pyfile): self.wait(10) - self.download(pyfile.url) + self.link = pyfile.url getInfo = create_getInfo(GooIm) diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index 27f2cadb8..79dbd8133 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -119,16 +119,7 @@ class LetitbitNet(SimpleHoster): else: self.error(_("Unknown response - captcha check")) - self.correctCaptcha() - - for download_url in urls: - try: - self.download(download_url) - break - except Exception, e: - self.logError(e) - else: - self.fail(_("Download did not finish correctly")) + self.link = urls[0] def handlePremium(self, pyfile): diff --git a/module/plugins/hoster/LoadTo.py b/module/plugins/hoster/LoadTo.py index 8f4f8808c..2b4202051 100644 --- a/module/plugins/hoster/LoadTo.py +++ b/module/plugins/hoster/LoadTo.py @@ -45,7 +45,7 @@ class LoadTo(SimpleHoster): if m is None: self.error(_("LINK_FREE_PATTERN not found")) - download_url = m.group(1) + self.link = m.group(1) # Set Timer - may be obsolete m = re.search(self.WAIT_PATTERN, self.html) @@ -56,11 +56,9 @@ class LoadTo(SimpleHoster): solvemedia = SolveMedia(self) captcha_key = solvemedia.detect_key() - if captcha_key is None: - self.download(download_url) - else: + if captcha_key: response, challenge = solvemedia.challenge(captcha_key) - self.download(download_url, + self.download(self.link, post={'adcopy_challenge': challenge, 'adcopy_response' : response, 'returnUrl' : pyfile.url}) diff --git a/module/plugins/hoster/LuckyShareNet.py b/module/plugins/hoster/LuckyShareNet.py index 980072744..26af8153f 100644 --- a/module/plugins/hoster/LuckyShareNet.py +++ b/module/plugins/hoster/LuckyShareNet.py @@ -69,7 +69,7 @@ class LuckyShareNet(SimpleHoster): if not json['link']: self.fail(_("No Download url retrieved/all captcha attempts failed")) - self.download(json['link']) + self.link = json['link'] getInfo = create_getInfo(LuckyShareNet) diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index c6ccdb587..ed2363fe3 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -105,9 +105,8 @@ class MegasharesCom(SimpleHoster): if m is None: self.error(msg) - download_url = m.group(1) - self.logDebug("%s: %s" % (msg, download_url)) - self.download(download_url) + self.link = m.group(1) + self.logDebug("%s: %s" % (msg, self.link)) getInfo = create_getInfo(MegasharesCom) diff --git a/module/plugins/hoster/NarodRu.py b/module/plugins/hoster/NarodRu.py index 7de041f36..65ad90d17 100644 --- a/module/plugins/hoster/NarodRu.py +++ b/module/plugins/hoster/NarodRu.py @@ -48,7 +48,7 @@ class NarodRu(SimpleHoster): m = re.search(self.LINK_FREE_PATTERN, self.html) if m: - url = 'http://narod.ru' + m.group(1) + self.link = 'http://narod.ru' + m.group(1) self.correctCaptcha() break @@ -61,7 +61,5 @@ class NarodRu(SimpleHoster): else: self.fail(_("No valid captcha code entered")) - self.download(url) - getInfo = create_getInfo(NarodRu) diff --git a/module/plugins/hoster/NowDownloadSx.py b/module/plugins/hoster/NowDownloadSx.py index 5ef36d270..a1cf9baf7 100644 --- a/module/plugins/hoster/NowDownloadSx.py +++ b/module/plugins/hoster/NowDownloadSx.py @@ -55,11 +55,11 @@ class NowDownloadSx(SimpleHoster): self.html = self.load(baseurl + str(continuelink.group(1))) - url = re.search(self.LINK_FREE_PATTERN, self.html) - if url is None: + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m is None: self.error(_("Download link not found")) - self.download(str(url.group(1))) + self.link = m.group(1) getInfo = create_getInfo(NowDownloadSx) diff --git a/module/plugins/hoster/NowVideoSx.py b/module/plugins/hoster/NowVideoSx.py index 04274ed82..477379597 100644 --- a/module/plugins/hoster/NowVideoSx.py +++ b/module/plugins/hoster/NowVideoSx.py @@ -39,7 +39,7 @@ class NowVideoSx(SimpleHoster): if m is None: self.error(_("Free download link not found")) - self.download(m.group(1)) + self.link = m.group(1) getInfo = create_getInfo(NowVideoSx) diff --git a/module/plugins/hoster/QuickshareCz.py b/module/plugins/hoster/QuickshareCz.py index 250a33d0d..893c3b6c7 100644 --- a/module/plugins/hoster/QuickshareCz.py +++ b/module/plugins/hoster/QuickshareCz.py @@ -68,11 +68,12 @@ class QuickshareCz(SimpleHoster): m = re.search(r'Location\s*:\s*(.+)', self.header, re.I) if m is None: self.fail(_("File not found")) - download_url = m.group(1).rstrip() #@TODO: Remove .rstrip() in 0.4.10 - self.logDebug("FREE URL2:" + download_url) + + self.link = m.group(1).rstrip() #@TODO: Remove .rstrip() in 0.4.10 + self.logDebug("FREE URL2:" + self.link) # check errors - m = re.search(r'/chyba/(\d+)', download_url) + m = re.search(r'/chyba/(\d+)', self.link) if m: if m.group(1) == '1': self.retry(60, 2 * 60, "This IP is already downloading") @@ -81,9 +82,6 @@ class QuickshareCz(SimpleHoster): else: self.fail(_("Error %d") % m.group(1)) - # download file - self.download(download_url) - def handlePremium(self, pyfile): download_url = '%s/download_premium.php' % self.jsvars['server'] diff --git a/module/plugins/hoster/SendspaceCom.py b/module/plugins/hoster/SendspaceCom.py index 148217fe6..0ab20949d 100644 --- a/module/plugins/hoster/SendspaceCom.py +++ b/module/plugins/hoster/SendspaceCom.py @@ -35,7 +35,7 @@ class SendspaceCom(SimpleHoster): if m: if 'captcha_hash' in params: self.correctCaptcha() - download_url = m.group(1) + self.link = m.group(1) break m = re.search(self.CAPTCHA_PATTERN, self.html) @@ -56,7 +56,5 @@ class SendspaceCom(SimpleHoster): else: self.fail(_("Download link not found")) - self.download(download_url) - getInfo = create_getInfo(SendspaceCom) diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index 102e91276..fea5781fe 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -98,16 +98,14 @@ class ShareonlineBiz(SimpleHoster): self.checkErrors() - res = self.handleCaptcha() - download_url = res.decode('base64') + res = self.handleCaptcha() + self.link = res.decode('base64') - if not download_url.startswith("http://"): + if not self.link.startswith("http://"): self.error(_("Wrong download url")) self.wait() - self.download(download_url) - def checkFile(self, rules={}): check = self.checkDownload({'cookie': re.compile(r'
Somebody else is already downloading using your IP-address<' in self.html: @@ -52,7 +52,7 @@ class UnibytesCom(SimpleHoster): if post_data['step'] == 'last': m = re.search(self.LINK_FREE_PATTERN, self.html) if m: - url = m.group(1) + self.link = m.group(1) self.correctCaptcha() break else: @@ -73,7 +73,5 @@ class UnibytesCom(SimpleHoster): self.req.http.c.setopt(FOLLOWLOCATION, 1) - self.download(url) - getInfo = create_getInfo(UnibytesCom) diff --git a/module/plugins/hoster/UploadingCom.py b/module/plugins/hoster/UploadingCom.py index 164b7b243..d0e0b1fd7 100644 --- a/module/plugins/hoster/UploadingCom.py +++ b/module/plugins/hoster/UploadingCom.py @@ -53,8 +53,7 @@ class UploadingCom(SimpleHoster): self.html = self.load('http://uploading.com/files/get/?JsHttpRequest=%d-xml' % timestamp(), post=postData) url = re.search(r'"link"\s*:\s*"(.*?)"', self.html) if url: - url = url.group(1).replace("\\/", "/") - self.download(url) + self.link = url.group(1).replace("\\/", "/") raise Exception("Plugin defect") @@ -93,7 +92,7 @@ class UploadingCom(SimpleHoster): else: self.error(_("No URL")) - self.download(url) + self.link = url getInfo = create_getInfo(UploadingCom) diff --git a/module/plugins/hoster/VeohCom.py b/module/plugins/hoster/VeohCom.py index 2f79f5aa4..57b24623b 100644 --- a/module/plugins/hoster/VeohCom.py +++ b/module/plugins/hoster/VeohCom.py @@ -43,8 +43,7 @@ class VeohCom(SimpleHoster): m = re.search(pattern, self.html) if m: pyfile.name += ".mp4" - link = m.group(1).replace("\\", "") - self.download(link) + self.link = m.group(1).replace("\\", "") return else: self.logInfo(_("No %s quality video found") % q.upper()) diff --git a/module/plugins/hoster/VimeoCom.py b/module/plugins/hoster/VimeoCom.py index 02aef98ec..a5196cb92 100644 --- a/module/plugins/hoster/VimeoCom.py +++ b/module/plugins/hoster/VimeoCom.py @@ -49,7 +49,7 @@ class VimeoCom(SimpleHoster): if self.getConfig('original'): if "original" in link: - self.download(link[q]) + self.link = link[q] return else: self.logInfo(_("Original file not downloadable")) @@ -64,7 +64,7 @@ class VimeoCom(SimpleHoster): for q in qlevel: if q in link: - self.download(link[q]) + self.link = link[q] return else: self.logInfo(_("No %s quality video found") % q.upper()) diff --git a/module/plugins/hoster/WrzucTo.py b/module/plugins/hoster/WrzucTo.py index 0d78058d7..50a45babe 100644 --- a/module/plugins/hoster/WrzucTo.py +++ b/module/plugins/hoster/WrzucTo.py @@ -46,8 +46,7 @@ class WrzucTo(SimpleHoster): if len(data) != 4: self.error(_("No download URL")) - download_url = "http://%s.wrzuc.to/pobierz/%s" % (data['server_id'], data['download_link']) - self.download(download_url) + self.link = "http://%s.wrzuc.to/pobierz/%s" % (data['server_id'], data['download_link']) getInfo = create_getInfo(WrzucTo) diff --git a/module/plugins/hoster/YibaishiwuCom.py b/module/plugins/hoster/YibaishiwuCom.py index 44f2b7b83..7ca6e1ac0 100644 --- a/module/plugins/hoster/YibaishiwuCom.py +++ b/module/plugins/hoster/YibaishiwuCom.py @@ -47,9 +47,8 @@ class YibaishiwuCom(SimpleHoster): for mr in mirrors: try: - url = mr['url'].replace("\\", "") - self.logDebug("Trying URL: " + url) - self.download(url) + self.link = mr['url'].replace("\\", "") + self.logDebug("Trying URL: " + self.link) break except Exception: continue -- cgit v1.2.3 From 71c997e75ee6b8d7ae638dd8612d7b805e4eb523 Mon Sep 17 00:00:00 2001 From: Armin Date: Fri, 10 Apr 2015 17:57:40 +0200 Subject: Fix OboomCom and SmoozedCom with beaker >= v1.7.x --- module/plugins/accounts/OboomCom.py | 17 +++++++++++++++-- module/plugins/accounts/SmoozedCom.py | 17 +++++++++++++++-- 2 files changed, 30 insertions(+), 4 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/accounts/OboomCom.py b/module/plugins/accounts/OboomCom.py index 0acacbb2a..a9068f1df 100644 --- a/module/plugins/accounts/OboomCom.py +++ b/module/plugins/accounts/OboomCom.py @@ -2,7 +2,20 @@ import time -from beaker.crypto.pbkdf2 import PBKDF2 +try: + from beaker.crypto.pbkdf2 import PBKDF2 + +except ImportError: + from beaker.crypto.pbkdf2 import pbkdf2 + from binascii import b2a_hex + class PBKDF2(object): + def __init__(self, passphrase, salt, iterations=1000): + self.passphrase = passphrase + self.salt = salt + self.iterations = iterations + + def hexread(self, octets): + return b2a_hex(pbkdf2(self.passphrase, self.salt, self.iterations, octets)) from module.common.json_layer import json_loads from module.plugins.Account import Account @@ -11,7 +24,7 @@ from module.plugins.Account import Account class OboomCom(Account): __name__ = "OboomCom" __type__ = "account" - __version__ = "0.23" + __version__ = "0.24" __description__ = """Oboom.com account plugin""" __license__ = "GPLv3" diff --git a/module/plugins/accounts/SmoozedCom.py b/module/plugins/accounts/SmoozedCom.py index 87efb89b3..3c8226704 100644 --- a/module/plugins/accounts/SmoozedCom.py +++ b/module/plugins/accounts/SmoozedCom.py @@ -3,7 +3,20 @@ import hashlib import time -from beaker.crypto.pbkdf2 import PBKDF2 +try: + from beaker.crypto.pbkdf2 import PBKDF2 + +except ImportError: + from beaker.crypto.pbkdf2 import pbkdf2 + from binascii import b2a_hex + class PBKDF2(object): + def __init__(self, passphrase, salt, iterations=1000): + self.passphrase = passphrase + self.salt = salt + self.iterations = iterations + + def hexread(self, octets): + return b2a_hex(pbkdf2(self.passphrase, self.salt, self.iterations, octets)) from module.common.json_layer import json_loads from module.plugins.Account import Account @@ -12,7 +25,7 @@ from module.plugins.Account import Account class SmoozedCom(Account): __name__ = "SmoozedCom" __type__ = "account" - __version__ = "0.03" + __version__ = "0.04" __description__ = """Smoozed.com account plugin""" __license__ = "GPLv3" -- cgit v1.2.3 From 20d433b55b40203a8f302a8ecd3c58b47c2869e3 Mon Sep 17 00:00:00 2001 From: zapp-brannigan Date: Sat, 11 Apr 2015 11:23:36 +0200 Subject: [New Hoster] lolabits.es As requested in https://github.com/pyload/pyload/issues/1343 --- module/plugins/hoster/LolabitsEs.py | 46 +++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 module/plugins/hoster/LolabitsEs.py (limited to 'module/plugins') diff --git a/module/plugins/hoster/LolabitsEs.py b/module/plugins/hoster/LolabitsEs.py new file mode 100644 index 000000000..fe25aa838 --- /dev/null +++ b/module/plugins/hoster/LolabitsEs.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -* + +import re +import HTMLParser + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + + +class LolabitsEs(SimpleHoster): + __name__ = "LolabitsEs" + __type__ = "hoster" + __version__ = "0.01" + + __pattern__ = r'https?://(?:www\.)?lolabits.es/.*' + + __description__ = """lolabits.es hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] + + + NAME_PATTERN = r'Descargar: (?P.+?)' + SIZE_PATTERN = r'class="fileSize">(?P[\d.,]+) (?P[\w^_]+)<' + + OFFLINE_PATTERN = r'Un usuario con este nombre no existe' + + + def setup(self): + self.chunkLimit = 1 + + def handleFree(self, pyfile): + fileid = re.search(r'name="FileId" value="(\d+)"',self.html).group(1) + self.logDebug("FileID: %s" %fileid) + + token = re.search(r'name="__RequestVerificationToken" type="hidden" value="(.+?)"',self.html).group(1) + self.logDebug("Token: %s" %token) + + self.html = self.load("http://lolabits.es/action/License/Download", + cookies = True, + post = {"fileId" : fileid, + "__RequestVerificationToken" : token} + ).decode('unicode-escape') + m = re.search(r'"redirectUrl":"(.+?)"',self.html) + self.link = HTMLParser.HTMLParser().unescape(m.group(1)) + + +getInfo = create_getInfo(LolabitsEs) -- cgit v1.2.3 From c7bbcf09791a3754c393e6f1e57dd768306aa63a Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 12 Apr 2015 19:18:24 +0200 Subject: [LolabitsEs] Cleanup --- module/plugins/hoster/LolabitsEs.py | 44 +++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 21 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/LolabitsEs.py b/module/plugins/hoster/LolabitsEs.py index fe25aa838..61df5f0bb 100644 --- a/module/plugins/hoster/LolabitsEs.py +++ b/module/plugins/hoster/LolabitsEs.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -* -import re import HTMLParser +import re from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -9,38 +9,40 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class LolabitsEs(SimpleHoster): __name__ = "LolabitsEs" __type__ = "hoster" - __version__ = "0.01" + __version__ = "0.02" - __pattern__ = r'https?://(?:www\.)?lolabits.es/.*' + __pattern__ = r'https?://(?:www\.)?lolabits\.es/.+' - __description__ = """lolabits.es hoster plugin""" + __description__ = """Lolabits.es hoster plugin""" __license__ = "GPLv3" __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] - NAME_PATTERN = r'Descargar: (?P.+?)' - SIZE_PATTERN = r'class="fileSize">(?P[\d.,]+) (?P[\w^_]+)<' - + NAME_PATTERN = r'Descargar: (?P.+?)<' + SIZE_PATTERN = r'class="fileSize">(?P[\d.,]+) (?P[\w^_]+)' OFFLINE_PATTERN = r'Un usuario con este nombre no existe' + FILEID_PATTERN = r'name="FileId" value="(\d+)"' + TOKEN_PATTERN = r'name="__RequestVerificationToken" type="hidden" value="(.+?)"' + LINK_PATTERN = r'"redirectUrl":"(.+?)"' + def setup(self): self.chunkLimit = 1 + def handleFree(self, pyfile): - fileid = re.search(r'name="FileId" value="(\d+)"',self.html).group(1) - self.logDebug("FileID: %s" %fileid) - - token = re.search(r'name="__RequestVerificationToken" type="hidden" value="(.+?)"',self.html).group(1) - self.logDebug("Token: %s" %token) - + fileid = re.search(self.FILEID_PATTERN, self.html).group(1) + self.logDebug("FileID: " + fileid) + + token = re.search(self.TOKEN_PATTERN, self.html).group(1) + self.logDebug("Token: " + token) + self.html = self.load("http://lolabits.es/action/License/Download", - cookies = True, - post = {"fileId" : fileid, - "__RequestVerificationToken" : token} - ).decode('unicode-escape') - m = re.search(r'"redirectUrl":"(.+?)"',self.html) - self.link = HTMLParser.HTMLParser().unescape(m.group(1)) - - + post={'fileId' : fileid, + '__RequestVerificationToken' : token}).decode('unicode-escape') + + self.link = HTMLParser.HTMLParser().unescape(re.search(self.LINK_PATTERN, self.html).group(1)) + + getInfo = create_getInfo(LolabitsEs) -- cgit v1.2.3 From ba16563f549663dd8fdd98acc3c47210c329a0bf Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 13 Apr 2015 15:13:13 +0200 Subject: [UnSkipOnFail] Typo --- module/plugins/hooks/UnSkipOnFail.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/UnSkipOnFail.py b/module/plugins/hooks/UnSkipOnFail.py index ebd370a0f..6cd742c91 100644 --- a/module/plugins/hooks/UnSkipOnFail.py +++ b/module/plugins/hooks/UnSkipOnFail.py @@ -7,7 +7,7 @@ from module.plugins.Hook import Hook class UnSkipOnFail(Hook): __name__ = "UnSkipOnFail" __type__ = "hook" - __version__ = "0.05" + __version__ = "0.06" __config__ = [("activated", "bool", "Activated", True)] @@ -43,7 +43,7 @@ class UnSkipOnFail(Hook): # It creates a temporary PyFile object using # "link" data, changes its status, and tells # the core.files-manager to save its data. - pylink = _pyfile(link) + pylink = self._pyfile(link) pylink.setCustomStatus(_("unskipped"), "queued") -- cgit v1.2.3 From 856e3e90b7863807c040faadd313adcbe45fc013 Mon Sep 17 00:00:00 2001 From: GammaC0de Date: Tue, 14 Apr 2015 02:54:11 +0300 Subject: Update SimpleHoster.py --- module/plugins/internal/SimpleHoster.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'module/plugins') diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 910731f95..dc4f480b9 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -623,7 +623,10 @@ class SimpleHoster(Hoster): self.tempOffline() elif status is 8: - self.fail() + if 'error' in self.info: + self.fail(self.info['error']) + else: + self.fail("Failed") finally: self.logDebug("File status: %s" % statusMap[status]) -- cgit v1.2.3 From 5c6f3886563654eb568b78356c187ccf43814787 Mon Sep 17 00:00:00 2001 From: GammaC0de Date: Tue, 14 Apr 2015 03:34:56 +0300 Subject: Update YadiSk.py --- module/plugins/hoster/YadiSk.py | 81 +++++++++++++++++++++-------------------- 1 file changed, 42 insertions(+), 39 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/YadiSk.py b/module/plugins/hoster/YadiSk.py index c3749d30d..ad63ffb32 100644 --- a/module/plugins/hoster/YadiSk.py +++ b/module/plugins/hoster/YadiSk.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class YadiSk(SimpleHoster): __name__ = "YadiSk" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.04" __pattern__ = r'https?://yadi\.sk/d/\w+' @@ -22,6 +22,42 @@ class YadiSk(SimpleHoster): OFFLINE_PATTERN = r'Nothing found' + @classmethod + def getInfo(cls, url="", html=""): + info = super(YadiSk, cls).getInfo(url, html) + + if html: + if 'idclient' not in info: + info['idclient'] = "" + for _i in xrange(32): + info ['idclient'] += random.choice('0123456abcdef') + + m = re.search(r'', html) + if m: + api_data = json_loads(m.group(1)) + try: + for sect in api_data: + if 'model' in sect: + if sect['model'] == "config": + info['version'] = sect['data']['version'] + info['sk'] = sect['data']['sk'] + + elif sect['model'] == "resource": + info['id'] = sect['data']['id'] + info['size'] = sect['data']['meta']['size'] + info['name'] = sect['data']['name'] + + except Exception, e: + info['status'] = 8 + info['error'] = _("Unexpected server response: %s") % e.message + + else: + info['status'] = 8 + info['error'] = _("could not find required json data") + + return info + + def setup(self): self.resumeDownload = False self.multiDL = False @@ -29,51 +65,18 @@ class YadiSk(SimpleHoster): def handleFree(self, pyfile): - m = re.search(r'', self.html) - if m is None: - self.error(_("could not find required json data")) - - res = json_loads(m.group(1)) - - yadisk_ver = None - yadisk_sk = None - yadisk_id = None - yadisk_size = None - yadisk_name = None - - try: #@TODO: Copy to apiInfo - for sect in res: - if 'model' in sect: - if sect['model'] == "config": - yadisk_ver = sect['data']['version'] - yadisk_sk = sect['data']['sk'] - - elif sect['model'] == "resource": - yadisk_id = sect['data']['id'] - yadisk_size = sect['data']['meta']['size'] - yadisk_name = sect['data']['name'] - - except Exception, e: - self.fail(_("Unexpected server response"), e) - - if None in (yadisk_id, yadisk_sk, yadisk_id, yadisk_size, yadisk_name): + if any(True for _k in ['id', 'sk', 'version', 'idclient'] if _k not in self.info): self.error(_("Missing JSON data")) - self.pyfile.size = yadisk_size - self.pyfile.name = yadisk_name - - yadisk_idclient = "" - for _i in range(32): - yadisk_idclient += random.choice('0123456abcdef') try: self.html = self.load("https://yadi.sk/models/", get={'_m': "do-get-resource-url"}, - post={'idClient': yadisk_idclient, - 'version' : yadisk_ver, + post={'idClient': self.info['idclient'], + 'version' : self.info['version'], '_model.0': "do-get-resource-url", - 'sk' : yadisk_sk, - 'id.0' : yadisk_id}) + 'sk' : self.info['sk'], + 'id.0' : self.info['id']}) self.link = json_loads(self.html)['models'][0]['data']['file'] -- cgit v1.2.3 From e0860ec5345d2392ab8a982d8e1fcf9a9986a587 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 14 Apr 2015 03:23:01 +0200 Subject: [SimpleHoster] Improve latest change a little --- module/plugins/internal/SimpleHoster.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index dc4f480b9..1400fd2b6 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -623,10 +623,7 @@ class SimpleHoster(Hoster): self.tempOffline() elif status is 8: - if 'error' in self.info: - self.fail(self.info['error']) - else: - self.fail("Failed") + self.fail(self.info['error'] if 'error' in self.info else "Failed") finally: self.logDebug("File status: %s" % statusMap[status]) -- cgit v1.2.3 From 4d3e0b374ccb1dfac1c9370c3ec824890c4dd0b8 Mon Sep 17 00:00:00 2001 From: GammaC0de Date: Tue, 14 Apr 2015 11:43:44 +0300 Subject: Version bump --- module/plugins/internal/SimpleHoster.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins') diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 1400fd2b6..d65d12403 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -245,7 +245,7 @@ def secondsToMidnight(gmt=0): class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "1.37" + __version__ = "1.38" __pattern__ = r'^unmatchable$' __config__ = [("use_premium", "bool", "Use premium account if available", True)] -- cgit v1.2.3 From ae14e28b210a164c3d3f58de7656d854f5f98037 Mon Sep 17 00:00:00 2001 From: GammaC0de Date: Tue, 14 Apr 2015 12:47:39 +0300 Subject: Update UpdateManager.py --- module/plugins/hooks/UpdateManager.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/UpdateManager.py b/module/plugins/hooks/UpdateManager.py index d66810d6d..33de276d2 100644 --- a/module/plugins/hooks/UpdateManager.py +++ b/module/plugins/hooks/UpdateManager.py @@ -29,7 +29,7 @@ def exists(path): class UpdateManager(Hook): __name__ = "UpdateManager" __type__ = "hook" - __version__ = "0.50" + __version__ = "0.51" __config__ = [("activated" , "bool", "Activated" , True ), ("checkinterval", "int" , "Check interval in hours" , 8 ), @@ -45,10 +45,13 @@ class UpdateManager(Hook): interval = 0 + restartrequired = False SERVER_URL = "http://updatemanager.pyload.org" MIN_CHECK_INTERVAL = 3 * 60 * 60 #: 3 hours + event_list = ["allDownloadsProcessed"] + def coreReady(self): if self.checkonstart: @@ -68,6 +71,14 @@ class UpdateManager(Hook): else: self.checkonstart = False + self.restartrequired = False + + + def allDownloadsProcessed(self): + if self.restartrequired is True: + self.logWarning(_("Downloads are done, restarting pyLoad to reload the updated plugins")) + self.core.api.restart() + def periodical(self): if self.core.debug: @@ -128,7 +139,12 @@ class UpdateManager(Hook): self.core.api.pauseServer() if self._update() is 2 and self.getConfig('autorestart'): - self.core.api.restart() + downloads = self.core.api.statusDownloads() + if not downloads: + self.core.api.restart() + else: + self.restartrequired = True + self.logWarning(_("Downloads are active, will restart once the download is done")) else: self.core.api.unpauseServer() @@ -258,7 +274,7 @@ class UpdateManager(Hook): if self.core.pluginManager.reloadPlugins(updated): exitcode = 1 else: - self.logWarning(_("Restart pyLoad to reload the updated plugins")) + self.logWarning(_("pyLoad restart required to reload the updated plugins")) self.info['plugins'] = True exitcode = 2 -- cgit v1.2.3 From 6b271a669cd4b08cdbd8d55d9b3b4f6deec7c8ac Mon Sep 17 00:00:00 2001 From: GammaC0de Date: Thu, 16 Apr 2015 01:29:39 +0300 Subject: HostujeNet --- module/plugins/hoster/HostujeNet.py | 51 +++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 module/plugins/hoster/HostujeNet.py (limited to 'module/plugins') diff --git a/module/plugins/hoster/HostujeNet.py b/module/plugins/hoster/HostujeNet.py new file mode 100644 index 000000000..2dabb72d2 --- /dev/null +++ b/module/plugins/hoster/HostujeNet.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# + + +import re + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + + +class HostujeNet(SimpleHoster): + __name__ = "HostujeNet" + __type__ = "hoster" + __version__ = "0.01" + + __pattern__ = r'http://(?:www\.)?hostuje\.net/\w+' + + __description__ = """Hostuje.net hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("GammaC0de", None)] + + + NAME_PATTERN = r'' + SIZE_PATTERN = r'Rozmiar: (?P[\d.,]+) (?P[\w^_]+)
' + OFFLINE_PATTERN = ur'Podany plik nie został odnaleziony\.\.\.' + + + def setup(self): + self.multiDL = True + self.chunkLimit = 1 + + + def handleFree(self, pyfile): + m = re.search(r'', self.html) + if m: + jscript = self.load("http://hostuje.net/" + m.group(1)) + m = re.search(r"\('(\w+\.php\?i=\w+)'\);", jscript) + if m: + self.load("http://hostuje.net/" + m.group(1)) + else: + self.error(_("unexpected javascript format")) + else: + self.error(_("script not found")) + + action, inputs = self.parseHtmlForm(pyfile.url.replace(".", "\.").replace( "?", "\?")) + if not action: + self.error(_("form not found")) + + self.download(action, post=inputs) + + +getInfo = create_getInfo(HostujeNet) -- cgit v1.2.3 From 11d3e8c59b1addf80a0971ea0ef97347604e45ce Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 16 Apr 2015 00:46:38 +0200 Subject: [HostujeNet] Tiny cleanup --- module/plugins/hoster/HostujeNet.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/HostujeNet.py b/module/plugins/hoster/HostujeNet.py index 2dabb72d2..ec91e50b9 100644 --- a/module/plugins/hoster/HostujeNet.py +++ b/module/plugins/hoster/HostujeNet.py @@ -1,6 +1,4 @@ # -*- coding: utf-8 -*- -# - import re @@ -19,13 +17,13 @@ class HostujeNet(SimpleHoster): __authors__ = [("GammaC0de", None)] - NAME_PATTERN = r'' - SIZE_PATTERN = r'Rozmiar: (?P[\d.,]+) (?P[\w^_]+)
' + NAME_PATTERN = r'' + SIZE_PATTERN = r'Rozmiar: (?P[\d.,]+) (?P[\w^_]+)
' OFFLINE_PATTERN = ur'Podany plik nie został odnaleziony\.\.\.' def setup(self): - self.multiDL = True + self.multiDL = True self.chunkLimit = 1 -- cgit v1.2.3 From e76a0a2386915cec650ca1a8eeeadc46ebf42aff Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 16 Apr 2015 16:16:24 +0200 Subject: [UploadedTo] Set DISPOSITION to False (temp) --- module/plugins/hoster/UploadedTo.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py index cc64a28eb..67f82d1f7 100644 --- a/module/plugins/hoster/UploadedTo.py +++ b/module/plugins/hoster/UploadedTo.py @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UploadedTo(SimpleHoster): __name__ = "UploadedTo" __type__ = "hoster" - __version__ = "0.85" + __version__ = "0.86" __pattern__ = r'https?://(?:www\.)?(uploaded\.(to|net)|ul\.to)(/file/|/?\?id=|.*?&id=|/)(?P\w+)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -21,6 +21,8 @@ class UploadedTo(SimpleHoster): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + DISPOSITION = False + API_KEY = "lhF2IeeprweDfu9ccWlxXVVypA5nA3EL" URL_REPLACEMENTS = [(__pattern__ + ".*", r'http://uploaded.net/file/\g')] -- cgit v1.2.3 From d38fc44f61177592ce0c925b947dde6a7d39d55b Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 16 Apr 2015 16:19:29 +0200 Subject: [UpdateManager] Cleanup --- module/plugins/hooks/UpdateManager.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/UpdateManager.py b/module/plugins/hooks/UpdateManager.py index 33de276d2..5779e7c80 100644 --- a/module/plugins/hooks/UpdateManager.py +++ b/module/plugins/hooks/UpdateManager.py @@ -45,7 +45,6 @@ class UpdateManager(Hook): interval = 0 - restartrequired = False SERVER_URL = "http://updatemanager.pyload.org" MIN_CHECK_INTERVAL = 3 * 60 * 60 #: 3 hours @@ -71,11 +70,11 @@ class UpdateManager(Hook): else: self.checkonstart = False - self.restartrequired = False + self.do_restart = False def allDownloadsProcessed(self): - if self.restartrequired is True: + if self.do_restart is True: self.logWarning(_("Downloads are done, restarting pyLoad to reload the updated plugins")) self.core.api.restart() @@ -139,11 +138,10 @@ class UpdateManager(Hook): self.core.api.pauseServer() if self._update() is 2 and self.getConfig('autorestart'): - downloads = self.core.api.statusDownloads() - if not downloads: + if not self.core.api.statusDownloads(): self.core.api.restart() else: - self.restartrequired = True + self.do_restart = True self.logWarning(_("Downloads are active, will restart once the download is done")) else: self.core.api.unpauseServer() -- cgit v1.2.3 From 3c75bb3ac5ecd27b147dd28b9185a080aa66a675 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 16 Apr 2015 21:22:24 +0200 Subject: [UnSkipOnFail] Typo (2) --- module/plugins/hooks/UnSkipOnFail.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/UnSkipOnFail.py b/module/plugins/hooks/UnSkipOnFail.py index 6cd742c91..9059d0350 100644 --- a/module/plugins/hooks/UnSkipOnFail.py +++ b/module/plugins/hooks/UnSkipOnFail.py @@ -7,7 +7,7 @@ from module.plugins.Hook import Hook class UnSkipOnFail(Hook): __name__ = "UnSkipOnFail" __type__ = "hook" - __version__ = "0.06" + __version__ = "0.07" __config__ = [("activated", "bool", "Activated", True)] @@ -32,9 +32,9 @@ class UnSkipOnFail(Hook): msg = _("Looking for skipped duplicates of: %s (pid:%s)") self.logInfo(msg % (pyfile.name, pyfile.package().id)) - dup = self.findDuplicate(pyfile) - if dup: - self.logInfo(_("Queue found duplicate: %s (pid:%s)") % (dup.name, dup.packageID)) + link = self.findDuplicate(pyfile) + if link: + self.logInfo(_("Queue found duplicate: %s (pid:%s)") % (link.name, link.packageID)) #: Change status of "link" to "new_status". # "link" has to be a valid FileData object, -- cgit v1.2.3 From bd365a1fed377665b00c3d815b096b7fa7a26374 Mon Sep 17 00:00:00 2001 From: zapp-brannigan Date: Wed, 22 Apr 2015 09:20:38 +0200 Subject: [FilecryptCc.py] Fix circle captcha Fix https://github.com/pyload/pyload/issues/1364 --- module/plugins/crypter/FilecryptCc.py | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/crypter/FilecryptCc.py b/module/plugins/crypter/FilecryptCc.py index baea8886b..7679e9446 100644 --- a/module/plugins/crypter/FilecryptCc.py +++ b/module/plugins/crypter/FilecryptCc.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # http://filecrypt.cc/Container/64E039F859.html - +import base64 import binascii import re @@ -14,7 +14,7 @@ from module.plugins.internal.CaptchaService import ReCaptcha class FilecryptCc(Crypter): __name__ = "FilecryptCc" __type__ = "crypter" - __version__ = "0.11" + __version__ = "0.12" __pattern__ = r'https?://(?:www\.)?filecrypt\.cc/Container/\w+' @@ -39,7 +39,7 @@ class FilecryptCc(Crypter): def decrypt(self, pyfile): - self.html = self.load(pyfile.url) + self.html = self.load(pyfile.url, cookies=True) if "content notfound" in self.html: #@NOTE: "content notfound" is NOT a typo self.offline() @@ -64,7 +64,7 @@ class FilecryptCc(Crypter): self.logInfo(_("Found %d mirrors") % len(mirror)) for i in mirror[1:]: - self.siteWithLinks = self.siteWithLinks + self.load(i).decode("utf-8", "replace") + self.siteWithLinks = self.siteWithLinks + self.load(i, cookies=True).decode("utf-8", "replace") def handlePasswordProtection(self): @@ -78,7 +78,7 @@ class FilecryptCc(Crypter): if not password: self.fail(_("Please enter the password in package section and try again")) - self.html = self.load(self.pyfile.url, post={"password": password}) + self.html = self.load(self.pyfile.url, post={"password": password}, cookies=True) def handleCaptcha(self): @@ -94,17 +94,17 @@ class FilecryptCc(Crypter): self.siteWithLinks = self.load(self.pyfile.url, post={'recaptcha_response_field': captcha_code}, + cookies=True, decode=True) elif m2: #: circle captcha self.logDebug("Captcha-URL: %s" % m2.group(1)) - captcha_code = self.decryptCaptcha(urljoin("http://filecrypt.cc", m2.group(1)), - forceUser=True, - imgtype="gif", + captcha_code = self.decryptCaptcha('https://www.filecrypt.cc/captcha/circle.php?c=abc', result_type='positional') - + self.siteWithLinks = self.load(self.pyfile.url, post={'button.x': captcha_code[0], 'button.y': captcha_code[1]}, + cookies=True, decode=True) else: @@ -140,9 +140,9 @@ class FilecryptCc(Crypter): weblinks = re.findall(self.WEBLINK_PATTERN, self.siteWithLinks) for link in weblinks: - res = self.load("http://filecrypt.cc/Link/%s.html" % link) + res = self.load("http://filecrypt.cc/Link/%s.html" % link, cookies=True) link2 = re.search('', res) - res2 = self.load(link2.group(1), just_header=True) + res2 = self.load(link2.group(1), just_header=True, cookies=True) self.links.append(res2['location']) except Exception, e: @@ -165,14 +165,17 @@ class FilecryptCc(Crypter): # Get key key = binascii.unhexlify(str(jk)) + # Decode crypted + crypted = base64.standard_b64decode(crypted) + # Decrypt Key = key IV = key obj = AES.new(Key, AES.MODE_CBC, IV) - text = obj.decrypt(crypted.decode('base64')) + text = obj.decrypt(crypted) # Extract links - text = text.replace("\x00", "").replace("\r", "") - links = filter(bool, text.split('\n')) + links = filter(lambda x: x != "", + text.replace("\x00", "").replace("\r", "").split("\n")) return links -- cgit v1.2.3 From efbbbfe6cdba907f678779c10fe6532bd1f0054e Mon Sep 17 00:00:00 2001 From: zapp-brannigan Date: Wed, 22 Apr 2015 09:45:16 +0200 Subject: Update FilecryptCc.py --- module/plugins/crypter/FilecryptCc.py | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/crypter/FilecryptCc.py b/module/plugins/crypter/FilecryptCc.py index 7679e9446..9dd4f665d 100644 --- a/module/plugins/crypter/FilecryptCc.py +++ b/module/plugins/crypter/FilecryptCc.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # http://filecrypt.cc/Container/64E039F859.html -import base64 + import binascii import re @@ -39,7 +39,7 @@ class FilecryptCc(Crypter): def decrypt(self, pyfile): - self.html = self.load(pyfile.url, cookies=True) + self.html = self.load(pyfile.url) if "content notfound" in self.html: #@NOTE: "content notfound" is NOT a typo self.offline() @@ -64,7 +64,7 @@ class FilecryptCc(Crypter): self.logInfo(_("Found %d mirrors") % len(mirror)) for i in mirror[1:]: - self.siteWithLinks = self.siteWithLinks + self.load(i, cookies=True).decode("utf-8", "replace") + self.siteWithLinks = self.siteWithLinks + self.load(i).decode("utf-8", "replace") def handlePasswordProtection(self): @@ -78,7 +78,7 @@ class FilecryptCc(Crypter): if not password: self.fail(_("Please enter the password in package section and try again")) - self.html = self.load(self.pyfile.url, post={"password": password}, cookies=True) + self.html = self.load(self.pyfile.url, post={"password": password}) def handleCaptcha(self): @@ -94,17 +94,15 @@ class FilecryptCc(Crypter): self.siteWithLinks = self.load(self.pyfile.url, post={'recaptcha_response_field': captcha_code}, - cookies=True, decode=True) elif m2: #: circle captcha self.logDebug("Captcha-URL: %s" % m2.group(1)) captcha_code = self.decryptCaptcha('https://www.filecrypt.cc/captcha/circle.php?c=abc', result_type='positional') - + self.siteWithLinks = self.load(self.pyfile.url, post={'button.x': captcha_code[0], 'button.y': captcha_code[1]}, - cookies=True, decode=True) else: @@ -140,9 +138,9 @@ class FilecryptCc(Crypter): weblinks = re.findall(self.WEBLINK_PATTERN, self.siteWithLinks) for link in weblinks: - res = self.load("http://filecrypt.cc/Link/%s.html" % link, cookies=True) + res = self.load("http://filecrypt.cc/Link/%s.html" % link) link2 = re.search('', res) - res2 = self.load(link2.group(1), just_header=True, cookies=True) + res2 = self.load(link2.group(1), just_header=True) self.links.append(res2['location']) except Exception, e: @@ -165,17 +163,14 @@ class FilecryptCc(Crypter): # Get key key = binascii.unhexlify(str(jk)) - # Decode crypted - crypted = base64.standard_b64decode(crypted) - # Decrypt Key = key IV = key obj = AES.new(Key, AES.MODE_CBC, IV) - text = obj.decrypt(crypted) + text = obj.decrypt(crypted.decode('base64')) # Extract links - links = filter(lambda x: x != "", - text.replace("\x00", "").replace("\r", "").split("\n")) + text = text.replace("\x00", "").replace("\r", "") + links = filter(bool, text.split('\n')) return links -- cgit v1.2.3 From 6f4f6a983362a8ac6037a04dfdb5c7e97aea761c Mon Sep 17 00:00:00 2001 From: Gutz-Pilz Date: Wed, 22 Apr 2015 14:39:57 +0200 Subject: remove "www" in circlecaptcha to get it working --- module/plugins/crypter/FilecryptCc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins') diff --git a/module/plugins/crypter/FilecryptCc.py b/module/plugins/crypter/FilecryptCc.py index 9dd4f665d..ca4cf57cb 100644 --- a/module/plugins/crypter/FilecryptCc.py +++ b/module/plugins/crypter/FilecryptCc.py @@ -98,7 +98,7 @@ class FilecryptCc(Crypter): elif m2: #: circle captcha self.logDebug("Captcha-URL: %s" % m2.group(1)) - captcha_code = self.decryptCaptcha('https://www.filecrypt.cc/captcha/circle.php?c=abc', + captcha_code = self.decryptCaptcha('https://filecrypt.cc/captcha/circle.php?c=abc', result_type='positional') self.siteWithLinks = self.load(self.pyfile.url, -- cgit v1.2.3 From 3e9b1980a488ff9947554c6f72fbe18637f3567e Mon Sep 17 00:00:00 2001 From: zapp-brannigan Date: Wed, 22 Apr 2015 21:02:21 +0200 Subject: [FilecryptCc.py] Avoid hardcoded urls Fix https://github.com/pyload/pyload/issues/1364 again ;) --- module/plugins/crypter/FilecryptCc.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/crypter/FilecryptCc.py b/module/plugins/crypter/FilecryptCc.py index ca4cf57cb..3c55ddd01 100644 --- a/module/plugins/crypter/FilecryptCc.py +++ b/module/plugins/crypter/FilecryptCc.py @@ -14,7 +14,7 @@ from module.plugins.internal.CaptchaService import ReCaptcha class FilecryptCc(Crypter): __name__ = "FilecryptCc" __type__ = "crypter" - __version__ = "0.12" + __version__ = "0.13" __pattern__ = r'https?://(?:www\.)?filecrypt\.cc/Container/\w+' @@ -31,7 +31,7 @@ class FilecryptCc(Crypter): CAPTCHA_PATTERN = r'' + MIRROR_PAGE_PATTERN = r'"[\w]*" href="(https?://(?:www\.)?filecrypt.cc/Container/\w+\.html\?mirror=\d+)">' def setup(self): @@ -40,6 +40,7 @@ class FilecryptCc(Crypter): def decrypt(self, pyfile): self.html = self.load(pyfile.url) + self.base_url = self.pyfile.url.split("Container")[0] if "content notfound" in self.html: #@NOTE: "content notfound" is NOT a typo self.offline() @@ -88,7 +89,7 @@ class FilecryptCc(Crypter): if m: #: normal captcha self.logDebug("Captcha-URL: %s" % m.group(1)) - captcha_code = self.decryptCaptcha(urljoin("http://filecrypt.cc", m.group(1)), + captcha_code = self.decryptCaptcha(urljoin(self.base_url, m.group(1)), forceUser=True, imgtype="gif") @@ -98,7 +99,7 @@ class FilecryptCc(Crypter): elif m2: #: circle captcha self.logDebug("Captcha-URL: %s" % m2.group(1)) - captcha_code = self.decryptCaptcha('https://filecrypt.cc/captcha/circle.php?c=abc', + captcha_code = self.decryptCaptcha('%s%s?c=abc' %(self.base_url,m2.group(1)), result_type='positional') self.siteWithLinks = self.load(self.pyfile.url, @@ -130,7 +131,7 @@ class FilecryptCc(Crypter): return for i in dlc: - self.links.append("http://filecrypt.cc/DLC/%s.dlc" % i) + self.links.append("%s/DLC/%s.dlc" % (self.base_url,i)) def handleWeblinks(self): @@ -138,7 +139,7 @@ class FilecryptCc(Crypter): weblinks = re.findall(self.WEBLINK_PATTERN, self.siteWithLinks) for link in weblinks: - res = self.load("http://filecrypt.cc/Link/%s.html" % link) + res = self.load("%s/Link/%s.html" % (self.base_url,link)) link2 = re.search('', res) res2 = self.load(link2.group(1), just_header=True) self.links.append(res2['location']) -- cgit v1.2.3 From 2e13b1e9efedfbd39bbc5a0cee8795f6c46f842b Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 22 Apr 2015 21:18:24 +0200 Subject: [FilecryptCc] Version up --- module/plugins/crypter/FilecryptCc.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/crypter/FilecryptCc.py b/module/plugins/crypter/FilecryptCc.py index ca4cf57cb..fdb65b657 100644 --- a/module/plugins/crypter/FilecryptCc.py +++ b/module/plugins/crypter/FilecryptCc.py @@ -1,5 +1,7 @@ # -*- coding: utf-8 -*- -# http://filecrypt.cc/Container/64E039F859.html +# +# Test links: +# http://filecrypt.cc/Container/64E039F859.html import binascii import re @@ -14,7 +16,7 @@ from module.plugins.internal.CaptchaService import ReCaptcha class FilecryptCc(Crypter): __name__ = "FilecryptCc" __type__ = "crypter" - __version__ = "0.12" + __version__ = "0.13" __pattern__ = r'https?://(?:www\.)?filecrypt\.cc/Container/\w+' -- cgit v1.2.3 From bc7ea571a65f01d5eb2b30d6707418e4dad25258 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 22 Apr 2015 21:32:48 +0200 Subject: [FilecryptCc] Version up (2) --- module/plugins/crypter/FilecryptCc.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/crypter/FilecryptCc.py b/module/plugins/crypter/FilecryptCc.py index 1bbe8f4fe..495efd706 100644 --- a/module/plugins/crypter/FilecryptCc.py +++ b/module/plugins/crypter/FilecryptCc.py @@ -16,7 +16,7 @@ from module.plugins.internal.CaptchaService import ReCaptcha class FilecryptCc(Crypter): __name__ = "FilecryptCc" __type__ = "crypter" - __version__ = "0.13" + __version__ = "0.14" __pattern__ = r'https?://(?:www\.)?filecrypt\.cc/Container/\w+' @@ -101,7 +101,7 @@ class FilecryptCc(Crypter): elif m2: #: circle captcha self.logDebug("Captcha-URL: %s" % m2.group(1)) - captcha_code = self.decryptCaptcha('%s%s?c=abc' %(self.base_url,m2.group(1)), + captcha_code = self.decryptCaptcha('%s%s?c=abc' %(self.base_url, m2.group(1)), result_type='positional') self.siteWithLinks = self.load(self.pyfile.url, @@ -133,7 +133,7 @@ class FilecryptCc(Crypter): return for i in dlc: - self.links.append("%s/DLC/%s.dlc" % (self.base_url,i)) + self.links.append("%s/DLC/%s.dlc" % (self.base_url, i)) def handleWeblinks(self): @@ -141,7 +141,7 @@ class FilecryptCc(Crypter): weblinks = re.findall(self.WEBLINK_PATTERN, self.siteWithLinks) for link in weblinks: - res = self.load("%s/Link/%s.html" % (self.base_url,link)) + res = self.load("%s/Link/%s.html" % (self.base_url, link)) link2 = re.search('', res) res2 = self.load(link2.group(1), just_header=True) self.links.append(res2['location']) -- cgit v1.2.3 From 6cd0159921cf420f68ad1deb17d089e67d79d802 Mon Sep 17 00:00:00 2001 From: GammaC0de Date: Fri, 24 Apr 2015 05:36:13 +0300 Subject: Update UpleaCom.py --- module/plugins/hoster/UpleaCom.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/UpleaCom.py b/module/plugins/hoster/UpleaCom.py index 59c593c93..b79456ebe 100644 --- a/module/plugins/hoster/UpleaCom.py +++ b/module/plugins/hoster/UpleaCom.py @@ -10,23 +10,26 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class UpleaCom(XFSHoster): __name__ = "UpleaCom" __type__ = "hoster" - __version__ = "0.06" + __version__ = "0.07" __pattern__ = r'https?://(?:www\.)?uplea\.com/dl/\w{15}' __description__ = """Uplea.com hoster plugin""" __license__ = "GPLv3" - __authors__ = [("Redleon", None)] + __authors__ = [("Redleon", None), + ("GammaC0de", None)] NAME_PATTERN = r'class="agmd size18">(?P.+?)<' - SIZE_PATTERN = r'size14">(?P[\d.,]+) (?P[\w^_])' + SIZE_PATTERN = r'size14">(?P[\d.,]+) (?P[\w^_]+?)' + SIZE_REPLACEMENTS = [('Ko','KB'), ('Mo','MB'), ('Go','GB')] OFFLINE_PATTERN = r'>You followed an invalid or expired link' + PREMIUM_PATTERN = r'You need to have a Premium subscription to download this file' - LINK_PATTERN = r'"(http?://\w+\.uplea\.com/anonym/.*?)"' + LINK_PATTERN = r'"(https?://\w+\.uplea\.com/anonym/.*?)"' - WAIT_PATTERN = r'timeText:([\d.]+),' + WAIT_PATTERN = r'timeText: ?([\d.]+),' STEP_PATTERN = r'
' @@ -45,9 +48,14 @@ class UpleaCom(XFSHoster): m = re.search(self.WAIT_PATTERN, self.html) if m: - self.wait(m.group(1), True) + self.logDebug(_("Waiting %s seconds") % m.group(1)) + self.wait(int(m.group(1)), True) self.retry() + m = re.search(self.PREMIUM_PATTERN, self.html) + if m: + self.error(_("This URL requires a premium account")) + m = re.search(self.LINK_PATTERN, self.html) if m is None: self.error(_("LINK_PATTERN not found")) -- cgit v1.2.3 From 76dea6e0faffbb7343b36c9230d7dee3a1db0f89 Mon Sep 17 00:00:00 2001 From: GammaC0de Date: Fri, 24 Apr 2015 05:41:28 +0300 Subject: Update UpleaCom.py --- module/plugins/hoster/UpleaCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/UpleaCom.py b/module/plugins/hoster/UpleaCom.py index b79456ebe..039d2f552 100644 --- a/module/plugins/hoster/UpleaCom.py +++ b/module/plugins/hoster/UpleaCom.py @@ -49,7 +49,7 @@ class UpleaCom(XFSHoster): m = re.search(self.WAIT_PATTERN, self.html) if m: self.logDebug(_("Waiting %s seconds") % m.group(1)) - self.wait(int(m.group(1)), True) + self.wait(m.group(1), True) self.retry() m = re.search(self.PREMIUM_PATTERN, self.html) -- cgit v1.2.3 From 1f5c090d4d7df29870b471a47dc7b29d809c62c9 Mon Sep 17 00:00:00 2001 From: GammaC0de Date: Sun, 26 Apr 2015 00:04:07 +0300 Subject: Update UpleaCom.py --- module/plugins/hoster/UpleaCom.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/UpleaCom.py b/module/plugins/hoster/UpleaCom.py index 039d2f552..65e0299ec 100644 --- a/module/plugins/hoster/UpleaCom.py +++ b/module/plugins/hoster/UpleaCom.py @@ -10,7 +10,7 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class UpleaCom(XFSHoster): __name__ = "UpleaCom" __type__ = "hoster" - __version__ = "0.07" + __version__ = "0.08" __pattern__ = r'https?://(?:www\.)?uplea\.com/dl/\w{15}' @@ -28,6 +28,7 @@ class UpleaCom(XFSHoster): PREMIUM_PATTERN = r'You need to have a Premium subscription to download this file' LINK_PATTERN = r'"(https?://\w+\.uplea\.com/anonym/.*?)"' + HOSTER_DOMAIN = "uplea.com" WAIT_PATTERN = r'timeText: ?([\d.]+),' STEP_PATTERN = r'' -- cgit v1.2.3 From b390a325d9c84f2eea0fd7307f18a18777523b13 Mon Sep 17 00:00:00 2001 From: GammaC0de Date: Mon, 27 Apr 2015 00:50:09 +0300 Subject: UpleaCom fix size calculation and Set DISPOSITION to False (temp) --- module/plugins/hoster/UpleaCom.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/UpleaCom.py b/module/plugins/hoster/UpleaCom.py index 65e0299ec..d9d1c8ef6 100644 --- a/module/plugins/hoster/UpleaCom.py +++ b/module/plugins/hoster/UpleaCom.py @@ -10,7 +10,7 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class UpleaCom(XFSHoster): __name__ = "UpleaCom" __type__ = "hoster" - __version__ = "0.08" + __version__ = "0.09" __pattern__ = r'https?://(?:www\.)?uplea\.com/dl/\w{15}' @@ -20,9 +20,11 @@ class UpleaCom(XFSHoster): ("GammaC0de", None)] + DISPOSITION = False #@TODO: Remove in 0.4.10 + NAME_PATTERN = r'class="agmd size18">(?P.+?)<' SIZE_PATTERN = r'size14">(?P[\d.,]+) (?P[\w^_]+?)' - SIZE_REPLACEMENTS = [('Ko','KB'), ('Mo','MB'), ('Go','GB')] + SIZE_REPLACEMENTS = [('ko','KB'), ('mo','MB'), ('go','GB'), ('Ko','KB'), ('Mo','MB'), ('Go','GB')] OFFLINE_PATTERN = r'>You followed an invalid or expired link' PREMIUM_PATTERN = r'You need to have a Premium subscription to download this file' -- cgit v1.2.3 From 6cb30f3923fa296ac7cb5aee9c2a935718df2529 Mon Sep 17 00:00:00 2001 From: GammaC0de Date: Wed, 29 Apr 2015 00:59:11 +0300 Subject: Update UpleaCom.py --- module/plugins/hoster/UpleaCom.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/UpleaCom.py b/module/plugins/hoster/UpleaCom.py index d9d1c8ef6..608282a60 100644 --- a/module/plugins/hoster/UpleaCom.py +++ b/module/plugins/hoster/UpleaCom.py @@ -10,7 +10,7 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class UpleaCom(XFSHoster): __name__ = "UpleaCom" __type__ = "hoster" - __version__ = "0.09" + __version__ = "0.10" __pattern__ = r'https?://(?:www\.)?uplea\.com/dl/\w{15}' @@ -22,8 +22,8 @@ class UpleaCom(XFSHoster): DISPOSITION = False #@TODO: Remove in 0.4.10 - NAME_PATTERN = r'class="agmd size18">(?P.+?)<' - SIZE_PATTERN = r'size14">(?P[\d.,]+) (?P[\w^_]+?)' + NAME_PATTERN = r'(?P.+?)' + SIZE_PATTERN = r'(?P[\d.,]+) (?P[\w^_]+?)' SIZE_REPLACEMENTS = [('ko','KB'), ('mo','MB'), ('go','GB'), ('Ko','KB'), ('Mo','MB'), ('Go','GB')] OFFLINE_PATTERN = r'>You followed an invalid or expired link' -- cgit v1.2.3 From 7c024578460b7db62de197541306ce30f5417f7e Mon Sep 17 00:00:00 2001 From: GammaC0de Date: Wed, 29 Apr 2015 11:00:09 +0300 Subject: UploadedTo - Detect Maintenance Mode --- module/plugins/hoster/UploadedTo.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py index 67f82d1f7..0bfed7d49 100644 --- a/module/plugins/hoster/UploadedTo.py +++ b/module/plugins/hoster/UploadedTo.py @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UploadedTo(SimpleHoster): __name__ = "UploadedTo" __type__ = "hoster" - __version__ = "0.86" + __version__ = "0.87" __pattern__ = r'https?://(?:www\.)?(uploaded\.(to|net)|ul\.to)(/file/|/?\?id=|.*?&id=|/)(?P\w+)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -27,6 +27,8 @@ class UploadedTo(SimpleHoster): URL_REPLACEMENTS = [(__pattern__ + ".*", r'http://uploaded.net/file/\g')] + TEMP_OFFLINE_PATTERN = r'uploaded.net - Maintenance - Wartungsarbeiten' + LINK_PREMIUM_PATTERN = r'
(\d+)' -- cgit v1.2.3 From 6f2fc4424a7cfa6e755004490488e5d92fb36389 Mon Sep 17 00:00:00 2001 From: GammaC0de Date: Wed, 29 Apr 2015 18:52:03 +0300 Subject: Update UploadedTo.py --- module/plugins/hoster/UploadedTo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py index 0bfed7d49..8a426d28d 100644 --- a/module/plugins/hoster/UploadedTo.py +++ b/module/plugins/hoster/UploadedTo.py @@ -27,7 +27,7 @@ class UploadedTo(SimpleHoster): URL_REPLACEMENTS = [(__pattern__ + ".*", r'http://uploaded.net/file/\g')] - TEMP_OFFLINE_PATTERN = r'uploaded.net - Maintenance - Wartungsarbeiten' + TEMP_OFFLINE_PATTERN = r'uploaded\.net - Maintenance - Wartungsarbeiten' LINK_PREMIUM_PATTERN = r'
Date: Wed, 29 Apr 2015 23:31:10 +0300 Subject: fix 'Content-Disposition' filename cutting first and last chars --- module/plugins/internal/SimpleHoster.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index d65d12403..f32d7c036 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -245,7 +245,7 @@ def secondsToMidnight(gmt=0): class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "1.38" + __version__ = "1.39" __pattern__ = r'^unmatchable$' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -501,7 +501,7 @@ class SimpleHoster(Hoster): try: if disposition: content = urllib2.urlopen(url).info()['Content-Disposition'].split(';') - self.pyfile.name = (content[1].split('filename=')[1][1:-1] + self.pyfile.name = (content[1].split('filename=')[1].strip('"') or urlparse.urlparse(urllib.unquote(url)).path.split('/')[-1] or self.pyfile.name) finally: -- cgit v1.2.3 From 831e1cd10f97b890d980ba0b5708284bb23b0f64 Mon Sep 17 00:00:00 2001 From: GammaC0de Date: Wed, 29 Apr 2015 23:48:34 +0300 Subject: Update SimpleHoster.py --- module/plugins/internal/SimpleHoster.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins') diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index f32d7c036..0bc529cbe 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -501,7 +501,7 @@ class SimpleHoster(Hoster): try: if disposition: content = urllib2.urlopen(url).info()['Content-Disposition'].split(';') - self.pyfile.name = (content[1].split('filename=')[1].strip('"') + self.pyfile.name = (content[1].split('filename=')[1].strip('"\'') or urlparse.urlparse(urllib.unquote(url)).path.split('/')[-1] or self.pyfile.name) finally: -- cgit v1.2.3 From cc5accb444abc29bd0e23e6a0f78cf5f5a993640 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 30 Apr 2015 19:20:11 +0200 Subject: Spare code cosmetics --- module/plugins/hoster/BasePlugin.py | 4 ++-- module/plugins/hoster/Ftp.py | 4 ++-- module/plugins/hoster/UpleaCom.py | 17 +++++++---------- module/plugins/hoster/UploadedTo.py | 2 +- 4 files changed, 12 insertions(+), 15 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py index 418f446eb..28a916fe8 100644 --- a/module/plugins/hoster/BasePlugin.py +++ b/module/plugins/hoster/BasePlugin.py @@ -13,7 +13,7 @@ from module.plugins.Hoster import Hoster class BasePlugin(Hoster): __name__ = "BasePlugin" __type__ = "hoster" - __version__ = "0.41" + __version__ = "0.42" __pattern__ = r'^unmatchable$' @@ -46,7 +46,7 @@ class BasePlugin(Hoster): try: if disposition: content = urllib2.urlopen(url).info()['Content-Disposition'].split(';') - self.pyfile.name = content[1].split('filename=')[1][1:-1] or self.pyfile.name + self.pyfile.name = content[1].split('filename=')[1].strip('"\'') or self.pyfile.name finally: return super(BasePlugin, self).download(url, get, post, ref, cookies, False) diff --git a/module/plugins/hoster/Ftp.py b/module/plugins/hoster/Ftp.py index cfe230f42..546845ca0 100644 --- a/module/plugins/hoster/Ftp.py +++ b/module/plugins/hoster/Ftp.py @@ -12,7 +12,7 @@ from module.plugins.Hoster import Hoster class Ftp(Hoster): __name__ = "Ftp" __type__ = "hoster" - __version__ = "0.49" + __version__ = "0.50" __pattern__ = r'(?:ftps?|sftp)://([\w.-]+(:[\w.-]+)?@)?[\w.-]+(:\d+)?/.+' @@ -33,7 +33,7 @@ class Ftp(Hoster): try: if disposition: content = urllib2.urlopen(url).info()['Content-Disposition'].split(';') - self.pyfile.name = content[1].split('filename=')[1][1:-1] or self.pyfile.name + self.pyfile.name = content[1].split('filename=')[1].strip('"\'') or self.pyfile.name finally: return super(Ftp, self).download(url, get, post, ref, cookies, False) diff --git a/module/plugins/hoster/UpleaCom.py b/module/plugins/hoster/UpleaCom.py index 608282a60..4538b1c16 100644 --- a/module/plugins/hoster/UpleaCom.py +++ b/module/plugins/hoster/UpleaCom.py @@ -22,18 +22,19 @@ class UpleaCom(XFSHoster): DISPOSITION = False #@TODO: Remove in 0.4.10 - NAME_PATTERN = r'(?P.+?)' - SIZE_PATTERN = r'(?P[\d.,]+) (?P[\w^_]+?)' + HOSTER_DOMAIN = "uplea.com" + SIZE_REPLACEMENTS = [('ko','KB'), ('mo','MB'), ('go','GB'), ('Ko','KB'), ('Mo','MB'), ('Go','GB')] + NAME_PATTERN = r'(?P.+?)' + SIZE_PATTERN = r'(?P[\d.,]+) (?P[\w^_]+?)' OFFLINE_PATTERN = r'>You followed an invalid or expired link' - PREMIUM_PATTERN = r'You need to have a Premium subscription to download this file' LINK_PATTERN = r'"(https?://\w+\.uplea\.com/anonym/.*?)"' - HOSTER_DOMAIN = "uplea.com" - WAIT_PATTERN = r'timeText: ?([\d.]+),' - STEP_PATTERN = r'' + PREMIUM_ONLY_PATTERN = r'You need to have a Premium subscription to download this file' + WAIT_PATTERN = r'timeText: ?([\d.]+),' + STEP_PATTERN = r'' def setup(self): @@ -55,10 +56,6 @@ class UpleaCom(XFSHoster): self.wait(m.group(1), True) self.retry() - m = re.search(self.PREMIUM_PATTERN, self.html) - if m: - self.error(_("This URL requires a premium account")) - m = re.search(self.LINK_PATTERN, self.html) if m is None: self.error(_("LINK_PATTERN not found")) diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py index 8a426d28d..75710ea8b 100644 --- a/module/plugins/hoster/UploadedTo.py +++ b/module/plugins/hoster/UploadedTo.py @@ -27,7 +27,7 @@ class UploadedTo(SimpleHoster): URL_REPLACEMENTS = [(__pattern__ + ".*", r'http://uploaded.net/file/\g')] - TEMP_OFFLINE_PATTERN = r'uploaded\.net - Maintenance - Wartungsarbeiten' + TEMP_OFFLINE_PATTERN = r'uploaded\.net - Maintenance' LINK_PREMIUM_PATTERN = r'<div class="tfree".*\s*<form method="post" action="(.+?)"' -- cgit v1.2.3 From 416acbd2adb459a04a52c3270ea0a31bfa40fd84 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@users.noreply.github.com> Date: Thu, 30 Apr 2015 22:04:29 +0200 Subject: Fix https://github.com/pyload/pyload/issues/1374 --- module/plugins/hoster/BasePlugin.py | 12 +----------- module/plugins/hoster/Ftp.py | 12 +----------- module/plugins/internal/SimpleHoster.py | 15 +-------------- 3 files changed, 3 insertions(+), 36 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py index 28a916fe8..962c8887b 100644 --- a/module/plugins/hoster/BasePlugin.py +++ b/module/plugins/hoster/BasePlugin.py @@ -13,7 +13,7 @@ from module.plugins.Hoster import Hoster class BasePlugin(Hoster): __name__ = "BasePlugin" __type__ = "hoster" - __version__ = "0.42" + __version__ = "0.43" __pattern__ = r'^unmatchable$' @@ -41,16 +41,6 @@ class BasePlugin(Hoster): self.resumeDownload = True - #: Work-around to `filename*=UTF-8` bug; remove in 0.4.10 - def download(self, url, get={}, post={}, ref=True, cookies=True, disposition=False): - try: - if disposition: - content = urllib2.urlopen(url).info()['Content-Disposition'].split(';') - self.pyfile.name = content[1].split('filename=')[1].strip('"\'') or self.pyfile.name - finally: - return super(BasePlugin, self).download(url, get, post, ref, cookies, False) - - def process(self, pyfile): """main function""" diff --git a/module/plugins/hoster/Ftp.py b/module/plugins/hoster/Ftp.py index 546845ca0..5be380078 100644 --- a/module/plugins/hoster/Ftp.py +++ b/module/plugins/hoster/Ftp.py @@ -12,7 +12,7 @@ from module.plugins.Hoster import Hoster class Ftp(Hoster): __name__ = "Ftp" __type__ = "hoster" - __version__ = "0.50" + __version__ = "0.51" __pattern__ = r'(?:ftps?|sftp)://([\w.-]+(:[\w.-]+)?@)?[\w.-]+(:\d+)?/.+' @@ -28,16 +28,6 @@ class Ftp(Hoster): self.resumeDownload = True - #: Work-around to `filename*=UTF-8` bug; remove in 0.4.10 - def download(self, url, get={}, post={}, ref=True, cookies=True, disposition=False): - try: - if disposition: - content = urllib2.urlopen(url).info()['Content-Disposition'].split(';') - self.pyfile.name = content[1].split('filename=')[1].strip('"\'') or self.pyfile.name - finally: - return super(Ftp, self).download(url, get, post, ref, cookies, False) - - def process(self, pyfile): parsed_url = urlparse(pyfile.url) netloc = parsed_url.netloc diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 0bc529cbe..df3d66ea2 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -6,7 +6,6 @@ import os import re import time import urllib -import urllib2 import urlparse from module.PyFile import statusMap as _statusMap @@ -245,7 +244,7 @@ def secondsToMidnight(gmt=0): class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "1.39" + __version__ = "1.40" __pattern__ = r'^unmatchable$' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -496,18 +495,6 @@ class SimpleHoster(Hoster): raise Fail(e) - #@NOTE: Work-around to `filename*=UTF-8` bug; remove in 0.4.10 - def download(self, url, get={}, post={}, ref=True, cookies=True, disposition=False): - try: - if disposition: - content = urllib2.urlopen(url).info()['Content-Disposition'].split(';') - self.pyfile.name = (content[1].split('filename=')[1].strip('"\'') - or urlparse.urlparse(urllib.unquote(url)).path.split('/')[-1] - or self.pyfile.name) - finally: - return super(SimpleHoster, self).download(url, get, post, ref, cookies, False) - - def downloadLink(self, link, disposition=True): if link and isinstance(link, basestring): self.correctCaptcha() -- cgit v1.2.3 From 527692a7fff612168bbcb210a6fcc838137c479c Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@users.noreply.github.com> Date: Thu, 30 Apr 2015 22:09:26 +0200 Subject: Fix https://github.com/pyload/pyload/issues/1373 --- module/plugins/crypter/Go4UpCom.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/crypter/Go4UpCom.py b/module/plugins/crypter/Go4UpCom.py index 39b85e09c..6e7d09466 100644 --- a/module/plugins/crypter/Go4UpCom.py +++ b/module/plugins/crypter/Go4UpCom.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo class Go4UpCom(SimpleCrypter): __name__ = "Go4UpCom" __type__ = "crypter" - __version__ = "0.11" + __version__ = "0.12" __pattern__ = r'http://go4up\.com/(dl/\w{12}|rd/\w{12}/\d+)' __config__ = [("use_premium" , "bool", "Use premium account if available" , True), @@ -30,10 +30,10 @@ class Go4UpCom(SimpleCrypter): OFFLINE_PATTERN = r'>\s*(404 Page Not Found|File not Found|Mirror does not exist)' - def getLinks(self + def getLinks(self): links = [] - m = re.search(r'(/download/gethosts/.+?)"') + m = re.search(r'(/download/gethosts/.+?)"', self.html) if m: self.html = self.load(urljoin("http://go4up.com/", m.group(1))) pages = [self.load(url) for url in re.findall(self.LINK_PATTERN, self.html)] -- cgit v1.2.3 From 1ef93e913238275f7657d496ba3d2e7eeb5a30a2 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@users.noreply.github.com> Date: Fri, 1 May 2015 01:06:01 +0200 Subject: Use 'import' instead 'from' --- module/plugins/accounts/FilefactoryCom.py | 5 ++--- module/plugins/accounts/LinksnappyCom.py | 6 +++--- module/plugins/accounts/OboomCom.py | 3 +-- module/plugins/accounts/OneFichierCom.py | 5 ++--- module/plugins/accounts/SmoozedCom.py | 1 + module/plugins/accounts/UlozTo.py | 5 ++--- module/plugins/accounts/WebshareCz.py | 6 +++--- module/plugins/captcha/LinksaveIn.py | 9 ++++----- module/plugins/container/CCF.py | 8 +++----- module/plugins/crypter/CloudzillaToFolder.py | 3 +-- module/plugins/crypter/DailymotionComFolder.py | 5 ++--- module/plugins/crypter/DevhostStFolder.py | 5 ++--- module/plugins/crypter/FilecryptCc.py | 4 ++-- module/plugins/crypter/Go4UpCom.py | 5 ++--- module/plugins/crypter/MultiUpOrg.py | 4 ++-- module/plugins/crypter/SafelinkingNet.py | 2 -- module/plugins/crypter/TusfilesNetFolder.py | 4 ++-- module/plugins/crypter/UploadedToFolder.py | 5 ++--- module/plugins/crypter/YoutubeComFolder.py | 5 ++--- module/plugins/hooks/BypassCaptcha.py | 6 +++--- module/plugins/hooks/CaptchaBrotherhood.py | 11 +++++------ module/plugins/hooks/Checksum.py | 14 ++++++-------- module/plugins/hooks/DeathByCaptcha.py | 6 +++--- module/plugins/hooks/ExpertDecoders.py | 9 +++++---- module/plugins/hooks/IRCInterface.py | 4 ++-- module/plugins/hooks/ImageTyperz.py | 6 +++--- module/plugins/hooks/SkipRev.py | 6 +++--- module/plugins/hoster/AlldebridCom.py | 4 +--- module/plugins/hoster/BasePlugin.py | 13 ++++++------- module/plugins/hoster/DepositfilesCom.py | 5 ++--- module/plugins/hoster/FastixRu.py | 4 +--- module/plugins/hoster/FastshareCz.py | 7 +++---- module/plugins/hoster/FileSharkPl.py | 5 ++--- module/plugins/hoster/FilefactoryCom.py | 3 +-- module/plugins/hoster/FilerNet.py | 3 +-- module/plugins/hoster/FlyFilesNet.py | 5 ++--- module/plugins/hoster/FshareVn.py | 5 ++--- module/plugins/hoster/Ftp.py | 13 ++++++------- module/plugins/hoster/GigapetaCom.py | 11 +++++------ module/plugins/hoster/HellshareCz.py | 2 +- module/plugins/hoster/Keep2ShareCc.py | 5 ++--- module/plugins/hoster/LetitbitNet.py | 5 ++--- module/plugins/hoster/LinksnappyCom.py | 5 ++--- module/plugins/hoster/MegaCoNz.py | 16 ++++++++-------- module/plugins/hoster/MegaDebridEu.py | 3 +-- module/plugins/hoster/MegaRapidCz.py | 5 ++--- module/plugins/hoster/MegaRapidoNet.py | 4 ++-- module/plugins/hoster/MultishareCz.py | 5 ++--- module/plugins/hoster/NarodRu.py | 5 ++--- module/plugins/hoster/NetloadIn.py | 5 ++--- module/plugins/hoster/OverLoadMe.py | 4 +--- module/plugins/hoster/PremiumTo.py | 4 ++-- module/plugins/hoster/QuickshareCz.py | 7 +++---- module/plugins/hoster/RapidgatorNet.py | 7 +++---- module/plugins/hoster/RapiduNet.py | 5 ++--- module/plugins/hoster/RealdebridCom.py | 4 +--- module/plugins/hoster/RehostTo.py | 2 +- module/plugins/hoster/ShareonlineBiz.py | 7 +++---- module/plugins/hoster/ShareplaceCom.py | 5 ++--- module/plugins/hoster/SpeedyshareCom.py | 3 +-- module/plugins/hoster/TurbobitNet.py | 16 ++++++++-------- module/plugins/hoster/UnibytesCom.py | 14 ++++++-------- module/plugins/hoster/UpleaCom.py | 5 ++--- module/plugins/hoster/UploadheroCom.py | 7 +++---- module/plugins/hoster/UploadingCom.py | 5 ++--- module/plugins/hoster/WrzucTo.py | 5 ++--- module/plugins/hoster/XHamsterCom.py | 5 ++--- module/plugins/hoster/XVideosCom.py | 5 ++--- module/plugins/hoster/Xdcc.py | 2 -- module/plugins/hoster/YourfilesTo.py | 6 ++---- module/plugins/hoster/YoutubeCom.py | 6 ++---- module/plugins/hoster/ZeveraCom.py | 3 +-- module/plugins/internal/CaptchaService.py | 12 ++++++------ module/plugins/internal/SimpleCrypter.py | 7 +++---- module/plugins/internal/SimpleDereferer.py | 5 ++--- module/plugins/internal/XFSAccount.py | 5 ++--- module/plugins/internal/XFSHoster.py | 15 ++++++--------- 77 files changed, 196 insertions(+), 265 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/accounts/FilefactoryCom.py b/module/plugins/accounts/FilefactoryCom.py index f07f4895a..37b6f97a8 100644 --- a/module/plugins/accounts/FilefactoryCom.py +++ b/module/plugins/accounts/FilefactoryCom.py @@ -1,10 +1,9 @@ # -*- coding: utf-8 -*- +import pycurl import re import time -from pycurl import REFERER - from module.plugins.Account import Account @@ -38,7 +37,7 @@ class FilefactoryCom(Account): def login(self, user, data, req): - req.http.c.setopt(REFERER, "http://www.filefactory.com/member/login.php") + req.http.c.setopt(pycurl.REFERER, "http://www.filefactory.com/member/login.php") html = req.load("http://www.filefactory.com/member/signin.php", post={"loginEmail" : user, diff --git a/module/plugins/accounts/LinksnappyCom.py b/module/plugins/accounts/LinksnappyCom.py index 97e368285..34571d374 100644 --- a/module/plugins/accounts/LinksnappyCom.py +++ b/module/plugins/accounts/LinksnappyCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from hashlib import md5 +import hashlib from module.plugins.Account import Account from module.common.json_layer import json_loads @@ -18,7 +18,7 @@ class LinksnappyCom(Account): def loadAccountInfo(self, user, req): data = self.getAccountData(user) r = req.load('http://gen.linksnappy.com/lseAPI.php', - get={'act': 'USERDETAILS', 'username': user, 'password': md5(data['password']).hexdigest()}) + get={'act': 'USERDETAILS', 'username': user, 'password': hashlib.md5(data['password']).hexdigest()}) self.logDebug("JSON data: " + r) @@ -50,7 +50,7 @@ class LinksnappyCom(Account): r = req.load("http://gen.linksnappy.com/lseAPI.php", get={'act' : 'USERDETAILS', 'username': user, - 'password': md5(data['password']).hexdigest()}, + 'password': hashlib.md5(data['password']).hexdigest()}, decode=True) if 'Invalid Account Details' in r: diff --git a/module/plugins/accounts/OboomCom.py b/module/plugins/accounts/OboomCom.py index a9068f1df..020a45ba7 100644 --- a/module/plugins/accounts/OboomCom.py +++ b/module/plugins/accounts/OboomCom.py @@ -1,13 +1,12 @@ # -*- coding: utf-8 -*- -import time - try: from beaker.crypto.pbkdf2 import PBKDF2 except ImportError: from beaker.crypto.pbkdf2 import pbkdf2 from binascii import b2a_hex + class PBKDF2(object): def __init__(self, passphrase, salt, iterations=1000): self.passphrase = passphrase diff --git a/module/plugins/accounts/OneFichierCom.py b/module/plugins/accounts/OneFichierCom.py index be4b5e67e..b19e2bc69 100644 --- a/module/plugins/accounts/OneFichierCom.py +++ b/module/plugins/accounts/OneFichierCom.py @@ -1,10 +1,9 @@ # -*- coding: utf-8 -*- +import pycurl import re import time -from pycurl import REFERER - from module.plugins.Account import Account @@ -45,7 +44,7 @@ class OneFichierCom(Account): def login(self, user, data, req): - req.http.c.setopt(REFERER, "https://1fichier.com/login.pl?lg=en") + req.http.c.setopt(pycurl.REFERER, "https://1fichier.com/login.pl?lg=en") html = req.load("https://1fichier.com/login.pl?lg=en", post={'mail' : user, diff --git a/module/plugins/accounts/SmoozedCom.py b/module/plugins/accounts/SmoozedCom.py index 3c8226704..56cd1864a 100644 --- a/module/plugins/accounts/SmoozedCom.py +++ b/module/plugins/accounts/SmoozedCom.py @@ -9,6 +9,7 @@ try: except ImportError: from beaker.crypto.pbkdf2 import pbkdf2 from binascii import b2a_hex + class PBKDF2(object): def __init__(self, passphrase, salt, iterations=1000): self.passphrase = passphrase diff --git a/module/plugins/accounts/UlozTo.py b/module/plugins/accounts/UlozTo.py index 6ddb34385..f95c8834b 100644 --- a/module/plugins/accounts/UlozTo.py +++ b/module/plugins/accounts/UlozTo.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urlparse import urljoin +import urlparse from module.plugins.Account import Account @@ -37,7 +36,7 @@ class UlozTo(Account): action = re.findall('<form action="(.+?)"', login_page)[1].replace('&', '&') token = re.search('_token_" value="(.+?)"', login_page).group(1) - html = req.load(urljoin("http://www.ulozto.net/", action), + html = req.load(urlparse.urljoin("http://www.ulozto.net/", action), post={'_token_' : token, 'do' : "loginForm-submit", 'login' : u"Přihlásit", diff --git a/module/plugins/accounts/WebshareCz.py b/module/plugins/accounts/WebshareCz.py index 3c5f45d34..f032e2317 100644 --- a/module/plugins/accounts/WebshareCz.py +++ b/module/plugins/accounts/WebshareCz.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- +import hashlib import re import time -from hashlib import md5, sha1 from passlib.hash import md5_crypt from module.plugins.Account import Account @@ -51,8 +51,8 @@ class WebshareCz(Account): self.wrongPassword() salt = re.search('<salt>(.+)</salt>', salt).group(1) - password = sha1(md5_crypt.encrypt(data["password"], salt=salt)).hexdigest() - digest = md5(user + ":Webshare:" + password).hexdigest() + password = hashlib.sha1(md5_crypt.encrypt(data["password"], salt=salt)).hexdigest() + digest = hashlib.md5(user + ":Webshare:" + password).hexdigest() login = req.load("https://webshare.cz/api/login/", post={'digest' : digest, diff --git a/module/plugins/captcha/LinksaveIn.py b/module/plugins/captcha/LinksaveIn.py index e256da502..95b107977 100644 --- a/module/plugins/captcha/LinksaveIn.py +++ b/module/plugins/captcha/LinksaveIn.py @@ -5,9 +5,8 @@ try: except ImportError: import Image -from glob import glob -from os import sep -from os.path import abspath, dirname +import glob +import os from module.plugins.captcha.OCR import OCR @@ -24,7 +23,7 @@ class LinksaveIn(OCR): def __init__(self): OCR.__init__(self) - self.data_dir = dirname(abspath(__file__)) + sep + "LinksaveIn" + sep + self.data_dir = os.path.dirname(os.path.abspath(__file__)) + os.sep + "LinksaveIn" + os.sep def load_image(self, image): @@ -59,7 +58,7 @@ class LinksaveIn(OCR): stat = {} cstat = {} img = self.image.convert("P") - for bgpath in glob(self.data_dir+"bg/*.gif"): + for bgpath in glob.glob(self.data_dir+"bg/*.gif"): stat[bgpath] = 0 bg = Image.open(bgpath) diff --git a/module/plugins/container/CCF.py b/module/plugins/container/CCF.py index 79d7879a7..235d5dc1d 100644 --- a/module/plugins/container/CCF.py +++ b/module/plugins/container/CCF.py @@ -2,11 +2,9 @@ from __future__ import with_statement +import MultipartPostHandler import re - -from urllib2 import build_opener - -from MultipartPostHandler import MultipartPostHandler +import urllib2 from module.plugins.Container import Container from module.utils import fs_encode, save_join @@ -27,7 +25,7 @@ class CCF(Container): def decrypt(self, pyfile): fs_filename = fs_encode(pyfile.url.strip()) - opener = build_opener(MultipartPostHandler) + opener = urllib2.build_opener(MultipartPostHandler.MultipartPostHandler) dlc_content = opener.open('http://service.jdownloader.net/dlcrypt/getDLC.php', {'src' : "ccf", diff --git a/module/plugins/crypter/CloudzillaToFolder.py b/module/plugins/crypter/CloudzillaToFolder.py index 76019d928..96d7245f1 100644 --- a/module/plugins/crypter/CloudzillaToFolder.py +++ b/module/plugins/crypter/CloudzillaToFolder.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urlparse import urljoin +import urlparse from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo diff --git a/module/plugins/crypter/DailymotionComFolder.py b/module/plugins/crypter/DailymotionComFolder.py index 5c078000a..01caa0bb8 100644 --- a/module/plugins/crypter/DailymotionComFolder.py +++ b/module/plugins/crypter/DailymotionComFolder.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urlparse import urljoin +import urlparse from module.common.json_layer import json_loads from module.plugins.Crypter import Crypter @@ -24,7 +23,7 @@ class DailymotionComFolder(Crypter): def api_response(self, ref, req=None): - url = urljoin("https://api.dailymotion.com/", ref) + url = urlparse.urljoin("https://api.dailymotion.com/", ref) html = self.load(url, get=req) return json_loads(html) diff --git a/module/plugins/crypter/DevhostStFolder.py b/module/plugins/crypter/DevhostStFolder.py index 5cafbf6b8..4d15e2058 100644 --- a/module/plugins/crypter/DevhostStFolder.py +++ b/module/plugins/crypter/DevhostStFolder.py @@ -4,8 +4,7 @@ # http://d-h.st/users/shine/?fld_id=37263#files import re - -from urlparse import urljoin +import urlparse from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo @@ -42,7 +41,7 @@ class DevhostStFolder(SimpleCrypter): p = r'href="(.+?)">Back to \w+<' m = re.search(p, self.html) - html = self.load(urljoin("http://d-h.st", m.group(1)), + html = self.load(urlparse.urljoin("http://d-h.st", m.group(1)), cookies=False) p = '\?fld_id=%s.*?">(.+?)<' % self.info['pattern']['ID'] diff --git a/module/plugins/crypter/FilecryptCc.py b/module/plugins/crypter/FilecryptCc.py index 495efd706..a1a94b6f6 100644 --- a/module/plugins/crypter/FilecryptCc.py +++ b/module/plugins/crypter/FilecryptCc.py @@ -5,9 +5,9 @@ import binascii import re +import urlparse from Crypto.Cipher import AES -from urlparse import urljoin from module.plugins.Crypter import Crypter from module.plugins.internal.CaptchaService import ReCaptcha @@ -91,7 +91,7 @@ class FilecryptCc(Crypter): if m: #: normal captcha self.logDebug("Captcha-URL: %s" % m.group(1)) - captcha_code = self.decryptCaptcha(urljoin(self.base_url, m.group(1)), + captcha_code = self.decryptCaptcha(urlparse.urljoin(self.base_url, m.group(1)), forceUser=True, imgtype="gif") diff --git a/module/plugins/crypter/Go4UpCom.py b/module/plugins/crypter/Go4UpCom.py index 6e7d09466..22f31f6f6 100644 --- a/module/plugins/crypter/Go4UpCom.py +++ b/module/plugins/crypter/Go4UpCom.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urlparse import urljoin +import urlparse from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo @@ -35,7 +34,7 @@ class Go4UpCom(SimpleCrypter): m = re.search(r'(/download/gethosts/.+?)"', self.html) if m: - self.html = self.load(urljoin("http://go4up.com/", m.group(1))) + self.html = self.load(urlparse.urljoin("http://go4up.com/", m.group(1))) pages = [self.load(url) for url in re.findall(self.LINK_PATTERN, self.html)] else: pages = [self.html] diff --git a/module/plugins/crypter/MultiUpOrg.py b/module/plugins/crypter/MultiUpOrg.py index 3f9e819eb..b676c3029 100644 --- a/module/plugins/crypter/MultiUpOrg.py +++ b/module/plugins/crypter/MultiUpOrg.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import re -from urlparse import urljoin +import urlparse from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo @@ -33,7 +33,7 @@ class MultiUpOrg(SimpleCrypter): pattern = r'style="width:97%;text-align:left".*\n.*href="(.*)"' if m_type == "download": dl_pattern = r'href="(.*)">.*\n.*<h5>DOWNLOAD</h5>' - miror_page = urljoin("http://www.multiup.org", re.search(dl_pattern, self.html).group(1)) + miror_page = urlparse.urljoin("http://www.multiup.org", re.search(dl_pattern, self.html).group(1)) self.html = self.load(miror_page) return re.findall(pattern, self.html) diff --git a/module/plugins/crypter/SafelinkingNet.py b/module/plugins/crypter/SafelinkingNet.py index 34a45ea6e..7f0915065 100644 --- a/module/plugins/crypter/SafelinkingNet.py +++ b/module/plugins/crypter/SafelinkingNet.py @@ -2,8 +2,6 @@ import re -from pycurl import FOLLOWLOCATION - from BeautifulSoup import BeautifulSoup from module.common.json_layer import json_loads diff --git a/module/plugins/crypter/TusfilesNetFolder.py b/module/plugins/crypter/TusfilesNetFolder.py index 47cc973f0..1cc505b81 100644 --- a/module/plugins/crypter/TusfilesNetFolder.py +++ b/module/plugins/crypter/TusfilesNetFolder.py @@ -2,7 +2,7 @@ import math import re -from urlparse import urljoin +import urlparse from module.plugins.internal.XFSCrypter import XFSCrypter, create_getInfo @@ -28,7 +28,7 @@ class TusfilesNetFolder(XFSCrypter): def loadPage(self, page_n): - return self.load(urljoin(self.pyfile.url, str(page_n)), decode=True) + return self.load(urlparse.urljoin(self.pyfile.url, str(page_n)), decode=True) def handlePages(self, pyfile): diff --git a/module/plugins/crypter/UploadedToFolder.py b/module/plugins/crypter/UploadedToFolder.py index b86c66bf7..d54ed47eb 100644 --- a/module/plugins/crypter/UploadedToFolder.py +++ b/module/plugins/crypter/UploadedToFolder.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urlparse import urljoin +import urlparse from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo @@ -31,7 +30,7 @@ class UploadedToFolder(SimpleCrypter): if m is None: self.error(_("PLAIN_PATTERN not found")) - plain_link = urljoin("http://uploaded.net/", m.group(1)) + plain_link = urlparse.urljoin("http://uploaded.net/", m.group(1)) return self.load(plain_link).split('\n')[:-1] diff --git a/module/plugins/crypter/YoutubeComFolder.py b/module/plugins/crypter/YoutubeComFolder.py index d7ca494fa..a2b02b2f1 100644 --- a/module/plugins/crypter/YoutubeComFolder.py +++ b/module/plugins/crypter/YoutubeComFolder.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urlparse import urljoin +import urlparse from module.common.json_layer import json_loads from module.plugins.Crypter import Crypter @@ -31,7 +30,7 @@ class YoutubeComFolder(Crypter): def api_response(self, ref, req): req.update({"key": self.API_KEY}) - url = urljoin("https://www.googleapis.com/youtube/v3/", ref) + url = urlparse.urljoin("https://www.googleapis.com/youtube/v3/", ref) html = self.load(url, get=req) return json_loads(html) diff --git a/module/plugins/hooks/BypassCaptcha.py b/module/plugins/hooks/BypassCaptcha.py index 3c8f72524..9e01edfa2 100644 --- a/module/plugins/hooks/BypassCaptcha.py +++ b/module/plugins/hooks/BypassCaptcha.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pycurl import FORM_FILE, LOW_SPEED_TIME +import pycurl from module.network.HTTPRequest import BadHeader from module.network.RequestFactory import getURL, getRequest @@ -64,14 +64,14 @@ class BypassCaptcha(Hook): req = getRequest() #raise timeout threshold - req.c.setopt(LOW_SPEED_TIME, 80) + req.c.setopt(pycurl.LOW_SPEED_TIME, 80) try: res = req.load(self.SUBMIT_URL, post={'vendor_key': self.PYLOAD_KEY, 'key': self.getConfig('passkey'), 'gen_task_id': "1", - 'file': (FORM_FILE, captcha)}, + 'file': (pycurl.FORM_FILE, captcha)}, multipart=True) finally: req.close() diff --git a/module/plugins/hooks/CaptchaBrotherhood.py b/module/plugins/hooks/CaptchaBrotherhood.py index e5285a493..bda080037 100644 --- a/module/plugins/hooks/CaptchaBrotherhood.py +++ b/module/plugins/hooks/CaptchaBrotherhood.py @@ -5,14 +5,13 @@ from __future__ import with_statement import StringIO import pycurl import time +import urllib try: from PIL import Image except ImportError: import Image -from urllib import urlencode - from module.network.RequestFactory import getURL, getRequest from module.plugins.Hook import Hook, threaded @@ -90,10 +89,10 @@ class CaptchaBrotherhood(Hook): req = getRequest() url = "%ssendNewCaptcha.aspx?%s" % (self.API_URL, - urlencode({'username' : self.getConfig('username'), - 'password' : self.getConfig('passkey'), - 'captchaSource': "pyLoad", - 'timeout' : "80"})) + urllib.urlencode({'username' : self.getConfig('username'), + 'password' : self.getConfig('passkey'), + 'captchaSource': "pyLoad", + 'timeout' : "80"})) req.c.setopt(pycurl.URL, url) req.c.setopt(pycurl.POST, 1) diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py index 4ad17f55a..ab7daf701 100644 --- a/module/plugins/hooks/Checksum.py +++ b/module/plugins/hooks/Checksum.py @@ -3,12 +3,10 @@ from __future__ import with_statement import hashlib +import os import re import zlib -from os import remove -from os.path import getsize, isfile, splitext - from module.plugins.Hook import Hook from module.utils import save_join, fs_encode @@ -109,13 +107,13 @@ class Checksum(Hook): #download_folder = self.config['general']['download_folder'] #local_file = fs_encode(save_join(download_folder, pyfile.package().folder, pyfile.name)) - if not isfile(local_file): + if not os.path.isfile(local_file): self.checkFailed(pyfile, None, "File does not exist") # validate file size if "size" in data: api_size = int(data['size']) - file_size = getsize(local_file) + file_size = os.path.getsize(local_file) if api_size != file_size: self.logWarning(_("File %s has incorrect size: %d B (%d expected)") % (pyfile.name, file_size, api_size)) @@ -157,7 +155,7 @@ class Checksum(Hook): retry_action = self.getConfig('retry_action') if pyfile.plugin.retries < max_tries: if local_file: - remove(local_file) + os.remove(local_file) pyfile.plugin.retry(max_tries, self.getConfig('wait_time'), msg) elif retry_action == "nothing": return @@ -170,13 +168,13 @@ class Checksum(Hook): download_folder = save_join(self.config['general']['download_folder'], pypack.folder, "") for link in pypack.getChildren().itervalues(): - file_type = splitext(link['name'])[1][1:].lower() + file_type = os.path.splitext(link['name'])[1][1:].lower() if file_type not in self.formats: continue hash_file = fs_encode(save_join(download_folder, link['name'])) - if not isfile(hash_file): + if not os.path.isfile(hash_file): self.logWarning(_("File not found"), link['name']) continue diff --git a/module/plugins/hooks/DeathByCaptcha.py b/module/plugins/hooks/DeathByCaptcha.py index 501de0c1a..f9618f011 100644 --- a/module/plugins/hooks/DeathByCaptcha.py +++ b/module/plugins/hooks/DeathByCaptcha.py @@ -2,11 +2,11 @@ from __future__ import with_statement +import pycurl import re import time from base64 import b64encode -from pycurl import FORM_FILE, HTTPHEADER from module.common.json_layer import json_loads from module.network.HTTPRequest import BadHeader @@ -74,7 +74,7 @@ class DeathByCaptcha(Hook): def api_response(self, api="captcha", post=False, multipart=False): req = getRequest() - req.c.setopt(HTTPHEADER, ["Accept: application/json", "User-Agent: pyLoad %s" % self.core.version]) + req.c.setopt(pycurl.HTTPHEADER, ["Accept: application/json", "User-Agent: pyLoad %s" % self.core.version]) if post: if not isinstance(post, dict): @@ -135,7 +135,7 @@ class DeathByCaptcha(Hook): #@NOTE: Workaround multipart-post bug in HTTPRequest.py if re.match("^\w*$", self.getConfig('passkey')): multipart = True - data = (FORM_FILE, captcha) + data = (pycurl.FORM_FILE, captcha) else: multipart = False with open(captcha, 'rb') as f: diff --git a/module/plugins/hooks/ExpertDecoders.py b/module/plugins/hooks/ExpertDecoders.py index 79e98c020..ccd48f664 100644 --- a/module/plugins/hooks/ExpertDecoders.py +++ b/module/plugins/hooks/ExpertDecoders.py @@ -2,9 +2,10 @@ from __future__ import with_statement +import pycurl +import uuid + from base64 import b64encode -from pycurl import LOW_SPEED_TIME -from uuid import uuid4 from module.network.HTTPRequest import BadHeader from module.network.RequestFactory import getURL, getRequest @@ -48,7 +49,7 @@ class ExpertDecoders(Hook): @threaded def _processCaptcha(self, task): - task.data['ticket'] = ticket = uuid4() + task.data['ticket'] = ticket = uuid.uuid4() result = None with open(task.captchaFile, 'rb') as f: @@ -56,7 +57,7 @@ class ExpertDecoders(Hook): req = getRequest() #raise timeout threshold - req.c.setopt(LOW_SPEED_TIME, 80) + req.c.setopt(pycurl.LOW_SPEED_TIME, 80) try: result = req.load(self.API_URL, diff --git a/module/plugins/hooks/IRCInterface.py b/module/plugins/hooks/IRCInterface.py index 9e2f670e6..33fde3d20 100644 --- a/module/plugins/hooks/IRCInterface.py +++ b/module/plugins/hooks/IRCInterface.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- +import pycurl import re import socket import ssl import time import traceback -from pycurl import FORM_FILE from select import select from threading import Thread @@ -77,7 +77,7 @@ class IRCInterface(Thread, Hook): task.setWaiting(60) html = getURL("http://www.freeimagehosting.net/upload.php", - post={"attached": (FORM_FILE, task.captchaFile)}, multipart=True) + post={"attached": (pycurl.FORM_FILE, task.captchaFile)}, multipart=True) url = re.search(r"\[img\]([^\[]+)\[/img\]\[/url\]", html).group(1) self.response(_("New Captcha Request: %s") % url) diff --git a/module/plugins/hooks/ImageTyperz.py b/module/plugins/hooks/ImageTyperz.py index 132ab2e02..f1fcacb71 100644 --- a/module/plugins/hooks/ImageTyperz.py +++ b/module/plugins/hooks/ImageTyperz.py @@ -2,10 +2,10 @@ from __future__ import with_statement +import pycurl import re from base64 import b64encode -from pycurl import FORM_FILE, LOW_SPEED_TIME from module.network.RequestFactory import getURL, getRequest from module.plugins.Hook import Hook, threaded @@ -76,13 +76,13 @@ class ImageTyperz(Hook): def submit(self, captcha, captchaType="file", match=None): req = getRequest() #raise timeout threshold - req.c.setopt(LOW_SPEED_TIME, 80) + req.c.setopt(pycurl.LOW_SPEED_TIME, 80) try: #@NOTE: Workaround multipart-post bug in HTTPRequest.py if re.match("^\w*$", self.getConfig('passkey')): multipart = True - data = (FORM_FILE, captcha) + data = (pycurl.FORM_FILE, captcha) else: multipart = False with open(captcha, 'rb') as f: diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py index 157b55bbd..7901ca540 100644 --- a/module/plugins/hooks/SkipRev.py +++ b/module/plugins/hooks/SkipRev.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- import re +import urllib +import urlparse from types import MethodType -from urllib import unquote -from urlparse import urlparse from module.PyFile import PyFile from module.plugins.Hook import Hook @@ -43,7 +43,7 @@ class SkipRev(Hook): return pyfile.pluginmodule.getInfo([pyfile.url]).next()[0] else: self.logWarning("Unable to grab file name") - return urlparse(unquote(pyfile.url)).path.split('/')[-1] + return urlparse.urlparse(urllib.unquote(pyfile.url)).path.split('/')[-1] def _pyfile(self, link): diff --git a/module/plugins/hoster/AlldebridCom.py b/module/plugins/hoster/AlldebridCom.py index 51fdad757..2ed09f58c 100644 --- a/module/plugins/hoster/AlldebridCom.py +++ b/module/plugins/hoster/AlldebridCom.py @@ -1,9 +1,7 @@ # -*- coding: utf-8 -*- import re - -from random import randrange -from urllib import unquote +import urllib from module.common.json_layer import json_loads from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py index 962c8887b..2228516aa 100644 --- a/module/plugins/hoster/BasePlugin.py +++ b/module/plugins/hoster/BasePlugin.py @@ -1,9 +1,8 @@ # -*- coding: utf-8 -*- import re - -from urllib import unquote -from urlparse import urljoin, urlparse +import urllib +import urlparse from module.network.HTTPRequest import BadHeader from module.plugins.internal.SimpleHoster import create_getInfo, getFileURL @@ -25,8 +24,8 @@ class BasePlugin(Hoster): @classmethod def getInfo(cls, url="", html=""): #@TODO: Move to hoster class in 0.4.10 - url = unquote(url) - url_p = urlparse(url) + url = urllib.unquote(url) + url_p = urlparse.urlparse(url) return {'name' : (url_p.path.split('/')[-1] or url_p.query.split('=', 1)[::-1][0].split('&', 1)[0] or url_p.netloc.split('.', 1)[0]), @@ -51,7 +50,7 @@ class BasePlugin(Hoster): for _i in xrange(5): try: - link = getFileURL(self, unquote(pyfile.url)) + link = getFileURL(self, urllib.unquote(pyfile.url)) if link: self.download(link, ref=False, disposition=True) @@ -67,7 +66,7 @@ class BasePlugin(Hoster): account = self.core.accountManager.getAccountPlugin('Http') servers = [x['login'] for x in account.getAllAccounts()] - server = urlparse(pyfile.url).netloc + server = urlparse.urlparse(pyfile.url).netloc if server in servers: self.logDebug("Logging on to %s" % server) diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py index cc24e351e..8559bbc36 100644 --- a/module/plugins/hoster/DepositfilesCom.py +++ b/module/plugins/hoster/DepositfilesCom.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urllib import unquote +import urllib from module.plugins.internal.CaptchaService import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -67,7 +66,7 @@ class DepositfilesCom(SimpleHoster): m = re.search(self.LINK_FREE_PATTERN, self.html) if m: - self.link = unquote(m.group(1)) + self.link = urllib.unquote(m.group(1)) def handlePremium(self, pyfile): diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py index 0dc12568d..cc50f4229 100644 --- a/module/plugins/hoster/FastixRu.py +++ b/module/plugins/hoster/FastixRu.py @@ -1,9 +1,7 @@ # -*- coding: utf-8 -*- import re - -from random import randrange -from urllib import unquote +import urllib from module.common.json_layer import json_loads from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo diff --git a/module/plugins/hoster/FastshareCz.py b/module/plugins/hoster/FastshareCz.py index cede2e906..330a6e3b9 100644 --- a/module/plugins/hoster/FastshareCz.py +++ b/module/plugins/hoster/FastshareCz.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urlparse import urljoin +import urlparse from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -55,8 +54,8 @@ class FastshareCz(SimpleHoster): self.error(_("FREE_URL_PATTERN not found")) baseurl = "http://www.fastshare.cz" - captcha = self.decryptCaptcha(urljoin(baseurl, captcha_src)) - self.download(urljoin(baseurl, action), post={'code': captcha, 'btn.x': 77, 'btn.y': 18}) + captcha = self.decryptCaptcha(urlparse.urljoin(baseurl, captcha_src)) + self.download(urlparse.urljoin(baseurl, action), post={'code': captcha, 'btn.x': 77, 'btn.y': 18}) def checkFile(self, rules={}): diff --git a/module/plugins/hoster/FileSharkPl.py b/module/plugins/hoster/FileSharkPl.py index 9f6070806..de030be9c 100644 --- a/module/plugins/hoster/FileSharkPl.py +++ b/module/plugins/hoster/FileSharkPl.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urlparse import urljoin +import urlparse from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -78,7 +77,7 @@ class FileSharkPl(SimpleHoster): if m is None: self.error(_("Download url not found")) - link = urljoin("http://fileshark.pl", m.group(1)) + link = urlparse.urljoin("http://fileshark.pl", m.group(1)) self.html = self.load(link) diff --git a/module/plugins/hoster/FilefactoryCom.py b/module/plugins/hoster/FilefactoryCom.py index 606fb25f0..0a9d5e2cc 100644 --- a/module/plugins/hoster/FilefactoryCom.py +++ b/module/plugins/hoster/FilefactoryCom.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urlparse import urljoin +import urlparse from module.network.RequestFactory import getURL from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo diff --git a/module/plugins/hoster/FilerNet.py b/module/plugins/hoster/FilerNet.py index 22ca3725a..156392c79 100644 --- a/module/plugins/hoster/FilerNet.py +++ b/module/plugins/hoster/FilerNet.py @@ -6,8 +6,7 @@ import pycurl import re - -from urlparse import urljoin +import urlparse from module.plugins.internal.CaptchaService import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo diff --git a/module/plugins/hoster/FlyFilesNet.py b/module/plugins/hoster/FlyFilesNet.py index 4420d5d60..689eb3c66 100644 --- a/module/plugins/hoster/FlyFilesNet.py +++ b/module/plugins/hoster/FlyFilesNet.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urllib import unquote +import urllib from module.network.RequestFactory import getURL from module.plugins.internal.SimpleHoster import SimpleHoster @@ -26,7 +25,7 @@ class FlyFilesNet(SimpleHoster): def process(self, pyfile): name = re.search(self.NAME_PATTERN, pyfile.url).group(1) - pyfile.name = unquote_plus(name) + pyfile.name = urllib.unquote_plus(name) session = re.search(self.SESSION_PATTERN, pyfile.url).group(1) diff --git a/module/plugins/hoster/FshareVn.py b/module/plugins/hoster/FshareVn.py index 77d122e8e..50128db10 100644 --- a/module/plugins/hoster/FshareVn.py +++ b/module/plugins/hoster/FshareVn.py @@ -2,8 +2,7 @@ import re import time - -from urlparse import urljoin +import urlparse from module.network.RequestFactory import getURL from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo @@ -59,7 +58,7 @@ class FshareVn(SimpleHoster): self.checkErrors() action, inputs = self.parseHtmlForm('frm_download') - url = urljoin(pyfile.url, action) + url = urlparse.urljoin(pyfile.url, action) if not inputs: self.error(_("No FORM")) diff --git a/module/plugins/hoster/Ftp.py b/module/plugins/hoster/Ftp.py index 5be380078..5258a1c27 100644 --- a/module/plugins/hoster/Ftp.py +++ b/module/plugins/hoster/Ftp.py @@ -2,9 +2,8 @@ import pycurl import re - -from urllib import quote, unquote -from urlparse import urlparse +import urllib +import urlparse from module.plugins.Hoster import Hoster @@ -29,12 +28,12 @@ class Ftp(Hoster): def process(self, pyfile): - parsed_url = urlparse(pyfile.url) + parsed_url = urlparse.urlparse(pyfile.url) netloc = parsed_url.netloc pyfile.name = parsed_url.path.rpartition('/')[2] try: - pyfile.name = unquote(str(pyfile.name)).decode('utf8') + pyfile.name = urllib.unquote(str(pyfile.name)).decode('utf8') except Exception: pass @@ -67,11 +66,11 @@ class Ftp(Hoster): #Naive ftp directory listing if re.search(r'^25\d.*?"', self.req.http.header, re.M): pyfile.url = pyfile.url.rstrip('/') - pkgname = "/".join(pyfile.package().name, urlparse(pyfile.url).path.rpartition('/')[2]) + pkgname = "/".join(pyfile.package().name, urlparse.urlparse(pyfile.url).path.rpartition('/')[2]) pyfile.url += '/' self.req.http.c.setopt(48, 1) # CURLOPT_DIRLISTONLY res = self.load(pyfile.url, decode=False) - links = [pyfile.url + quote(x) for x in res.splitlines()] + links = [pyfile.url + urllib.quote(x) for x in res.splitlines()] self.logDebug("LINKS", links) self.core.api.addPackage(pkgname, links) else: diff --git a/module/plugins/hoster/GigapetaCom.py b/module/plugins/hoster/GigapetaCom.py index 2fe44ca85..e4d0601fc 100644 --- a/module/plugins/hoster/GigapetaCom.py +++ b/module/plugins/hoster/GigapetaCom.py @@ -1,10 +1,9 @@ # -*- coding: utf-8 -*- +import pycurl +import random import re -from pycurl import FOLLOWLOCATION -from random import randint - from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -29,10 +28,10 @@ class GigapetaCom(SimpleHoster): def handleFree(self, pyfile): - captcha_key = str(randint(1, 100000000)) + captcha_key = str(random.randint(1, 100000000)) captcha_url = "http://gigapeta.com/img/captcha.gif?x=%s" % captcha_key - self.req.http.c.setopt(FOLLOWLOCATION, 0) + self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 0) for _i in xrange(5): self.checkErrors() @@ -52,7 +51,7 @@ class GigapetaCom(SimpleHoster): else: self.fail(_("No valid captcha code entered")) - self.req.http.c.setopt(FOLLOWLOCATION, 1) + self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 1) def checkErrors(self): diff --git a/module/plugins/hoster/HellshareCz.py b/module/plugins/hoster/HellshareCz.py index 2e156c464..ac0043b37 100644 --- a/module/plugins/hoster/HellshareCz.py +++ b/module/plugins/hoster/HellshareCz.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from urlparse import urljoin +import urlparse from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo diff --git a/module/plugins/hoster/Keep2ShareCc.py b/module/plugins/hoster/Keep2ShareCc.py index 65e9ddc2d..fdae65096 100644 --- a/module/plugins/hoster/Keep2ShareCc.py +++ b/module/plugins/hoster/Keep2ShareCc.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urlparse import urljoin +import urlparse from module.plugins.internal.CaptchaService import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -100,7 +99,7 @@ class Keep2ShareCc(SimpleHoster): m = re.search(self.CAPTCHA_PATTERN, self.html) self.logDebug("CAPTCHA_PATTERN found %s" % m) if m: - captcha_url = urljoin("http://keep2s.cc/", m.group(1)) + captcha_url = urlparse.urljoin("http://keep2s.cc/", m.group(1)) post_data['CaptchaForm[code]'] = self.decryptCaptcha(captcha_url) else: recaptcha = ReCaptcha(self) diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index 79dbd8133..40d792e11 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -7,8 +7,7 @@ # http://letitbit.net/download/07874.0b5709a7d3beee2408bb1f2eefce/random.bin.html import re - -from urlparse import urljoin +import urlparse from module.common.json_layer import json_loads, json_dumps from module.network.RequestFactory import getURL @@ -66,7 +65,7 @@ class LetitbitNet(SimpleHoster): self.logDebug(action, inputs) inputs['desc'] = "" - self.html = self.load(urljoin("http://letitbit.net/", action), post=inputs) + self.html = self.load(urlparse.urljoin("http://letitbit.net/", action), post=inputs) m = re.search(self.SECONDS_PATTERN, self.html) seconds = int(m.group(1)) if m else 60 diff --git a/module/plugins/hoster/LinksnappyCom.py b/module/plugins/hoster/LinksnappyCom.py index 87207ab40..9c3af4ae3 100644 --- a/module/plugins/hoster/LinksnappyCom.py +++ b/module/plugins/hoster/LinksnappyCom.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urlparse import urlsplit +import urlparse from module.common.json_layer import json_loads, json_dumps from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo @@ -52,7 +51,7 @@ class LinksnappyCom(MultiHoster): @staticmethod def _get_host(url): - host = urlsplit(url).netloc + host = urlparse.urlsplit(url).netloc return re.search(r'[\w-]+\.\w+$', host).group(0) diff --git a/module/plugins/hoster/MegaCoNz.py b/module/plugins/hoster/MegaCoNz.py index 37ac12b44..aa7755af4 100644 --- a/module/plugins/hoster/MegaCoNz.py +++ b/module/plugins/hoster/MegaCoNz.py @@ -1,15 +1,15 @@ # -*- coding: utf-8 -*- +import array import os +# import pycurl import random import re -from array import array from base64 import standard_b64decode from Crypto.Cipher import AES from Crypto.Util import Counter -# from pycurl import SSL_CIPHER_LIST from module.common.json_layer import json_loads, json_dumps from module.plugins.Hoster import Hoster @@ -69,10 +69,10 @@ class MegaCoNz(Hoster): def getCipherKey(self, key): """ Construct the cipher key from the given data """ - a = array("I", self.b64_decode(key)) + a = array.array("I", self.b64_decode(key)) - k = array("I", (a[0] ^ a[4], a[1] ^ a[5], a[2] ^ a[6], a[3] ^ a[7])) - iv = a[4:6] + array("I", (0, 0)) + k = array.array("I", (a[0] ^ a[4], a[1] ^ a[5], a[2] ^ a[6], a[3] ^ a[7])) + iv = a[4:6] + array.array("I", (0, 0)) meta_mac = a[6:8] return k, iv, meta_mac @@ -82,7 +82,7 @@ class MegaCoNz(Hoster): """ Dispatch a call to the api, see https://mega.co.nz/#developers """ # generate a session id, no idea where to obtain elsewhere - uid = random.randint(10 << 9, 10 ** 10) + uid = random.random.randint(10 << 9, 10 ** 10) res = self.load(self.API_URL, get={'id': uid}, post=json_dumps([kwargs])) self.logDebug("Api Response: " + res) @@ -145,7 +145,7 @@ class MegaCoNz(Hoster): # block = chunk[i:i+16] # if len(block) % 16: # block += '=' * (16 - (len(block) % 16)) - # block = array("I", block) + # block = array.array("I", block) # chunk_mac = [chunk_mac[0] ^ a_[0], chunk_mac[1] ^ block[1], chunk_mac[2] ^ block[2], chunk_mac[3] ^ block[3]] # chunk_mac = aes_cbc_encrypt_a32(chunk_mac, k) @@ -207,7 +207,7 @@ class MegaCoNz(Hoster): pyfile.name = attr['n'] + self.FILE_SUFFIX pyfile.size = mega['s'] - # self.req.http.c.setopt(SSL_CIPHER_LIST, "RC4-MD5:DEFAULT") + # self.req.http.c.setopt(pycurl.SSL_CIPHER_LIST, "RC4-MD5:DEFAULT") self.download(mega['g']) diff --git a/module/plugins/hoster/MegaDebridEu.py b/module/plugins/hoster/MegaDebridEu.py index 3a8d8b080..9c8cc2a90 100644 --- a/module/plugins/hoster/MegaDebridEu.py +++ b/module/plugins/hoster/MegaDebridEu.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urllib import unquote_plus +import urllib from module.common.json_layer import json_loads from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo diff --git a/module/plugins/hoster/MegaRapidCz.py b/module/plugins/hoster/MegaRapidCz.py index 577a3d511..59fb8251e 100644 --- a/module/plugins/hoster/MegaRapidCz.py +++ b/module/plugins/hoster/MegaRapidCz.py @@ -1,9 +1,8 @@ # -*- coding: utf-8 -*- +import pycurl import re -from pycurl import HTTPHEADER - from module.network.HTTPRequest import BadHeader from module.network.RequestFactory import getRequest from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo @@ -11,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo def getInfo(urls): h = getRequest() - h.c.setopt(HTTPHEADER, + h.c.setopt(pycurl.HTTPHEADER, ["Accept: text/html", "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0"]) diff --git a/module/plugins/hoster/MegaRapidoNet.py b/module/plugins/hoster/MegaRapidoNet.py index b5bd7f3f2..a3b4c72ba 100644 --- a/module/plugins/hoster/MegaRapidoNet.py +++ b/module/plugins/hoster/MegaRapidoNet.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from random import randint +import random from module.plugins.internal.MultiHoster import MultiHoster @@ -9,7 +9,7 @@ def random_with_N_digits(n): rand = "0." not_zero = 0 for i in range(1, n + 1): - r = randint(0, 9) + r = random.randint(0, 9) if(r > 0): not_zero += 1 rand += str(r) diff --git a/module/plugins/hoster/MultishareCz.py b/module/plugins/hoster/MultishareCz.py index 5dc53ecbc..bbb77f525 100644 --- a/module/plugins/hoster/MultishareCz.py +++ b/module/plugins/hoster/MultishareCz.py @@ -1,9 +1,8 @@ # -*- coding: utf-8 -*- +import random import re -from random import random - from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -45,7 +44,7 @@ class MultishareCz(SimpleHoster): if not self.checkTrafficLeft(): self.fail(_("Not enough credit left to download file")) - self.download("http://dl%d.mms.multishare.cz/html/mms_process.php" % round(random() * 10000 * random()), + self.download("http://dl%d.mms.multishare.cz/html/mms_process.php" % round(random.random() * 10000 * random.random()), get={'u_ID' : self.acc_info['u_ID'], 'u_hash': self.acc_info['u_hash'], 'link' : pyfile.url}, diff --git a/module/plugins/hoster/NarodRu.py b/module/plugins/hoster/NarodRu.py index 65ad90d17..b7380add0 100644 --- a/module/plugins/hoster/NarodRu.py +++ b/module/plugins/hoster/NarodRu.py @@ -1,9 +1,8 @@ # -*- coding: utf-8 -*- +import random import re -from random import random - from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -34,7 +33,7 @@ class NarodRu(SimpleHoster): def handleFree(self, pyfile): for _i in xrange(5): - self.html = self.load('http://narod.ru/disk/getcapchaxml/?rnd=%d' % int(random() * 777)) + self.html = self.load('http://narod.ru/disk/getcapchaxml/?rnd=%d' % int(random.random() * 777)) m = re.search(self.CAPTCHA_PATTERN, self.html) if m is None: diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index 57af3f18e..cab7bd88f 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -2,8 +2,7 @@ import re import time - -from urlparse import urljoin +import urlparse from module.network.RequestFactory import getURL from module.plugins.Hoster import Hoster @@ -230,7 +229,7 @@ class NetloadIn(Hoster): page = None else: - url_captcha_html = urljoin("http://netload.in/", url_captcha_html) + url_captcha_html = urlparse.urljoin("http://netload.in/", url_captcha_html) break self.html = self.load(url_captcha_html) diff --git a/module/plugins/hoster/OverLoadMe.py b/module/plugins/hoster/OverLoadMe.py index 934de5746..d06baa0f5 100644 --- a/module/plugins/hoster/OverLoadMe.py +++ b/module/plugins/hoster/OverLoadMe.py @@ -1,9 +1,7 @@ # -*- coding: utf-8 -*- import re - -from random import randrange -from urllib import unquote +import urllib from module.common.json_layer import json_loads from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo diff --git a/module/plugins/hoster/PremiumTo.py b/module/plugins/hoster/PremiumTo.py index f48f68e1b..ab5016673 100644 --- a/module/plugins/hoster/PremiumTo.py +++ b/module/plugins/hoster/PremiumTo.py @@ -2,7 +2,7 @@ from __future__ import with_statement -from os import remove +import os from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo from module.utils import fs_encode @@ -45,7 +45,7 @@ class PremiumTo(MultiHoster): file = fs_encode(self.lastDownload) with open(file, "rb") as f: err = f.read(256).strip() - remove(file) + os.remove(file) if err: self.fail(err) diff --git a/module/plugins/hoster/QuickshareCz.py b/module/plugins/hoster/QuickshareCz.py index 893c3b6c7..1e0750b88 100644 --- a/module/plugins/hoster/QuickshareCz.py +++ b/module/plugins/hoster/QuickshareCz.py @@ -1,9 +1,8 @@ # -*- coding: utf-8 -*- +import pycurl import re -from pycurl import FOLLOWLOCATION - from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -60,10 +59,10 @@ class QuickshareCz(SimpleHoster): data = dict((x, self.jsvars[x]) for x in self.jsvars if x in ("ID1", "ID2", "ID3", "ID4")) self.logDebug("FREE URL1:" + download_url, data) - self.req.http.c.setopt(FOLLOWLOCATION, 0) + self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 0) self.load(download_url, post=data) self.header = self.req.http.header - self.req.http.c.setopt(FOLLOWLOCATION, 1) + self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 1) m = re.search(r'Location\s*:\s*(.+)', self.header, re.I) if m is None: diff --git a/module/plugins/hoster/RapidgatorNet.py b/module/plugins/hoster/RapidgatorNet.py index 2626ec925..ae74e8a63 100644 --- a/module/plugins/hoster/RapidgatorNet.py +++ b/module/plugins/hoster/RapidgatorNet.py @@ -1,9 +1,8 @@ # -*- coding: utf-8 -*- +import pycurl import re -from pycurl import HTTPHEADER - from module.common.json_layer import json_loads from module.network.HTTPRequest import BadHeader from module.plugins.internal.CaptchaService import AdsCaptcha, ReCaptcha, SolveMedia @@ -102,7 +101,7 @@ class RapidgatorNet(SimpleHoster): self.logDebug(jsvars) self.req.http.lastURL = pyfile.url - self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) + self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) url = "http://rapidgator.net%s?fid=%s" % ( jsvars.get('startTimerUrl', '/download/AjaxStartTimer'), jsvars['fid']) @@ -115,7 +114,7 @@ class RapidgatorNet(SimpleHoster): jsvars.update(self.getJsonResponse(url)) self.req.http.lastURL = pyfile.url - self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With:"]) + self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With:"]) url = "http://rapidgator.net%s" % jsvars.get('captchaUrl', '/download/captcha') self.html = self.load(url) diff --git a/module/plugins/hoster/RapiduNet.py b/module/plugins/hoster/RapiduNet.py index 8a85bc844..fcccbbebc 100644 --- a/module/plugins/hoster/RapiduNet.py +++ b/module/plugins/hoster/RapiduNet.py @@ -1,10 +1,9 @@ # -*- coding: utf-8 -*- +import pycurl import re import time -from pycurl import HTTPHEADER - from module.common.json_layer import json_loads from module.plugins.internal.CaptchaService import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -40,7 +39,7 @@ class RapiduNet(SimpleHoster): def handleFree(self, pyfile): self.req.http.lastURL = pyfile.url - self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) + self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) jsvars = self.getJsonResponse("https://rapidu.net/ajax.php", get={'a': "getLoadTimeToDownload"}, diff --git a/module/plugins/hoster/RealdebridCom.py b/module/plugins/hoster/RealdebridCom.py index f35eb5e03..4500fcefc 100644 --- a/module/plugins/hoster/RealdebridCom.py +++ b/module/plugins/hoster/RealdebridCom.py @@ -2,9 +2,7 @@ import re import time - -from random import randrange -from urllib import unquote +import urllib from module.common.json_layer import json_loads from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo diff --git a/module/plugins/hoster/RehostTo.py b/module/plugins/hoster/RehostTo.py index 1c53fbc92..9c07364ec 100644 --- a/module/plugins/hoster/RehostTo.py +++ b/module/plugins/hoster/RehostTo.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from urllib import unquote +import urllib from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index fea5781fe..505222fce 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -2,9 +2,8 @@ import re import time - -from urllib import unquote -from urlparse import urlparse +import urllib +import urlparse from module.network.RequestFactory import getURL from module.plugins.internal.CaptchaService import ReCaptcha @@ -38,7 +37,7 @@ class ShareonlineBiz(SimpleHoster): @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} + info = {'name': urlparse.urlparse(urllib.unquote(url)).path.split('/')[-1] or _("Unknown"), 'size': 0, 'status': 3 if url else 1, 'url': url} if url: info['pattern'] = re.match(cls.__pattern__, url).groupdict() diff --git a/module/plugins/hoster/ShareplaceCom.py b/module/plugins/hoster/ShareplaceCom.py index c540dd2df..babd0d1d4 100644 --- a/module/plugins/hoster/ShareplaceCom.py +++ b/module/plugins/hoster/ShareplaceCom.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urllib import unquote +import urllib from module.plugins.Hoster import Hoster @@ -61,7 +60,7 @@ class ShareplaceCom(Hoster): url = re.search(r"var beer = '(.*?)';", self.html) if url: url = url.group(1) - url = unquote( + url = urllib.unquote( url.replace("http://http:/", "").replace("vvvvvvvvv", "").replace("lllllllll", "").replace( "teletubbies", "")) self.logDebug("URL: %s" % url) diff --git a/module/plugins/hoster/SpeedyshareCom.py b/module/plugins/hoster/SpeedyshareCom.py index 1649abbe6..91788b2c8 100644 --- a/module/plugins/hoster/SpeedyshareCom.py +++ b/module/plugins/hoster/SpeedyshareCom.py @@ -4,8 +4,7 @@ # http://speedy.sh/ep2qY/Zapp-Brannigan.jpg import re - -from urlparse import urljoin +import urlparse from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo diff --git a/module/plugins/hoster/TurbobitNet.py b/module/plugins/hoster/TurbobitNet.py index f4eaa90cc..7995bd0c0 100644 --- a/module/plugins/hoster/TurbobitNet.py +++ b/module/plugins/hoster/TurbobitNet.py @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- +import binascii +import pycurl import random import re import time +import urllib from Crypto.Cipher import ARC4 -from binascii import hexlify, unhexlify -from pycurl import HTTPHEADER -from urllib import quote from module.network.RequestFactory import getURL from module.plugins.internal.CaptchaService import ReCaptcha @@ -50,11 +50,11 @@ class TurbobitNet(SimpleHoster): self.solveCaptcha() - self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) + self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) self.html = self.load(self.getDownloadUrl(rtUpdate)) - self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With:"]) + self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With:"]) m = re.search(self.LINK_FREE_PATTERN, self.html) if m: @@ -134,7 +134,7 @@ class TurbobitNet(SimpleHoster): for b in [1, 3]: self.jscode = "var id = \'%s\';var b = %d;var inn = \'%s\';%sout" % ( - self.info['pattern']['ID'], b, quote(fun), rtUpdate) + self.info['pattern']['ID'], b, urllib.quote(fun), rtUpdate) try: out = self.js.eval(self.jscode) @@ -155,8 +155,8 @@ class TurbobitNet(SimpleHoster): def decrypt(self, data): - cipher = ARC4.new(hexlify('E\x15\xa1\x9e\xa3M\xa0\xc6\xa0\x84\xb6H\x83\xa8o\xa0')) - return unhexlify(cipher.encrypt(unhexlify(data))) + cipher = ARC4.new(binascii.hexlify('E\x15\xa1\x9e\xa3M\xa0\xc6\xa0\x84\xb6H\x83\xa8o\xa0')) + return binascii.unhexlify(cipher.encrypt(binascii.unhexlify(data))) def getLocalTimeString(self): diff --git a/module/plugins/hoster/UnibytesCom.py b/module/plugins/hoster/UnibytesCom.py index 14447b0b0..d090c8e7d 100644 --- a/module/plugins/hoster/UnibytesCom.py +++ b/module/plugins/hoster/UnibytesCom.py @@ -1,10 +1,8 @@ # -*- coding: utf-8 -*- +import pycurl import re - -from urlparse import urljoin - -from pycurl import FOLLOWLOCATION +import urlparse from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -34,11 +32,11 @@ class UnibytesCom(SimpleHoster): domain = "http://www.%s/" % self.HOSTER_DOMAIN action, post_data = self.parseHtmlForm('id="startForm"') - self.req.http.c.setopt(FOLLOWLOCATION, 0) + self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 0) for _i in xrange(8): self.logDebug(action, post_data) - self.html = self.load(urljoin(domain, action), post=post_data) + self.html = self.load(urlparse.urljoin(domain, action), post=post_data) m = re.search(r'location:\s*(\S+)', self.req.http.header, re.I) if m: @@ -66,12 +64,12 @@ class UnibytesCom(SimpleHoster): self.wait(m.group(1) if m else 60, False) elif last_step in ("captcha", "last"): - post_data['captcha'] = self.decryptCaptcha(urljoin(domain, "/captcha.jpg")) + post_data['captcha'] = self.decryptCaptcha(urlparse.urljoin(domain, "/captcha.jpg")) else: self.fail(_("No valid captcha code entered")) - self.req.http.c.setopt(FOLLOWLOCATION, 1) + self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 1) getInfo = create_getInfo(UnibytesCom) diff --git a/module/plugins/hoster/UpleaCom.py b/module/plugins/hoster/UpleaCom.py index 4538b1c16..9d460ef98 100644 --- a/module/plugins/hoster/UpleaCom.py +++ b/module/plugins/hoster/UpleaCom.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urlparse import urljoin +import urlparse from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo @@ -48,7 +47,7 @@ class UpleaCom(XFSHoster): if m is None: self.error(_("STEP_PATTERN not found")) - self.html = self.load(urljoin("http://uplea.com/", m.group(1))) + self.html = self.load(urlparse.urljoin("http://uplea.com/", m.group(1))) m = re.search(self.WAIT_PATTERN, self.html) if m: diff --git a/module/plugins/hoster/UploadheroCom.py b/module/plugins/hoster/UploadheroCom.py index 6c8747b58..5c74f10eb 100644 --- a/module/plugins/hoster/UploadheroCom.py +++ b/module/plugins/hoster/UploadheroCom.py @@ -4,8 +4,7 @@ # http://uploadhero.co/dl/wQBRAVSM import re - -from urlparse import urljoin +import urlparse from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -44,7 +43,7 @@ class UploadheroCom(SimpleHoster): if m is None: self.error(_("Captcha not found")) - captcha = self.decryptCaptcha(urljoin("http://uploadhero.co", m.group(1))) + captcha = self.decryptCaptcha(urlparse.urljoin("http://uploadhero.co", m.group(1))) self.html = self.load(pyfile.url, get={"code": captcha}) @@ -58,7 +57,7 @@ class UploadheroCom(SimpleHoster): def checkErrors(self): m = re.search(self.IP_BLOCKED_PATTERN, self.html) if m: - self.html = self.load(urljoin("http://uploadhero.co", m.group(1))) + self.html = self.load(urlparse.urljoin("http://uploadhero.co", m.group(1))) m = re.search(self.IP_WAIT_PATTERN, self.html) wait_time = (int(m.group(1)) * 60 + int(m.group(2))) if m else 5 * 60 diff --git a/module/plugins/hoster/UploadingCom.py b/module/plugins/hoster/UploadingCom.py index d0e0b1fd7..c2e0d2873 100644 --- a/module/plugins/hoster/UploadingCom.py +++ b/module/plugins/hoster/UploadingCom.py @@ -1,9 +1,8 @@ # -*- coding: utf-8 -*- +import pycurl import re -from pycurl import HTTPHEADER - from module.common.json_layer import json_loads from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, timestamp @@ -66,7 +65,7 @@ class UploadingCom(SimpleHoster): self.retry(6, (6 * 60 if m.group(2) else 15) * 60, pyfile.error) ajax_url = "http://uploading.com/files/get/?ajax" - self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) + self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) self.req.http.lastURL = pyfile.url res = json_loads(self.load(ajax_url, post={'action': 'second_page', 'code': self.info['pattern']['ID']})) diff --git a/module/plugins/hoster/WrzucTo.py b/module/plugins/hoster/WrzucTo.py index 50a45babe..f11d03ea8 100644 --- a/module/plugins/hoster/WrzucTo.py +++ b/module/plugins/hoster/WrzucTo.py @@ -1,9 +1,8 @@ # -*- coding: utf-8 -*- +import pycurl import re -from pycurl import HTTPHEADER - from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -35,7 +34,7 @@ class WrzucTo(SimpleHoster): if len(data) != 2: self.error(_("No file ID")) - self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) + self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) self.req.http.lastURL = pyfile.url self.load("http://www.wrzuc.to/ajax/server/prepair", post={"md5": data['md5']}) diff --git a/module/plugins/hoster/XHamsterCom.py b/module/plugins/hoster/XHamsterCom.py index 9004dbac0..a1711cb0e 100644 --- a/module/plugins/hoster/XHamsterCom.py +++ b/module/plugins/hoster/XHamsterCom.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urllib import unquote +import urllib from module.common.json_layer import json_loads from module.plugins.Hoster import Hoster @@ -83,7 +82,7 @@ class XHamsterCom(Hoster): self.logDebug("long_url = " + long_url) else: if flashvars['file']: - file_url = unquote(flashvars['file']) + file_url = urllib.unquote(flashvars['file']) else: self.error(_("file_url not found")) diff --git a/module/plugins/hoster/XVideosCom.py b/module/plugins/hoster/XVideosCom.py index 9bb2da424..a8f291824 100644 --- a/module/plugins/hoster/XVideosCom.py +++ b/module/plugins/hoster/XVideosCom.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urllib import unquote +import urllib from module.plugins.Hoster import Hoster @@ -25,4 +24,4 @@ class XVideosCom(Hoster): re.search(r"<h2>([^<]+)<span", site).group(1), re.match(self.__pattern__, pyfile.url).group(1), ) - self.download(unquote(re.search(r"flv_url=([^&]+)&", site).group(1))) + self.download(urllib.unquote(re.search(r"flv_url=([^&]+)&", site).group(1))) diff --git a/module/plugins/hoster/Xdcc.py b/module/plugins/hoster/Xdcc.py index b77e7c1da..d167e4cab 100644 --- a/module/plugins/hoster/Xdcc.py +++ b/module/plugins/hoster/Xdcc.py @@ -6,8 +6,6 @@ import struct import sys import time -from os import makedirs -from os.path import exists, join from select import select from module.plugins.Hoster import Hoster diff --git a/module/plugins/hoster/YourfilesTo.py b/module/plugins/hoster/YourfilesTo.py index fd65a6a41..d0316d3ac 100644 --- a/module/plugins/hoster/YourfilesTo.py +++ b/module/plugins/hoster/YourfilesTo.py @@ -1,8 +1,6 @@ # -*- coding: utf-8 -*- -import re - -from urllib import unquote +import reimport urllib from module.plugins.Hoster import Hoster @@ -62,7 +60,7 @@ class YourfilesTo(Hoster): url = re.search(r"var bla = '(.*?)';", self.html) if url: url = url.group(1) - url = unquote(url.replace("http://http:/http://", "http://").replace("dumdidum", "")) + url = urllib.unquote(url.replace("http://http:/http://", "http://").replace("dumdidum", "")) return url else: self.error(_("Absolute filepath not found")) diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py index 06f135c60..e2ab146a9 100644 --- a/module/plugins/hoster/YoutubeCom.py +++ b/module/plugins/hoster/YoutubeCom.py @@ -2,9 +2,7 @@ import os import re -import subprocess - -from urllib import unquote +import subprocessimport urllib from module.plugins.Hoster import Hoster from module.plugins.internal.SimpleHoster import replace_patterns @@ -117,7 +115,7 @@ class YoutubeCom(Hoster): streams = re.search(r'"url_encoded_fmt_stream_map":"(.+?)",', html).group(1) streams = [x.split('\u0026') for x in streams.split(',')] streams = [dict((y.split('=', 1)) for y in x) for x in streams] - streams = [(int(x['itag']), unquote(x['url'])) for x in streams] + streams = [(int(x['itag']), urllib.unquote(x['url'])) for x in streams] # self.logDebug("Found links: %s" % streams) diff --git a/module/plugins/hoster/ZeveraCom.py b/module/plugins/hoster/ZeveraCom.py index e0362ce36..617e00e58 100644 --- a/module/plugins/hoster/ZeveraCom.py +++ b/module/plugins/hoster/ZeveraCom.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urlparse import urljoin +import urlparse from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo diff --git a/module/plugins/internal/CaptchaService.py b/module/plugins/internal/CaptchaService.py index ec938079a..b6afad22a 100644 --- a/module/plugins/internal/CaptchaService.py +++ b/module/plugins/internal/CaptchaService.py @@ -1,11 +1,11 @@ # -*- coding: utf-8 -*- +import random import re import time +import urlparse from base64 import b64encode -from random import random, randint -from urlparse import urljoin, urlparse from module.common.json_layer import json_loads from module.plugins.Plugin import Base @@ -155,7 +155,7 @@ class ReCaptcha(CaptchaService): self.logDebug("Time: %s" % millis) - rand = randint(1, 99999999) + rand = random.randint(1, 99999999) a = "0.%s" % str(rand * 2147483647) rpc = int(100000000 * float(a)) @@ -167,7 +167,7 @@ class ReCaptcha(CaptchaService): def _challenge_v2(self, key, parent=None): if parent is None: try: - parent = urljoin("http://", urlparse(self.plugin.pyfile.url).netloc) + parent = urlparse.urljoin("http://", urlparse.urlparse(self.plugin.pyfile.url).netloc) except Exception: parent = "" @@ -214,7 +214,7 @@ class ReCaptcha(CaptchaService): self.logDebug("Result: %s" % response) timeToSolve = int(round(time.time() * 1000)) - millis_captcha_loading - timeToSolveMore = timeToSolve + int(float("0." + str(randint(1, 99999999))) * 500) + timeToSolveMore = timeToSolve + int(float("0." + str(random.randint(1, 99999999))) * 500) html = self.plugin.req.load("https://www.google.com/recaptcha/api2/userverify", post={'k' : key, @@ -296,7 +296,7 @@ class AdsCaptcha(CaptchaService): def result(self, server, challenge): result = self.plugin.decryptCaptcha("%sChallenge.aspx" % server, - get={'cid': challenge, 'dummy': random()}, + get={'cid': challenge, 'dummy': random.random()}, cookies=True, imgtype="jpg") diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py index 892144ef4..09805cf1a 100644 --- a/module/plugins/internal/SimpleCrypter.py +++ b/module/plugins/internal/SimpleCrypter.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urlparse import urljoin, urlparse +import urlparse from module.plugins.Crypter import Crypter from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, replace_patterns, set_cookies @@ -150,10 +149,10 @@ class SimpleCrypter(Crypter, SimpleHoster): Returns the links extracted from self.html You should override this only if it's impossible to extract links using only the LINK_PATTERN. """ - url_p = urlparse(self.pyfile.url) + url_p = urlparse.urlparse(self.pyfile.url) baseurl = "%s://%s" % (url_p.scheme, url_p.netloc) - return [urljoin(baseurl, link) if not urlparse(link).scheme else link \ + return [urlparse.urljoin(baseurl, link) if not urlparse.urlparse(link).scheme else link \ for link in re.findall(self.LINK_PATTERN, self.html)] diff --git a/module/plugins/internal/SimpleDereferer.py b/module/plugins/internal/SimpleDereferer.py index 743a98721..fad1559c7 100644 --- a/module/plugins/internal/SimpleDereferer.py +++ b/module/plugins/internal/SimpleDereferer.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urllib import unquote +import urllib from module.plugins.Crypter import Crypter from module.plugins.internal.SimpleHoster import getFileURL, set_cookies @@ -49,7 +48,7 @@ class SimpleDereferer(Crypter): if not link: try: - link = unquote(re.match(self.__pattern__, pyfile.url).group('LINK')) + link = urllib.unquote(re.match(self.__pattern__, pyfile.url).group('LINK')) except Exception: self.prepare() diff --git a/module/plugins/internal/XFSAccount.py b/module/plugins/internal/XFSAccount.py index 31d1b7e2f..41e1bde4d 100644 --- a/module/plugins/internal/XFSAccount.py +++ b/module/plugins/internal/XFSAccount.py @@ -2,8 +2,7 @@ import re import time - -from urlparse import urljoin +import urlparse from module.plugins.Account import Account from module.plugins.internal.SimpleHoster import parseHtmlForm, set_cookies @@ -160,7 +159,7 @@ class XFSAccount(Account): raise Exception(_("Missing HOSTER_DOMAIN")) if not self.LOGIN_URL: - self.LOGIN_URL = urljoin(self.HOSTER_URL, "login.html") + self.LOGIN_URL = urlparse.urljoin(self.HOSTER_URL, "login.html") html = req.load(self.LOGIN_URL, decode=True) action, inputs = parseHtmlForm('name="FL"', html) diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py index 027e68236..33dc6d16b 100644 --- a/module/plugins/internal/XFSHoster.py +++ b/module/plugins/internal/XFSHoster.py @@ -1,12 +1,9 @@ # -*- coding: utf-8 -*- +import pycurl +import random import re -import time - -from random import random -from urlparse import urljoin, urlparse - -from pycurl import FOLLOWLOCATION, LOW_SPEED_TIME +import urlparse from module.plugins.internal.CaptchaService import ReCaptcha, SolveMedia from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, secondsToMidnight @@ -101,11 +98,11 @@ class XFSHoster(SimpleHoster): data = self.getPostParameters() - self.req.http.c.setopt(FOLLOWLOCATION, 0) + self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 0) self.html = self.load(pyfile.url, post=data, decode=True) - self.req.http.c.setopt(FOLLOWLOCATION, 1) + self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 1) m = re.search(r'Location\s*:\s*(.+)', self.req.http.header, re.I) if m and not "op=" in m.group(1): @@ -134,7 +131,7 @@ class XFSHoster(SimpleHoster): action, inputs = self.parseHtmlForm() - upload_id = "%012d" % int(random() * 10 ** 12) + upload_id = "%012d" % int(random.random() * 10 ** 12) action += upload_id + "&js_on=1&utype=prem&upload_type=url" inputs['tos'] = '1' -- cgit v1.2.3 From daccea9c91daa4e6bcdaa12c0af92f13d30ba203 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@users.noreply.github.com> Date: Fri, 1 May 2015 01:10:34 +0200 Subject: [XFileSharingPro] worldbytez.com support --- module/plugins/hooks/XFileSharingPro.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/XFileSharingPro.py b/module/plugins/hooks/XFileSharingPro.py index 4f8b0a846..3205596fa 100644 --- a/module/plugins/hooks/XFileSharingPro.py +++ b/module/plugins/hooks/XFileSharingPro.py @@ -8,7 +8,7 @@ from module.plugins.Hook import Hook class XFileSharingPro(Hook): __name__ = "XFileSharingPro" __type__ = "hook" - __version__ = "0.36" + __version__ = "0.37" __config__ = [("activated" , "bool", "Activated" , True ), ("use_hoster_list" , "bool", "Load listed hosters only" , False), @@ -32,7 +32,7 @@ class XFileSharingPro(Hook): HOSTER_BUILTIN = [#WORKING HOSTERS: "backin.net", "eyesfile.ca", "file4safe.com", "fileband.com", "filedwon.com", "fileparadox.in", "filevice.com", "hostingbulk.com", "junkyvideo.com", "linestorage.com", "ravishare.com", "ryushare.com", - "salefiles.com", "sendmyway.com", "sharesix.com", "thefile.me", "verzend.be", "xvidstage.com", + "salefiles.com", "sendmyway.com", "sharesix.com", "thefile.me", "verzend.be", "worldbytez.com", "xvidstage.com", #NOT TESTED: "101shared.com", "4upfiles.com", "filemaze.ws", "filenuke.com", "linkzhost.com", "mightyupload.com", "rockdizfile.com", "sharebeast.com", "sharerepo.com", "shareswift.com", "uploadbaz.com", "uploadc.com", -- cgit v1.2.3 From ebceffbb7b225a3be8f3dcd75b3699112b0af373 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@users.noreply.github.com> Date: Fri, 1 May 2015 02:44:58 +0200 Subject: [XFSCrypter] Improve LINK_PATTERN --- module/plugins/internal/XFSCrypter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/internal/XFSCrypter.py b/module/plugins/internal/XFSCrypter.py index 665e13b18..0612be876 100644 --- a/module/plugins/internal/XFSCrypter.py +++ b/module/plugins/internal/XFSCrypter.py @@ -6,7 +6,7 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo class XFSCrypter(SimpleCrypter): __name__ = "XFSCrypter" __type__ = "crypter" - __version__ = "0.06" + __version__ = "0.07" __pattern__ = r'^unmatchable$' @@ -19,7 +19,7 @@ class XFSCrypter(SimpleCrypter): URL_REPLACEMENTS = [(r'&?per_page=\d+', ""), (r'[?/&]+$', ""), (r'(.+/[^?]+)$', r'\1?'), (r'$', r'&per_page=10000')] - LINK_PATTERN = r'<(?:td|TD).*?>\s*<a href="(.+?)".*?>.+?(?:</a>)?\s*</(?:td|TD)>' + LINK_PATTERN = r'<a href="(.+?)".*?>.+?(?:</a>)?\s*</(?:td|TD)>' NAME_PATTERN = r'<[tT]itle>.*?\: (?P<N>.+) folder</[tT]itle>' OFFLINE_PATTERN = r'>\s*\w+ (Not Found|file (was|has been) removed)' -- cgit v1.2.3 From 711621f3d3a59f7ec5c2684dfac921e2c5902563 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@users.noreply.github.com> Date: Fri, 1 May 2015 02:54:22 +0200 Subject: Fix https://github.com/pyload/pyload/issues/1351 --- module/plugins/hooks/AntiVirus.py | 30 +++++++++++++----------------- module/plugins/hooks/ExtractArchive.py | 29 ++++++++++++----------------- module/plugins/hooks/XFileSharingPro.py | 4 ++-- 3 files changed, 27 insertions(+), 36 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/AntiVirus.py b/module/plugins/hooks/AntiVirus.py index 27e3801b5..ac9373a37 100644 --- a/module/plugins/hooks/AntiVirus.py +++ b/module/plugins/hooks/AntiVirus.py @@ -4,6 +4,11 @@ import os import shutil import subprocess +try: + import send2trash +except ImportError: + pass + from module.plugins.Hook import Hook, Expose, threaded from module.utils import fs_encode, save_join @@ -11,7 +16,7 @@ from module.utils import fs_encode, save_join class AntiVirus(Hook): __name__ = "AntiVirus" __type__ = "hook" - __version__ = "0.07" + __version__ = "0.08" #@TODO: add trash option (use Send2Trash lib) __config__ = [("action" , "Antivirus default;Delete;Quarantine", "Manage infected files" , "Antivirus default"), @@ -33,16 +38,6 @@ class AntiVirus(Hook): def setup(self): self.info = {} #@TODO: Remove in 0.4.10 - try: - import send2trash - - except ImportError: - self.logDebug("Send2Trash lib not found") - self.trashable = False - - else: - self.trashable = True - @Expose @threaded @@ -81,13 +76,14 @@ class AntiVirus(Hook): if not self.getConfig('deltotrash'): os.remove(file) - elif self.trashable: - send2trash.send2trash(file) - else: - self.logWarning(_("Unable to move file to trash, move to quarantine instead")) - pyfile.setCustomStatus(_("file moving")) - shutil.move(file, self.getConfig('quardir')) + try: + send2trash.send2trash(file) + + except Exception: + self.logWarning(_("Unable to move file to trash, move to quarantine instead")) + pyfile.setCustomStatus(_("file moving")) + shutil.move(file, self.getConfig('quardir')) elif action == "Quarantine": pyfile.setCustomStatus(_("file moving")) diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index d40b52aa7..05a1e368a 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -6,8 +6,6 @@ import os import sys import traceback -from copy import copy - # monkey patch bug in python 2.6 and lower # http://bugs.python.org/issue6122 , http://bugs.python.org/issue1236 , http://bugs.python.org/issue1731717 if sys.version_info < (2, 7) and os.name != "nt": @@ -45,6 +43,12 @@ if sys.version_info < (2, 7) and os.name != "nt": subprocess.Popen.wait = wait +try: + import send2trash +except ImportError: + pass + +from copy import copy if os.name != "nt": from grp import getgrnam from pwd import getpwnam @@ -106,7 +110,7 @@ class ArchiveQueue(object): class ExtractArchive(Hook): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.41" + __version__ = "1.42" __config__ = [("activated" , "bool" , "Activated" , True ), ("fullpath" , "bool" , "Extract with full paths" , True ), @@ -150,16 +154,6 @@ class ExtractArchive(Hook): self.passwords = [] self.repair = False - try: - import send2trash - - except ImportError: - self.logDebug("Send2Trash lib not found") - self.trashable = False - - else: - self.trashable = True - def coreReady(self): for p in ("UnRar", "SevenZip", "UnZip"): @@ -474,11 +468,12 @@ class ExtractArchive(Hook): if not deltotrash: os.remove(file) - elif self.trashable: - send2trash.send2trash(file) - else: - self.logWarning(_("Unable to move %s to trash") % os.path.basename(f)) + try: + send2trash.send2trash(file) + + except Exception: + self.logWarning(_("Unable to move %s to trash") % os.path.basename(f)) self.logInfo(name, _("Extracting finished")) extracted_files = archive.files or archive.list() diff --git a/module/plugins/hooks/XFileSharingPro.py b/module/plugins/hooks/XFileSharingPro.py index 3205596fa..d80515a22 100644 --- a/module/plugins/hooks/XFileSharingPro.py +++ b/module/plugins/hooks/XFileSharingPro.py @@ -32,11 +32,11 @@ class XFileSharingPro(Hook): HOSTER_BUILTIN = [#WORKING HOSTERS: "backin.net", "eyesfile.ca", "file4safe.com", "fileband.com", "filedwon.com", "fileparadox.in", "filevice.com", "hostingbulk.com", "junkyvideo.com", "linestorage.com", "ravishare.com", "ryushare.com", - "salefiles.com", "sendmyway.com", "sharesix.com", "thefile.me", "verzend.be", "worldbytez.com", "xvidstage.com", + "salefiles.com", "sendmyway.com", "sharesix.com", "thefile.me", "verzend.be", "xvidstage.com", #NOT TESTED: "101shared.com", "4upfiles.com", "filemaze.ws", "filenuke.com", "linkzhost.com", "mightyupload.com", "rockdizfile.com", "sharebeast.com", "sharerepo.com", "shareswift.com", "uploadbaz.com", "uploadc.com", - "vidbull.com", "zalaa.com", "zomgupload.com", + "vidbull.com", "worldbytez.com", "zalaa.com", "zomgupload.com", #NOT WORKING: "amonshare.com", "banicrazy.info", "boosterking.com", "host4desi.com", "laoupload.com", "rd-fs.com"] CRYPTER_BUILTIN = ["junocloud.me", "rapidfileshare.net"] -- cgit v1.2.3 From fc36aa1a426fb8c75897debdc6cb4104dbff8200 Mon Sep 17 00:00:00 2001 From: GammaC0de <GammaC0de@users.noreply.github.com> Date: Sat, 2 May 2015 22:36:02 +0300 Subject: [AntiVirus] report missing send2trash --- module/plugins/hooks/AntiVirus.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/AntiVirus.py b/module/plugins/hooks/AntiVirus.py index ac9373a37..69dffbe73 100644 --- a/module/plugins/hooks/AntiVirus.py +++ b/module/plugins/hooks/AntiVirus.py @@ -16,7 +16,7 @@ from module.utils import fs_encode, save_join class AntiVirus(Hook): __name__ = "AntiVirus" __type__ = "hook" - __version__ = "0.08" + __version__ = "0.09" #@TODO: add trash option (use Send2Trash lib) __config__ = [("action" , "Antivirus default;Delete;Quarantine", "Manage infected files" , "Antivirus default"), @@ -80,8 +80,13 @@ class AntiVirus(Hook): try: send2trash.send2trash(file) - except Exception: - self.logWarning(_("Unable to move file to trash, move to quarantine instead")) + except NameError: + self.logWarning(_("Send2Trash lib not found, moving to quarantine instead")) + pyfile.setCustomStatus(_("file moving")) + shutil.move(file, self.getConfig('quardir')) + + except Exception: + self.logWarning(_("Unable to move file to trash, moving to quarantine instead")) pyfile.setCustomStatus(_("file moving")) shutil.move(file, self.getConfig('quardir')) -- cgit v1.2.3 From dec360bee84f046bf40612173ec4e74aebd60599 Mon Sep 17 00:00:00 2001 From: GammaC0de <GammaC0de@users.noreply.github.com> Date: Sat, 2 May 2015 22:40:55 +0300 Subject: [ExtractArchive] report missing send2trash --- module/plugins/hooks/ExtractArchive.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 05a1e368a..609d0ad62 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -110,7 +110,7 @@ class ArchiveQueue(object): class ExtractArchive(Hook): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.42" + __version__ = "1.43" __config__ = [("activated" , "bool" , "Activated" , True ), ("fullpath" , "bool" , "Extract with full paths" , True ), @@ -472,6 +472,9 @@ class ExtractArchive(Hook): try: send2trash.send2trash(file) + except NameError: + self.logWarning(_("Unable to move %s to trash: Send2Trash lib not found") % os.path.basename(f)) + except Exception: self.logWarning(_("Unable to move %s to trash") % os.path.basename(f)) -- cgit v1.2.3 From 11b355093b8a1f73718d36fd043042abbfdcc0d3 Mon Sep 17 00:00:00 2001 From: GammaC0de <GammaC0de@users.noreply.github.com> Date: Sun, 3 May 2015 16:13:28 +0300 Subject: new hoster SizedriveCom --- module/plugins/hoster/SizedriveCom.py | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 module/plugins/hoster/SizedriveCom.py (limited to 'module/plugins') diff --git a/module/plugins/hoster/SizedriveCom.py b/module/plugins/hoster/SizedriveCom.py new file mode 100644 index 000000000..13a29eb99 --- /dev/null +++ b/module/plugins/hoster/SizedriveCom.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- + +import re + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + + +class SizedriveCom(SimpleHoster): + __name__ = "SizedriveCom" + __type__ = "hoster" + __version__ = "0.01" + + __pattern__ = r'http://(?:www\.)?sizedrive\.com/[rd]/(?P<ID>\w+)' + + __description__ = """Sizedrive.com hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("GammaC0de", None)] + + + OFFLINE_PATTERN = r'ARQUIVO DELATADO POR' + NAME_PATTERN = r'<b>Nome:</b> (?P<N>.+)<' + SIZE_PATTERN = r'<b>Tamanho:</b>(?P<S>[\d.,]+) (?P<U>[\w^_]+)' + + def setup(self): + self.resumeDownload = False + self.multiDL = False + self.chunkLimit = 1 + + + def handleFree(self, pyfile): + self.wait(5) + self.html = self.load("http://www.sizedrive.com/getdownload.php", + post={'id': self.info['pattern']['ID']}) + + m = re.search(r'<span id="boton_download" ><a href="(.+?)"', self.html) + if m: + self.link = m.group(1) + else: + self.error(_("Download link not found")) + + +getInfo = create_getInfo(SizedriveCom) -- cgit v1.2.3 From c6932a1ea6e44867e2b2caedfad444d4b34aea4f Mon Sep 17 00:00:00 2001 From: GammaC0de <GammaC0de@users.noreply.github.com> Date: Mon, 4 May 2015 01:33:47 +0300 Subject: more verbose --- module/plugins/hooks/ExtractArchive.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 609d0ad62..d0a84364a 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -475,8 +475,8 @@ class ExtractArchive(Hook): except NameError: self.logWarning(_("Unable to move %s to trash: Send2Trash lib not found") % os.path.basename(f)) - except Exception: - self.logWarning(_("Unable to move %s to trash") % os.path.basename(f)) + except Exception, e: + self.logWarning(_("Unable to move %s to trash: %s") % (os.path.basename(f), e.message)) self.logInfo(name, _("Extracting finished")) extracted_files = archive.files or archive.list() -- cgit v1.2.3 From dc7c81b6ab0813745ee03116c27f870138b3fc7f Mon Sep 17 00:00:00 2001 From: GammaC0de <GammaC0de@users.noreply.github.com> Date: Mon, 4 May 2015 01:36:23 +0300 Subject: more verbose --- module/plugins/hooks/AntiVirus.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/AntiVirus.py b/module/plugins/hooks/AntiVirus.py index 69dffbe73..6823729af 100644 --- a/module/plugins/hooks/AntiVirus.py +++ b/module/plugins/hooks/AntiVirus.py @@ -85,8 +85,8 @@ class AntiVirus(Hook): pyfile.setCustomStatus(_("file moving")) shutil.move(file, self.getConfig('quardir')) - except Exception: - self.logWarning(_("Unable to move file to trash, moving to quarantine instead")) + except Exception, e: + self.logWarning(_("Unable to move file to trash: %s, moving to quarantine instead") % e.message) pyfile.setCustomStatus(_("file moving")) shutil.move(file, self.getConfig('quardir')) -- cgit v1.2.3 From e26ba64714e84745db1f6dfc73ccc8c68ad4abcc Mon Sep 17 00:00:00 2001 From: GammaC0de <GammaC0de@users.noreply.github.com> Date: Mon, 4 May 2015 02:22:06 +0300 Subject: even more --- module/plugins/hooks/ExtractArchive.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'module/plugins') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index d0a84364a..5b90b28fc 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -478,6 +478,9 @@ class ExtractArchive(Hook): except Exception, e: self.logWarning(_("Unable to move %s to trash: %s") % (os.path.basename(f), e.message)) + else: + self.logDebug(_("Successfully moved %s to trash") % os.path.basename(f)) + self.logInfo(name, _("Extracting finished")) extracted_files = archive.files or archive.list() -- cgit v1.2.3 From ee360021434803991226d1cc36e7221fb9cbc418 Mon Sep 17 00:00:00 2001 From: GammaC0de <GammaC0de@users.noreply.github.com> Date: Mon, 4 May 2015 02:24:23 +0300 Subject: even more --- module/plugins/hooks/AntiVirus.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/AntiVirus.py b/module/plugins/hooks/AntiVirus.py index 6823729af..c620f556d 100644 --- a/module/plugins/hooks/AntiVirus.py +++ b/module/plugins/hooks/AntiVirus.py @@ -85,11 +85,14 @@ class AntiVirus(Hook): pyfile.setCustomStatus(_("file moving")) shutil.move(file, self.getConfig('quardir')) - except Exception, e: + except Exception, e: self.logWarning(_("Unable to move file to trash: %s, moving to quarantine instead") % e.message) pyfile.setCustomStatus(_("file moving")) shutil.move(file, self.getConfig('quardir')) + else: + self.logDebug(_("Successfully moved file to trash")) + elif action == "Quarantine": pyfile.setCustomStatus(_("file moving")) shutil.move(file, self.getConfig('quardir')) -- cgit v1.2.3 From 55717d96c0ef590f9c224741415447b8adb12f95 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@users.noreply.github.com> Date: Mon, 4 May 2015 21:30:39 +0200 Subject: [SizedriveCom] Cleanup --- module/plugins/hoster/SizedriveCom.py | 7 +++---- module/plugins/hoster/ZippyshareCom.py | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/SizedriveCom.py b/module/plugins/hoster/SizedriveCom.py index 13a29eb99..3b9748fb6 100644 --- a/module/plugins/hoster/SizedriveCom.py +++ b/module/plugins/hoster/SizedriveCom.py @@ -17,9 +17,10 @@ class SizedriveCom(SimpleHoster): __authors__ = [("GammaC0de", None)] + NAME_PATTERN = r'>Nome:</b> (?P<N>.+?)<' + SIZE_PATTERN = r'>Tamanho:</b>(?P<S>[\d.,]+) (?P<U>[\w^_]+)' OFFLINE_PATTERN = r'ARQUIVO DELATADO POR' - NAME_PATTERN = r'<b>Nome:</b> (?P<N>.+)<' - SIZE_PATTERN = r'<b>Tamanho:</b>(?P<S>[\d.,]+) (?P<U>[\w^_]+)' + def setup(self): self.resumeDownload = False @@ -35,8 +36,6 @@ class SizedriveCom(SimpleHoster): m = re.search(r'<span id="boton_download" ><a href="(.+?)"', self.html) if m: self.link = m.group(1) - else: - self.error(_("Download link not found")) getInfo = create_getInfo(SizedriveCom) diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py index fbac432cd..c47ac4fe1 100644 --- a/module/plugins/hoster/ZippyshareCom.py +++ b/module/plugins/hoster/ZippyshareCom.py @@ -66,7 +66,7 @@ class ZippyshareCom(SimpleHoster): initScripts = set() def replElementById(element): - id = element.group(1) # id might be either 'x' (a real id) or x (a variable) + id = element.group(1) # id might be either 'x' (a real id) or x (a variable) attr = element.group(4) # attr might be None varName = re.sub(r'-', '', 'GVAR[%s+"_%s"]' %(id, attr)) -- cgit v1.2.3 From f076e6c4d52bae232aa508c3afb6166d7ea9af2d Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@users.noreply.github.com> Date: Mon, 4 May 2015 21:31:34 +0200 Subject: [GoogledriveCom][OneFichierCom][UlozTo] Reset DISPOSITION to False --- module/plugins/hoster/GoogledriveCom.py | 4 +++- module/plugins/hoster/OneFichierCom.py | 10 +++++----- module/plugins/hoster/UlozTo.py | 3 ++- 3 files changed, 10 insertions(+), 7 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/GoogledriveCom.py b/module/plugins/hoster/GoogledriveCom.py index 66f36e6c0..09c54a8da 100644 --- a/module/plugins/hoster/GoogledriveCom.py +++ b/module/plugins/hoster/GoogledriveCom.py @@ -12,7 +12,7 @@ from module.utils import html_unescape class GoogledriveCom(SimpleHoster): __name__ = "GoogledriveCom" __type__ = "hoster" - __version__ = "0.07" + __version__ = "0.08" __pattern__ = r'https?://(?:www\.)?drive\.google\.com/file/.+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -22,6 +22,8 @@ class GoogledriveCom(SimpleHoster): __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] + DISPOSITION = False #: Remove in 0.4.10 + NAME_PATTERN = r'"og:title" content="(?P<N>.*?)">' OFFLINE_PATTERN = r'align="center"><p class="errorMessage"' diff --git a/module/plugins/hoster/OneFichierCom.py b/module/plugins/hoster/OneFichierCom.py index 8a5fa9cae..4b947c554 100644 --- a/module/plugins/hoster/OneFichierCom.py +++ b/module/plugins/hoster/OneFichierCom.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class OneFichierCom(SimpleHoster): __name__ = "OneFichierCom" __type__ = "hoster" - __version__ = "0.83" + __version__ = "0.84" __pattern__ = r'https?://(?:www\.)?(?:(?P<ID1>\w+)\.)?(?P<HOST>1fichier\.com|alterupload\.com|cjoint\.net|d(es)?fichiers\.com|dl4free\.com|megadl\.fr|mesfichiers\.org|piecejointe\.net|pjointe\.com|tenvoi\.com)(?:/\?(?P<ID2>\w+))?' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -25,13 +25,13 @@ class OneFichierCom(SimpleHoster): ("Ludovic Lehmann", "ludo.lehmann@gmail.com")] - NAME_PATTERN = r'>FileName :</td>\s*<td.*>(?P<N>.+?)<' - SIZE_PATTERN = r'>Size :</td>\s*<td.*>(?P<S>[\d.,]+) (?P<U>[\w^_]+)' + COOKIES = [("1fichier.com", "LG", "en")] + DISPOSITION = False #: Remove in 0.4.10 + NAME_PATTERN = r'>FileName :</td>\s*<td.*>(?P<N>.+?)<' + SIZE_PATTERN = r'>Size :</td>\s*<td.*>(?P<S>[\d.,]+) (?P<U>[\w^_]+)' OFFLINE_PATTERN = r'File not found !\s*<' - COOKIES = [("1fichier.com", "LG", "en")] - WAIT_PATTERN = r'>You must wait \d+ minutes' diff --git a/module/plugins/hoster/UlozTo.py b/module/plugins/hoster/UlozTo.py index c48873387..b43ff8d92 100644 --- a/module/plugins/hoster/UlozTo.py +++ b/module/plugins/hoster/UlozTo.py @@ -15,7 +15,7 @@ def convertDecimalPrefix(m): class UlozTo(SimpleHoster): __name__ = "UlozTo" __type__ = "hoster" - __version__ = "1.08" + __version__ = "1.09" __pattern__ = r'http://(?:www\.)?(uloz\.to|ulozto\.(cz|sk|net)|bagruj\.cz|zachowajto\.pl)/(?:live/)?(?P<ID>\w+/[^/?]*)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -34,6 +34,7 @@ class UlozTo(SimpleHoster): SIZE_REPLACEMENTS = [(r'([\d.]+)\s([kMG])B', convertDecimalPrefix)] CHECK_TRAFFIC = True + DISPOSITION = False #: Remove in 0.4.10 ADULT_PATTERN = r'<form action="(.+?)" method="post" id="frm-askAgeForm">' PASSWD_PATTERN = r'<div class="passwordProtectedFile">' -- cgit v1.2.3 From 8483aacbcd7f3f4c6ad92ef2255b449b88d64a35 Mon Sep 17 00:00:00 2001 From: GammaC0de <GammaC0de@users.noreply.github.com> Date: Tue, 5 May 2015 01:23:31 +0300 Subject: fix bug causing `extractQueued` called twice --- module/plugins/hooks/ExtractArchive.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 05a1e368a..62eb36714 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -187,6 +187,11 @@ class ExtractArchive(Hook): @threaded def extractQueued(self, thread): + if self.extracting: #@NOTE: doing the check here for safty (called by coreReady) + return + + self.extracting = True + packages = self.queue.get() while packages: if self.lastPackage: #: called from allDownloadsProcessed @@ -200,6 +205,8 @@ class ExtractArchive(Hook): packages = self.queue.get() #: check for packages added during extraction + self.extracting = False + @Expose def extractPackage(self, *ids): @@ -222,7 +229,7 @@ class ExtractArchive(Hook): def allDownloadsProcessed(self): self.lastPackage = True - if not self.extracting: + if self.getConfig('waitall') and not self.extracting: self.extractQueued() @@ -231,8 +238,6 @@ class ExtractArchive(Hook): if not ids: return False - self.extracting = True - processed = [] extracted = [] failed = [] @@ -374,7 +379,6 @@ class ExtractArchive(Hook): self.queue.remove(pid) - self.extracting = False return True if not failed else False -- cgit v1.2.3 From e3d3ad079d8af1806a475020aeb7e9fdc5a26600 Mon Sep 17 00:00:00 2001 From: GammaC0de <GammaC0de@users.noreply.github.com> Date: Tue, 5 May 2015 01:33:17 +0300 Subject: Update ExtractArchive.py --- module/plugins/hooks/ExtractArchive.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 62eb36714..bd8153a73 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -110,7 +110,7 @@ class ArchiveQueue(object): class ExtractArchive(Hook): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.42" + __version__ = "1.43" __config__ = [("activated" , "bool" , "Activated" , True ), ("fullpath" , "bool" , "Extract with full paths" , True ), -- cgit v1.2.3 From 4160919db621472e85460d0f4ec0052e3536ec93 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@users.noreply.github.com> Date: Tue, 5 May 2015 01:43:10 +0200 Subject: [SimpleHoster] Why Premium download fails? --- module/plugins/internal/SimpleHoster.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index df3d66ea2..f77a31ae2 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -244,7 +244,7 @@ def secondsToMidnight(gmt=0): class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "1.40" + __version__ = "1.41" __pattern__ = r'^unmatchable$' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -489,7 +489,7 @@ class SimpleHoster(Hoster): except Fail, e: #@TODO: Move to PluginThread in 0.4.10 if self.premium: - self.logWarning(_("Premium download failed")) + self.logWarning(_("Premium download failed"), e) self.retryFree() else: raise Fail(e) -- cgit v1.2.3 From 430630fc3158e5dc5412824095f058a0be295edb Mon Sep 17 00:00:00 2001 From: GammaC0de <GammaC0de@users.noreply.github.com> Date: Tue, 5 May 2015 20:50:50 +0300 Subject: Update ExtractArchive.py --- module/plugins/hooks/ExtractArchive.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 07a2ba228..5b9e3f30b 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -110,7 +110,7 @@ class ArchiveQueue(object): class ExtractArchive(Hook): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.43" + __version__ = "1.44" __config__ = [("activated" , "bool" , "Activated" , True ), ("fullpath" , "bool" , "Extract with full paths" , True ), -- cgit v1.2.3 From 44c994bbd576182c4a499c8c9292e2ef18d9a6b6 Mon Sep 17 00:00:00 2001 From: GammaC0de <GammaC0de@users.noreply.github.com> Date: Tue, 5 May 2015 21:10:14 +0300 Subject: Update YadiSk.py --- module/plugins/hoster/YadiSk.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/YadiSk.py b/module/plugins/hoster/YadiSk.py index ad63ffb32..54050fb9b 100644 --- a/module/plugins/hoster/YadiSk.py +++ b/module/plugins/hoster/YadiSk.py @@ -10,9 +10,9 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class YadiSk(SimpleHoster): __name__ = "YadiSk" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.05" - __pattern__ = r'https?://yadi\.sk/d/\w+' + __pattern__ = r'https?://yadi\.sk/d/.+' __description__ = """Yadi.sk hoster plugin""" __license__ = "GPLv3" -- cgit v1.2.3 From 3f84c0b2defeb5298e8cc63381e274d8bad66e80 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@users.noreply.github.com> Date: Tue, 5 May 2015 23:34:08 +0200 Subject: [XFSCrypter] Improve LINK_PATTERN (2) --- module/plugins/internal/XFSCrypter.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/internal/XFSCrypter.py b/module/plugins/internal/XFSCrypter.py index 0612be876..c4809ec46 100644 --- a/module/plugins/internal/XFSCrypter.py +++ b/module/plugins/internal/XFSCrypter.py @@ -6,7 +6,7 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo class XFSCrypter(SimpleCrypter): __name__ = "XFSCrypter" __type__ = "crypter" - __version__ = "0.07" + __version__ = "0.08" __pattern__ = r'^unmatchable$' @@ -19,8 +19,8 @@ class XFSCrypter(SimpleCrypter): URL_REPLACEMENTS = [(r'&?per_page=\d+', ""), (r'[?/&]+$', ""), (r'(.+/[^?]+)$', r'\1?'), (r'$', r'&per_page=10000')] - LINK_PATTERN = r'<a href="(.+?)".*?>.+?(?:</a>)?\s*</(?:td|TD)>' - NAME_PATTERN = r'<[tT]itle>.*?\: (?P<N>.+) folder</[tT]itle>' + LINK_PATTERN = r'<a href="(.+?)".*?>.+?(?:</a>)?\s*(<.+>\s*)?</(?:td|TD)>' + NAME_PATTERN = r'<[Tt]itle>.*?\: (?P<N>.+) folder</[Tt]itle>' OFFLINE_PATTERN = r'>\s*\w+ (Not Found|file (was|has been) removed)' TEMP_OFFLINE_PATTERN = r'>\s*\w+ server (is in )?(maintenance|maintainance)' -- cgit v1.2.3 From 93c4b9c09745f7cf583341991eb475ee84d2361b Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@users.noreply.github.com> Date: Wed, 6 May 2015 00:12:00 +0200 Subject: [XFSHoster] Fix WAIT_PATTERN --- module/plugins/internal/XFSHoster.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py index 33dc6d16b..8dab0bb4f 100644 --- a/module/plugins/internal/XFSHoster.py +++ b/module/plugins/internal/XFSHoster.py @@ -13,7 +13,7 @@ from module.utils import html_unescape class XFSHoster(SimpleHoster): __name__ = "XFSHoster" __type__ = "hoster" - __version__ = "0.46" + __version__ = "0.47" __pattern__ = r'^unmatchable$' @@ -36,7 +36,7 @@ class XFSHoster(SimpleHoster): OFFLINE_PATTERN = r'>\s*\w+ (Not Found|file (was|has been) removed)' TEMP_OFFLINE_PATTERN = r'>\s*\w+ server (is in )?(maintenance|maintainance)' - WAIT_PATTERN = r'<span id="countdown_str">.*?>(\d+)</span>|id="countdown" value=".*?(\d+).*?"' + WAIT_PATTERN = r'<span id="countdown_str".*>(\d+)</span>|id="countdown" value=".*?(\d+).*?"' PREMIUM_ONLY_PATTERN = r'>This file is available for Premium Users only' ERROR_PATTERN = r'(?:class=["\']err["\'].*?>|<[Cc]enter><b>|>Error</td>|>\(ERROR:)(?:\s*<.+?>\s*)*(.+?)(?:["\']|<|\))' @@ -148,10 +148,7 @@ class XFSHoster(SimpleHoster): action, inputs = self.parseHtmlForm('F1') if not inputs: - if self.errmsg: - self.retry(reason=self.errmsg) - else: - self.error(_("TEXTAREA F1 not found")) + self.retry(reason=self.errmsg or _("TEXTAREA F1 not found")) self.logDebug(inputs) @@ -204,7 +201,7 @@ class XFSHoster(SimpleHoster): self.fail(_("File can be downloaded by premium users only")) elif 'limit' in self.errmsg: - if 'days' in self.errmsg: + if 'day' in self.errmsg: delay = secondsToMidnight(gmt=2) retries = 3 else: @@ -242,10 +239,7 @@ class XFSHoster(SimpleHoster): if not inputs: action, inputs = self.parseHtmlForm('F1') if not inputs: - if self.errmsg: - self.retry(reason=self.errmsg) - else: - self.error(_("TEXTAREA F1 not found")) + self.retry(reason=self.errmsg or _("TEXTAREA F1 not found")) self.logDebug(inputs) -- cgit v1.2.3 From 5c153e02a6eaebb721c85202b54401fa2c1f08fc Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@users.noreply.github.com> Date: Wed, 6 May 2015 00:14:25 +0200 Subject: [SimpleHoster] Fallback option --- module/plugins/hoster/YadiSk.py | 2 +- module/plugins/internal/SimpleHoster.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/YadiSk.py b/module/plugins/hoster/YadiSk.py index 54050fb9b..3b4c9d985 100644 --- a/module/plugins/hoster/YadiSk.py +++ b/module/plugins/hoster/YadiSk.py @@ -12,7 +12,7 @@ class YadiSk(SimpleHoster): __type__ = "hoster" __version__ = "0.05" - __pattern__ = r'https?://yadi\.sk/d/.+' + __pattern__ = r'https?://yadi\.sk/d/[\w-]+' __description__ = """Yadi.sk hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index f77a31ae2..0039d3f8e 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -244,10 +244,11 @@ def secondsToMidnight(gmt=0): class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "1.41" + __version__ = "1.42" __pattern__ = r'^unmatchable$' - __config__ = [("use_premium", "bool", "Use premium account if available", True)] + __config__ = [("use_premium", "bool", "Use premium account if available" , True), + ("fallback" , "bool", "Fallback to free download if premium fails", True)] __description__ = """Simple hoster plugin""" __license__ = "GPLv3" @@ -488,7 +489,7 @@ class SimpleHoster(Hoster): self.checkFile() except Fail, e: #@TODO: Move to PluginThread in 0.4.10 - if self.premium: + if self.getConfig('fallback', True) and self.premium: self.logWarning(_("Premium download failed"), e) self.retryFree() else: @@ -748,7 +749,7 @@ class SimpleHoster(Hoster): self.premium = False self.account = None self.req = self.core.requestFactory.getRequest(self.__name__) - self.retries = 0 + self.retries = -1 raise Retry(_("Fallback to free download")) -- cgit v1.2.3 From 7b095378cba22aa2cfadfd62699d77bf1724da41 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@users.noreply.github.com> Date: Wed, 6 May 2015 01:24:17 +0200 Subject: [XFSCrypter] Fix LINK_PATTERN (thx GammaC0de) --- module/plugins/internal/XFSCrypter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/internal/XFSCrypter.py b/module/plugins/internal/XFSCrypter.py index c4809ec46..80eff53ea 100644 --- a/module/plugins/internal/XFSCrypter.py +++ b/module/plugins/internal/XFSCrypter.py @@ -6,7 +6,7 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo class XFSCrypter(SimpleCrypter): __name__ = "XFSCrypter" __type__ = "crypter" - __version__ = "0.08" + __version__ = "0.09" __pattern__ = r'^unmatchable$' @@ -19,7 +19,7 @@ class XFSCrypter(SimpleCrypter): URL_REPLACEMENTS = [(r'&?per_page=\d+', ""), (r'[?/&]+$', ""), (r'(.+/[^?]+)$', r'\1?'), (r'$', r'&per_page=10000')] - LINK_PATTERN = r'<a href="(.+?)".*?>.+?(?:</a>)?\s*(<.+>\s*)?</(?:td|TD)>' + LINK_PATTERN = r'<(?:td|TD).*?>\s*(?:<.+>\s*)?<a href="(.+?)".*?>.+?(?:</a>)?\s*(?:<.+>\s*)?</(?:td|TD)>' NAME_PATTERN = r'<[Tt]itle>.*?\: (?P<N>.+) folder</[Tt]itle>' OFFLINE_PATTERN = r'>\s*\w+ (Not Found|file (was|has been) removed)' -- cgit v1.2.3 From 78e87559dd0afd48528d599c5c7b79d5c154b718 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@users.noreply.github.com> Date: Wed, 6 May 2015 02:08:16 +0200 Subject: [LinkdecrypterComHook] Fix https://github.com/pyload/pyload/issues/1397 --- module/plugins/hooks/LinkdecrypterComHook.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/LinkdecrypterComHook.py b/module/plugins/hooks/LinkdecrypterComHook.py index 596a397a4..d0ec83c0b 100644 --- a/module/plugins/hooks/LinkdecrypterComHook.py +++ b/module/plugins/hooks/LinkdecrypterComHook.py @@ -8,7 +8,7 @@ from module.plugins.internal.MultiHook import MultiHook class LinkdecrypterComHook(MultiHook): __name__ = "LinkdecrypterComHook" __type__ = "hook" - __version__ = "1.04" + __version__ = "1.05" __config__ = [("activated" , "bool" , "Activated" , True ), ("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), @@ -22,5 +22,11 @@ class LinkdecrypterComHook(MultiHook): def getCrypters(self): - return re.search(r'>Supported\(\d+\)</b>: <i>(.[\w.\-, ]+)', + list = re.search(r'>Supported\(\d+\)</b>: <i>(.[\w.\-, ]+)', self.getURL("http://linkdecrypter.com/", decode=True).replace("(g)", "")).group(1).split(', ') + try: + list.remove("download.serienjunkies.org") + except ValueError: + pass + + return list -- cgit v1.2.3 From 23ce82416f3a46295f8639dd72c2b265080497c1 Mon Sep 17 00:00:00 2001 From: lpiter <revelation@o2.pl> Date: Wed, 6 May 2015 21:56:44 +0200 Subject: Add Openload.io hoster plugin. --- module/plugins/hoster/OpenloadIo.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 module/plugins/hoster/OpenloadIo.py (limited to 'module/plugins') diff --git a/module/plugins/hoster/OpenloadIo.py b/module/plugins/hoster/OpenloadIo.py new file mode 100644 index 000000000..c31b5b997 --- /dev/null +++ b/module/plugins/hoster/OpenloadIo.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + + +class OpenloadIo(SimpleHoster): + __name__ = "OpenloadIo" + __type__ = "hoster" + __version__ = "0.01" + + __pattern__ = r'https?://(?:www\.)?openload\.io/f/\w{11}' + + __description__ = """Openload.io hoster plugin""" + __license__ = "GPLv3" + + NAME_PATTERN = r'<span id="filename">(?P<N>.+)</' + SIZE_PATTERN = r'<span class="count">(?P<S>[\d.,]+) (?P<U>[\w^_]+)<' + OFFLINE_PATTERN = r">(We can't find the file you are looking for)" + + LINK_FREE_PATTERN = r'id="realdownload"><a href="(https?://[\w\.]+\.openload\.io/dl/.*?)"' + + def setup(self): + self.multiDL = True + self.chunkLimit = 1 + +getInfo = create_getInfo(OpenloadIo) -- cgit v1.2.3 From b2fe8292de4390a34a552122ccc5f02aa1b06e5f Mon Sep 17 00:00:00 2001 From: GammaC0de <GammaC0de@users.noreply.github.com> Date: Fri, 8 May 2015 13:27:29 +0300 Subject: [FilefactoryCom] update OFFLINE_PATTERN --- module/plugins/hoster/FilefactoryCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/FilefactoryCom.py b/module/plugins/hoster/FilefactoryCom.py index 0a9d5e2cc..ea1a38b7a 100644 --- a/module/plugins/hoster/FilefactoryCom.py +++ b/module/plugins/hoster/FilefactoryCom.py @@ -20,7 +20,7 @@ def getInfo(urls): class FilefactoryCom(SimpleHoster): __name__ = "FilefactoryCom" __type__ = "hoster" - __version__ = "0.54" + __version__ = "0.55" __pattern__ = r'https?://(?:www\.)?filefactory\.com/(file|trafficshare/\w+)/\w+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -32,7 +32,7 @@ class FilefactoryCom(SimpleHoster): INFO_PATTERN = r'<div id="file_name"[^>]*>\s*<h2>(?P<N>[^<]+)</h2>\s*<div id="file_info">\s*(?P<S>[\d.,]+) (?P<U>[\w^_]+) uploaded' - OFFLINE_PATTERN = r'<h2>File Removed</h2>|This file is no longer available' + OFFLINE_PATTERN = r'<h2>File Removed</h2>|This file is no longer available|Invalid Download Link' LINK_FREE_PATTERN = LINK_PREMIUM_PATTERN = r'"([^"]+filefactory\.com/get.+?)"' -- cgit v1.2.3 From 4bda1fc8a957daab0e3496cddaa4705785f48f19 Mon Sep 17 00:00:00 2001 From: GammaC0de <GammaC0de@users.noreply.github.com> Date: Fri, 8 May 2015 13:44:01 +0300 Subject: BillionuploadsCom out of bussiness --- module/plugins/hoster/BillionuploadsCom.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/BillionuploadsCom.py b/module/plugins/hoster/BillionuploadsCom.py index 7d7e2624a..248670489 100644 --- a/module/plugins/hoster/BillionuploadsCom.py +++ b/module/plugins/hoster/BillionuploadsCom.py @@ -3,10 +3,10 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo -class BillionuploadsCom(XFSHoster): +class BillionuploadsCom(DeadHoster): __name__ = "BillionuploadsCom" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.05" __pattern__ = r'http://(?:www\.)?billionuploads\.com/\w{12}' @@ -15,8 +15,4 @@ class BillionuploadsCom(XFSHoster): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - NAME_PATTERN = r'<td class="dofir" title="(?P<N>.+?)"' - SIZE_PATTERN = r'<td class="dofir">(?P<S>[\d.,]+) (?P<U>[\w^_]+)' - - getInfo = create_getInfo(BillionuploadsCom) -- cgit v1.2.3 From d998725162fe21c4b88a716403a2eb2cdaabfec1 Mon Sep 17 00:00:00 2001 From: GammaC0de <GammaC0de@users.noreply.github.com> Date: Fri, 8 May 2015 13:50:24 +0300 Subject: Delete BillionuploadsCom.py --- module/plugins/accounts/BillionuploadsCom.py | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 module/plugins/accounts/BillionuploadsCom.py (limited to 'module/plugins') diff --git a/module/plugins/accounts/BillionuploadsCom.py b/module/plugins/accounts/BillionuploadsCom.py deleted file mode 100644 index 11af36591..000000000 --- a/module/plugins/accounts/BillionuploadsCom.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.internal.XFSAccount import XFSAccount - - -class BillionuploadsCom(XFSAccount): - __name__ = "BillionuploadsCom" - __type__ = "account" - __version__ = "0.02" - - __description__ = """Billionuploads.com account plugin""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - - HOSTER_DOMAIN = "billionuploads.com" -- cgit v1.2.3 From c9b050782d09453d6f85154d2b261719ba69cf00 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@users.noreply.github.com> Date: Fri, 8 May 2015 17:34:54 +0200 Subject: [ShareonlineBiz] Fix https://github.com/pyload/pyload/issues/1403 --- module/plugins/accounts/ShareonlineBiz.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/accounts/ShareonlineBiz.py b/module/plugins/accounts/ShareonlineBiz.py index 7e05e2e76..8b32ab54d 100644 --- a/module/plugins/accounts/ShareonlineBiz.py +++ b/module/plugins/accounts/ShareonlineBiz.py @@ -8,7 +8,7 @@ from module.plugins.Account import Account class ShareonlineBiz(Account): __name__ = "ShareonlineBiz" __type__ = "account" - __version__ = "0.31" + __version__ = "0.32" __description__ = """Share-online.biz account plugin""" __license__ = "GPLv3" @@ -40,7 +40,7 @@ class ShareonlineBiz(Account): if api['a'].lower() != "not_available": req.cj.setCookie("share-online.biz", 'a', api['a']) - premium = api['group'] in ("Premium", "PrePaid") + premium = api['group'] in ("PrePaid", "Premium", "Penalty-Premium") validuntil = float(api['expire_date']) -- cgit v1.2.3 From d52ddee1d43b4be610b265fbe87911494d1364ad Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@users.noreply.github.com> Date: Sat, 9 May 2015 03:29:27 +0200 Subject: [MultiHook] Remove unbound method 'getCrypters' --- module/plugins/hooks/LinkdecrypterComHook.py | 4 ++-- module/plugins/internal/MultiHook.py | 12 ++---------- 2 files changed, 4 insertions(+), 12 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/LinkdecrypterComHook.py b/module/plugins/hooks/LinkdecrypterComHook.py index d0ec83c0b..b2eaece62 100644 --- a/module/plugins/hooks/LinkdecrypterComHook.py +++ b/module/plugins/hooks/LinkdecrypterComHook.py @@ -8,7 +8,7 @@ from module.plugins.internal.MultiHook import MultiHook class LinkdecrypterComHook(MultiHook): __name__ = "LinkdecrypterComHook" __type__ = "hook" - __version__ = "1.05" + __version__ = "1.06" __config__ = [("activated" , "bool" , "Activated" , True ), ("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), @@ -21,7 +21,7 @@ class LinkdecrypterComHook(MultiHook): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - def getCrypters(self): + def getHosters(self): list = re.search(r'>Supported\(\d+\)</b>: <i>(.[\w.\-, ]+)', self.getURL("http://linkdecrypter.com/", decode=True).replace("(g)", "")).group(1).split(', ') try: diff --git a/module/plugins/internal/MultiHook.py b/module/plugins/internal/MultiHook.py index 51c8ea89f..01ff4b07d 100644 --- a/module/plugins/internal/MultiHook.py +++ b/module/plugins/internal/MultiHook.py @@ -11,7 +11,7 @@ from module.utils import decode, remove_chars class MultiHook(Hook): __name__ = "MultiHook" __type__ = "hook" - __version__ = "0.44" + __version__ = "0.45" __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)", "" ), @@ -121,7 +121,7 @@ class MultiHook(Hook): for _i in xrange(2): try: - pluginset = self._pluginSet(self.getHosters() if self.plugintype == "hoster" else self.getCrypters()) + pluginset = self._pluginSet(self.getHosters()) break except Exception, e: @@ -171,14 +171,6 @@ class MultiHook(Hook): raise NotImplementedError - def getCrypters(self): - """Load list of supported crypters - - :return: List of domain names - """ - raise NotImplementedError - - #: Threaded _periodical, remove in 0.4.10 and use built-in flag for that def _periodical(self): try: -- cgit v1.2.3 From c4810d1dbf367c4859a00c18b640fdb86a18ff8f Mon Sep 17 00:00:00 2001 From: GammaC0de <GammaC0de@users.noreply.github.com> Date: Sat, 9 May 2015 22:38:09 +0300 Subject: [ClickAndLoad] fix bug when webinterface uses SSL --- module/plugins/hooks/ClickAndLoad.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/ClickAndLoad.py b/module/plugins/hooks/ClickAndLoad.py index 2ddd66daa..1fa89840b 100644 --- a/module/plugins/hooks/ClickAndLoad.py +++ b/module/plugins/hooks/ClickAndLoad.py @@ -3,6 +3,11 @@ import socket import time +try: + import ssl +except ImportError: + pass + from threading import Lock from module.plugins.Hook import Hook, threaded @@ -24,7 +29,7 @@ def forward(source, destination): class ClickAndLoad(Hook): __name__ = "ClickAndLoad" __type__ = "hook" - __version__ = "0.41" + __version__ = "0.42" __config__ = [("activated", "bool", "Activated" , True), ("port" , "int" , "Port" , 9666), @@ -79,6 +84,21 @@ class ClickAndLoad(Hook): self.logDebug("Connection from %s:%s" % client_addr) server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + + if self.config['webinterface']['https']: + try: + server_socket = ssl.wrap_socket(server_socket) + + except NameError: + self.logError(_("pyLoad's webinterface is configured to use HTTPS, Please install python's ssl lib or + client_socket.close() #: reset the connection. + continue + + except Exception, e: + self.logError(_("SSL error: %s") % e.message) + client_socket.close() #: reset the connection. + continue + server_socket.connect(("127.0.0.1", webport)) self.manager.startThread(forward, client_socket, server_socket) -- cgit v1.2.3 From d5cee0bbabfd60e020cd2cd9248c41b913e438c3 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@users.noreply.github.com> Date: Sat, 9 May 2015 22:27:11 +0200 Subject: [UnrestrictLi] Mark as dead --- module/plugins/accounts/UnrestrictLi.py | 44 ------------------- module/plugins/hooks/UnrestrictLiHook.py | 28 ------------ module/plugins/hoster/UnrestrictLi.py | 74 ++------------------------------ 3 files changed, 3 insertions(+), 143 deletions(-) delete mode 100644 module/plugins/accounts/UnrestrictLi.py delete mode 100644 module/plugins/hooks/UnrestrictLiHook.py (limited to 'module/plugins') diff --git a/module/plugins/accounts/UnrestrictLi.py b/module/plugins/accounts/UnrestrictLi.py deleted file mode 100644 index 6a8187234..000000000 --- a/module/plugins/accounts/UnrestrictLi.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.Account import Account -from module.common.json_layer import json_loads - - -class UnrestrictLi(Account): - __name__ = "UnrestrictLi" - __type__ = "account" - __version__ = "0.05" - - __description__ = """Unrestrict.li account plugin""" - __license__ = "GPLv3" - __authors__ = [("stickell", "l.stickell@yahoo.it")] - - - def loadAccountInfo(self, user, req): - json_data = req.load('http://unrestrict.li/api/jdownloader/user.php?format=json') - self.logDebug("JSON data: " + json_data) - json_data = json_loads(json_data) - - if 'vip' in json_data['result'] and json_data['result']['vip'] == 0: - return {"premium": False} - - validuntil = json_data['result']['expires'] - trafficleft = float(json_data['result']['traffic'] / 1024) #@TODO: Remove `/ 1024` in 0.4.10 - - return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} - - - def login(self, user, data, req): - req.cj.setCookie("unrestrict.li", "lang", "EN") - html = req.load("https://unrestrict.li/sign_in", decode=True) - - if 'solvemedia' in html: - self.logError(_("A Captcha is required. Go to http://unrestrict.li/sign_in and login, then retry")) - return - - post_data = {"username": user, "password": data['password'], - "remember_me": "remember", "signin": "Sign in"} - html = req.load("https://unrestrict.li/sign_in", post=post_data, decode=True) - - if 'sign_out' not in html: - self.wrongPassword() diff --git a/module/plugins/hooks/UnrestrictLiHook.py b/module/plugins/hooks/UnrestrictLiHook.py deleted file mode 100644 index f1ffd1886..000000000 --- a/module/plugins/hooks/UnrestrictLiHook.py +++ /dev/null @@ -1,28 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.common.json_layer import json_loads -from module.plugins.internal.MultiHook import MultiHook - - -class UnrestrictLiHook(MultiHook): - __name__ = "UnrestrictLiHook" - __type__ = "hook" - __version__ = "0.05" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), - ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 ), - ("history" , "bool" , "Delete History" , False)] - - __description__ = """Unrestrict.li hook plugin""" - __license__ = "GPLv3" - __authors__ = [("stickell", "l.stickell@yahoo.it")] - - - def getHosters(self): - json_data = self.getURL("http://unrestrict.li/api/jdownloader/hosts.php", get={'format': "json"}) - json_data = json_loads(json_data) - - return [element['host'] for element in json_data['result']] diff --git a/module/plugins/hoster/UnrestrictLi.py b/module/plugins/hoster/UnrestrictLi.py index dab5abd44..d3854db31 100644 --- a/module/plugins/hoster/UnrestrictLi.py +++ b/module/plugins/hoster/UnrestrictLi.py @@ -1,86 +1,18 @@ # -*- coding: utf-8 -*- -import re +from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo -from module.common.json_layer import json_loads -from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo -from module.plugins.internal.SimpleHoster import secondsToMidnight - -class UnrestrictLi(MultiHoster): +class UnrestrictLi(DeadHoster): __name__ = "UnrestrictLi" __type__ = "hoster" - __version__ = "0.22" + __version__ = "0.23" __pattern__ = r'https?://(?:www\.)?(unrestrict|unr)\.li/dl/[\w^_]+' - __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Unrestrict.li multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it")] - LOGIN_ACCOUNT = False - - - def setup(self): - self.chunkLimit = 16 - self.resumeDownload = True - - - def handleFree(self, pyfile): - for _i in xrange(5): - self.html = self.load('https://unrestrict.li/unrestrict.php', - post={'link': pyfile.url, 'domain': 'long'}) - - self.logDebug("JSON data: " + self.html) - - if self.html: - break - else: - self.logInfo(_("Unable to get API data, waiting 1 minute and retry")) - self.retry(5, 60, "Unable to get API data") - - if 'Expired session' in self.html \ - or ("You are not allowed to download from this host" in self.html and self.premium): - self.account.relogin(self.user) - self.retry() - - elif "File offline" in self.html: - self.offline() - - elif "You are not allowed to download from this host" in self.html: - self.fail(_("You are not allowed to download from this host")) - - elif "You have reached your daily limit for this host" in self.html: - self.logWarning(_("Reached daily limit for this host")) - self.retry(5, secondsToMidnight(gmt=2), "Daily limit for this host reached") - - elif "ERROR_HOSTER_TEMPORARILY_UNAVAILABLE" in self.html: - self.logInfo(_("Hoster temporarily unavailable, waiting 1 minute and retry")) - self.retry(5, 60, "Hoster is temporarily unavailable") - - self.html = json_loads(self.html) - self.link = self.html.keys()[0] - self.api_data = self.html[self.link] - - if hasattr(self, 'api_data'): - self.setNameSize() - - - def checkFile(self, rules={}): - super(UnrestrictLi, self).checkFile(rules) - - if self.getConfig('history'): - self.load("https://unrestrict.li/history/", get={'delete': "all"}) - self.logInfo(_("Download history deleted")) - - - def setNameSize(self): - if 'name' in self.api_data: - self.pyfile.name = self.api_data['name'] - if 'size' in self.api_data: - self.pyfile.size = self.api_data['size'] - - getInfo = create_getInfo(UnrestrictLi) -- cgit v1.2.3 From bca7f99801e91e8ee85fe45e8d36dbcf9078abac Mon Sep 17 00:00:00 2001 From: GammaC0de <GammaC0de@users.noreply.github.com> Date: Sat, 9 May 2015 23:32:40 +0300 Subject: Update BillionuploadsCom.py --- module/plugins/hoster/BillionuploadsCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/BillionuploadsCom.py b/module/plugins/hoster/BillionuploadsCom.py index 248670489..efe2c22a3 100644 --- a/module/plugins/hoster/BillionuploadsCom.py +++ b/module/plugins/hoster/BillionuploadsCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class BillionuploadsCom(DeadHoster): __name__ = "BillionuploadsCom" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" __pattern__ = r'http://(?:www\.)?billionuploads\.com/\w{12}' -- cgit v1.2.3 From 1582e816a8cb9a67f420cc9bf69cf2bba6dfbd04 Mon Sep 17 00:00:00 2001 From: GammaC0de <GammaC0de@users.noreply.github.com> Date: Sat, 9 May 2015 23:46:47 +0300 Subject: Update ClickAndLoad.py --- module/plugins/hooks/ClickAndLoad.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/ClickAndLoad.py b/module/plugins/hooks/ClickAndLoad.py index 1fa89840b..eb242de1f 100644 --- a/module/plugins/hooks/ClickAndLoad.py +++ b/module/plugins/hooks/ClickAndLoad.py @@ -90,7 +90,7 @@ class ClickAndLoad(Hook): server_socket = ssl.wrap_socket(server_socket) except NameError: - self.logError(_("pyLoad's webinterface is configured to use HTTPS, Please install python's ssl lib or + self.logError(_("pyLoad's webinterface is configured to use HTTPS, Please install python's ssl lib or disable HTTPS")) client_socket.close() #: reset the connection. continue -- cgit v1.2.3 From f22a5c784adcaf3e434fca78fb7eb0141b51c694 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@users.noreply.github.com> Date: Sat, 9 May 2015 22:53:31 +0200 Subject: [ClickAndLoad] Version up --- module/plugins/hooks/ClickAndLoad.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/ClickAndLoad.py b/module/plugins/hooks/ClickAndLoad.py index eb242de1f..a7862045e 100644 --- a/module/plugins/hooks/ClickAndLoad.py +++ b/module/plugins/hooks/ClickAndLoad.py @@ -29,7 +29,7 @@ def forward(source, destination): class ClickAndLoad(Hook): __name__ = "ClickAndLoad" __type__ = "hook" - __version__ = "0.42" + __version__ = "0.43" __config__ = [("activated", "bool", "Activated" , True), ("port" , "int" , "Port" , 9666), -- cgit v1.2.3 From c86a4ead904d3bb772338a3bf6024260d2bac121 Mon Sep 17 00:00:00 2001 From: Micha Jay <micha@kalle-l> Date: Mon, 11 May 2015 15:13:54 +0200 Subject: change trafficleft to unlimited when in Penalty-Premium state to ensure continues Downloads --- module/plugins/accounts/ShareonlineBiz.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/accounts/ShareonlineBiz.py b/module/plugins/accounts/ShareonlineBiz.py index 8b32ab54d..27371864e 100644 --- a/module/plugins/accounts/ShareonlineBiz.py +++ b/module/plugins/accounts/ShareonlineBiz.py @@ -45,8 +45,11 @@ class ShareonlineBiz(Account): validuntil = float(api['expire_date']) traffic = float(api['traffic_1d'].split(";")[0]) - maxtraffic = max(maxtraffic, traffic) - trafficleft = maxtraffic - traffic + + if maxtraffic > traffic: + trafficleft = maxtraffic - traffic + else: + trafficleft = -1 maxtraffic /= 1024 #@TODO: Remove `/ 1024` in 0.4.10 trafficleft /= 1024 #@TODO: Remove `/ 1024` in 0.4.10 -- cgit v1.2.3 From 87164856d5d190c830609e296f47fde6820d023b Mon Sep 17 00:00:00 2001 From: smoozed <github@smoozed.com> Date: Mon, 11 May 2015 17:43:10 +0200 Subject: Fixed #1399 When the account is not premium, check if there is trial time left. --- module/plugins/accounts/SmoozedCom.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/accounts/SmoozedCom.py b/module/plugins/accounts/SmoozedCom.py index 56cd1864a..8fb997b54 100644 --- a/module/plugins/accounts/SmoozedCom.py +++ b/module/plugins/accounts/SmoozedCom.py @@ -34,7 +34,6 @@ class SmoozedCom(Account): def loadAccountInfo(self, user, req): - # Get user data from premiumize.me status = self.getAccountStatus(user, req) self.logDebug(status) @@ -51,7 +50,10 @@ class SmoozedCom(Account): 'hosters' : [hoster["name"] for hoster in status["data"]["hoster"]]} if info['validuntil'] < time.time(): - info['premium'] = False + if float(status["data"]["user"].get("user_trial", 0)) > time.time(): + info['premium'] = True + else: + info['premium'] = False else: info['premium'] = True -- cgit v1.2.3 From 6faf688fdd1657826d0db99fd9ff4f9c94582721 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@users.noreply.github.com> Date: Mon, 11 May 2015 20:10:40 +0200 Subject: [ShareonlineBiz][SmoozedCom] Version up --- module/plugins/accounts/ShareonlineBiz.py | 2 +- module/plugins/accounts/SmoozedCom.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/accounts/ShareonlineBiz.py b/module/plugins/accounts/ShareonlineBiz.py index 27371864e..4214b4401 100644 --- a/module/plugins/accounts/ShareonlineBiz.py +++ b/module/plugins/accounts/ShareonlineBiz.py @@ -8,7 +8,7 @@ from module.plugins.Account import Account class ShareonlineBiz(Account): __name__ = "ShareonlineBiz" __type__ = "account" - __version__ = "0.32" + __version__ = "0.33" __description__ = """Share-online.biz account plugin""" __license__ = "GPLv3" diff --git a/module/plugins/accounts/SmoozedCom.py b/module/plugins/accounts/SmoozedCom.py index 8fb997b54..1c303331b 100644 --- a/module/plugins/accounts/SmoozedCom.py +++ b/module/plugins/accounts/SmoozedCom.py @@ -26,7 +26,7 @@ from module.plugins.Account import Account class SmoozedCom(Account): __name__ = "SmoozedCom" __type__ = "account" - __version__ = "0.04" + __version__ = "0.05" __description__ = """Smoozed.com account plugin""" __license__ = "GPLv3" -- cgit v1.2.3 From ac3211e9d24e474a6b46c2b8b63f09d8ac928fca Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@users.noreply.github.com> Date: Mon, 11 May 2015 23:29:23 +0200 Subject: [SmoozedCom] Fix https://github.com/pyload/pyload/issues/1399 (2) --- module/plugins/hoster/SmoozedCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/SmoozedCom.py b/module/plugins/hoster/SmoozedCom.py index 5d453cf57..9ae12f145 100644 --- a/module/plugins/hoster/SmoozedCom.py +++ b/module/plugins/hoster/SmoozedCom.py @@ -7,7 +7,7 @@ from module.plugins.internal.MultiHoster import MultiHoster class SmoozedCom(MultiHoster): __name__ = "SmoozedCom" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.05" __pattern__ = r'^unmatchable$' #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.coreReady __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -17,7 +17,7 @@ class SmoozedCom(MultiHoster): __authors__ = [("", "")] - def handlePremium(self, pyfile): + def handleFree(self, pyfile): # In some cases hostsers do not supply us with a filename at download, so we # are going to set a fall back filename (e.g. for freakshare or xfileshare) pyfile.name = pyfile.name.split('/').pop() # Remove everthing before last slash -- cgit v1.2.3 From ebe4844903420d8f9527ec93fd1f6bf6ccfdaba5 Mon Sep 17 00:00:00 2001 From: GammaC0de <GammaC0de@users.noreply.github.com> Date: Sat, 16 May 2015 01:24:32 +0300 Subject: Update OboomCom.py --- module/plugins/hoster/OboomCom.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/OboomCom.py b/module/plugins/hoster/OboomCom.py index 725763345..fa15cfb09 100644 --- a/module/plugins/hoster/OboomCom.py +++ b/module/plugins/hoster/OboomCom.py @@ -13,9 +13,9 @@ from module.plugins.internal.CaptchaService import ReCaptcha class OboomCom(Hoster): __name__ = "OboomCom" __type__ = "hoster" - __version__ = "0.31" + __version__ = "0.32" - __pattern__ = r'https?://(?:www\.)?oboom\.com/(#(id=|/)?)?(?P<ID>\w{8})' + __pattern__ = r'https?://(?:www\.)?oboom\.com/(?:#(?:id=|/)?)?(?P<ID>\w{8})' __description__ = """oboom.com hoster plugin""" __license__ = "GPLv3" @@ -31,6 +31,7 @@ class OboomCom(Hoster): def process(self, pyfile): + self.html = self.load(pyfile.url) self.pyfile.url.replace(".com/#id=", ".com/#") self.pyfile.url.replace(".com/#/", ".com/#") self.getFileId(self.pyfile.url) -- cgit v1.2.3 From 9ec411e0ccd1b8cb40214f78197184adaaf9382b Mon Sep 17 00:00:00 2001 From: GammaC0de <GammaC0de@users.noreply.github.com> Date: Sat, 16 May 2015 02:18:58 +0300 Subject: Update OboomCom.py --- module/plugins/hoster/OboomCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/OboomCom.py b/module/plugins/hoster/OboomCom.py index fa15cfb09..cfc448ff0 100644 --- a/module/plugins/hoster/OboomCom.py +++ b/module/plugins/hoster/OboomCom.py @@ -31,9 +31,9 @@ class OboomCom(Hoster): def process(self, pyfile): - self.html = self.load(pyfile.url) self.pyfile.url.replace(".com/#id=", ".com/#") self.pyfile.url.replace(".com/#/", ".com/#") + self.html = self.load(pyfile.url) self.getFileId(self.pyfile.url) self.getSessionToken() self.getFileInfo(self.sessionToken, self.fileId) -- cgit v1.2.3 From fa7c07a2c123c040364f0f01eb0291ba197ec878 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@users.noreply.github.com> Date: Sat, 16 May 2015 01:56:35 +0200 Subject: [Ftp] Fixup --- module/plugins/hoster/Ftp.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/Ftp.py b/module/plugins/hoster/Ftp.py index 5258a1c27..295955cbe 100644 --- a/module/plugins/hoster/Ftp.py +++ b/module/plugins/hoster/Ftp.py @@ -11,7 +11,7 @@ from module.plugins.Hoster import Hoster class Ftp(Hoster): __name__ = "Ftp" __type__ = "hoster" - __version__ = "0.51" + __version__ = "0.52" __pattern__ = r'(?:ftps?|sftp)://([\w.-]+(:[\w.-]+)?@)?[\w.-]+(:\d+)?/.+' @@ -66,7 +66,7 @@ class Ftp(Hoster): #Naive ftp directory listing if re.search(r'^25\d.*?"', self.req.http.header, re.M): pyfile.url = pyfile.url.rstrip('/') - pkgname = "/".join(pyfile.package().name, urlparse.urlparse(pyfile.url).path.rpartition('/')[2]) + pkgname = "/".join([pyfile.package().name, urlparse.urlparse(pyfile.url).path.rpartition('/')[2]]) pyfile.url += '/' self.req.http.c.setopt(48, 1) # CURLOPT_DIRLISTONLY res = self.load(pyfile.url, decode=False) -- cgit v1.2.3 From f9fe2b162568417003bf9c1d2e2a45ffa9cf5098 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@users.noreply.github.com> Date: Mon, 18 May 2015 03:44:03 +0200 Subject: [XFSHoster] HAPPY_HOUR_PATTERN --- module/plugins/internal/XFSHoster.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'module/plugins') diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py index 8dab0bb4f..5e5d4111f 100644 --- a/module/plugins/internal/XFSHoster.py +++ b/module/plugins/internal/XFSHoster.py @@ -13,7 +13,7 @@ from module.utils import html_unescape class XFSHoster(SimpleHoster): __name__ = "XFSHoster" __type__ = "hoster" - __version__ = "0.47" + __version__ = "0.48" __pattern__ = r'^unmatchable$' @@ -38,6 +38,7 @@ class XFSHoster(SimpleHoster): WAIT_PATTERN = r'<span id="countdown_str".*>(\d+)</span>|id="countdown" value=".*?(\d+).*?"' PREMIUM_ONLY_PATTERN = r'>This file is available for Premium Users only' + HAPPY_HOUR_PATTERN = r'>[Hh]appy hour' ERROR_PATTERN = r'(?:class=["\']err["\'].*?>|<[Cc]enter><b>|>Error</td>|>\(ERROR:)(?:\s*<.+?>\s*)*(.+?)(?:["\']|<|\))' LINK_LEECH_PATTERN = r'<h2>Download Link</h2>\s*<textarea[^>]*>([^<]+)' @@ -181,6 +182,12 @@ class XFSHoster(SimpleHoster): m = re.search(self.ERROR_PATTERN, self.html) if m is None: self.errmsg = None + + if re.search(self.HAPPY_HOUR_PATTERN, self.html): + self.multiDL = True + else: + self.setup() + else: self.errmsg = m.group(1).strip() -- cgit v1.2.3 From 854adf6dd5c0742c4801f9779c038e12ee6b23cf Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@users.noreply.github.com> Date: Mon, 18 May 2015 05:24:41 +0200 Subject: [SimpleHoster] Improve checkErrors --- module/plugins/internal/SimpleHoster.py | 86 ++++++++++++++++++++++++++++----- module/plugins/internal/XFSHoster.py | 66 ++----------------------- 2 files changed, 77 insertions(+), 75 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 0039d3f8e..27327c918 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -244,7 +244,7 @@ def secondsToMidnight(gmt=0): class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "1.42" + __version__ = "1.43" __pattern__ = r'^unmatchable$' __config__ = [("use_premium", "bool", "Use premium account if available" , True), @@ -284,6 +284,18 @@ class SimpleHoster(Hoster): PREMIUM_ONLY_PATTERN: (optional) Check if the file can be downloaded only with a premium account example: PREMIUM_ONLY_PATTERN = r'Premium account required' + HAPPY_HOUR_PATTERN: (optional) + example: + + IP_BLOCKED_PATTERN: (optional) + example: + + DOWNLOAD_LIMIT_PATTERN: (optional) + example: + + SIZE_LIMIT_PATTERN: (optional) + example: + ERROR_PATTERN: (optional) Detect any error preventing download example: ERROR_PATTERN = r'' @@ -554,10 +566,39 @@ class SimpleHoster(Hoster): self.logWarning(_("No html code to check")) return - if hasattr(self, 'PREMIUM_ONLY_PATTERN') and not self.premium and re.search(self.PREMIUM_ONLY_PATTERN, self.html): - self.fail(_("Link require a premium account to be handled")) + if hasattr(self, 'IP_BLOCKED_PATTERN') and re.search(self.IP_BLOCKED_PATTERN, self.html): + self.fail(_("Connection from your current IP address is not allowed")) + + elif not self.premium: + if hasattr(self, 'PREMIUM_ONLY_PATTERN') and re.search(self.PREMIUM_ONLY_PATTERN, self.html): + self.fail(_("File can be downloaded by premium users only")) + + elif hasattr(self, 'SIZE_LIMIT_PATTERN') and re.search(self.SIZE_LIMIT_PATTERN, self.html): + self.fail(_("File too large for free download")) - elif hasattr(self, 'ERROR_PATTERN'): + elif hasattr(self, 'DOWNLOAD_LIMIT_PATTERN') and re.search(self.DOWNLOAD_LIMIT_PATTERN, self.html): + m = re.search(self.DOWNLOAD_LIMIT_PATTERN, self.html) + try: + errmsg = m.group(1).strip() + except Exception: + errmsg = m.group(0).strip() + + self.logWarning(re.sub(r'<.*?>', " ", self.errmsg)) + self.info['error'] = errmsg + + if re.search('da(il)?y|today', errmsg, re.I): + wait_time = secondsToMidnight(gmt=2) + else: + wait_time = sum(int(v) * {"hr": 3600, "hour": 3600, "min": 60, "sec": 1, "": 1}[u.lower()] for v, u in + re.findall(r'(\d+)\s*(hr|hour|min|sec|)', errmsg, re.I)) + + self.wantReconnect = wait_time > 300 + self.retry(1, wait_time, _("Download limit exceeded")) + + if hasattr(self, 'HAPPY_HOUR_PATTERN') and re.search(self.HAPPY_HOUR_PATTERN, self.html): + self.multiDL = True + + if hasattr(self, 'ERROR_PATTERN'): m = re.search(self.ERROR_PATTERN, self.html) if m: try: @@ -565,19 +606,40 @@ class SimpleHoster(Hoster): except Exception: errmsg = m.group(0).strip() + self.logWarning(re.sub(r'<.*?>', " ", self.errmsg)) self.info['error'] = errmsg - if "hour" in errmsg: - self.wait(1 * 60 * 60, True) + if re.search('limit|wait', errmsg, re.I): + if re.search("da(il)?y|today", errmsg): + wait_time = secondsToMidnight(gmt=2) + else: + wait_time = sum(int(v) * {"hr": 3600, "hour": 3600, "min": 60, "sec": 1, "": 1}[u.lower()] for v, u in + re.findall(r'(\d+)\s*(hr|hour|min|sec|)', errmsg, re.I)) + + self.wantReconnect = wait_time > 300 + self.retry(1, wait_time, _("Download limit exceeded")) + + elif re.search('country', errmsg, re.I): + self.fail(_("Connection from your current IP address is not allowed")) + + elif re.search('captcha', errmsg, re.I): + self.invalidCaptcha() + + elif re.search('countdown|expired', errmsg, re.I): + self.retry(wait_time=60, reason=_("Link expired")) + + elif re.search('maintenance|maintainance', errmsg, re.I): + self.tempOffline() - elif re.search("da(il)?y|today", errmsg): - self.wait(secondsToMidnight(gmt=2), True) + elif re.search('up to', errmsg, re.I): + self.fail(_("File too large for free download")) - elif "minute" in errmsg: - self.wait(1 * 60) + elif re.search('premium', errmsg, re.I): + self.fail(_("File can be downloaded by premium users only")) else: - self.error(errmsg) + self.wantReconnect = True + self.retry(wait_time=60, reason=errmsg) elif hasattr(self, 'WAIT_PATTERN'): m = re.search(self.WAIT_PATTERN, self.html) @@ -611,7 +673,7 @@ class SimpleHoster(Hoster): self.tempOffline() elif status is 8: - self.fail(self.info['error'] if 'error' in self.info else "Failed") + self.fail(self.info['error'] if 'error' in self.info else _("Failed")) finally: self.logDebug("File status: %s" % statusMap[status]) diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py index 5e5d4111f..e8b79c8cd 100644 --- a/module/plugins/internal/XFSHoster.py +++ b/module/plugins/internal/XFSHoster.py @@ -13,7 +13,7 @@ from module.utils import html_unescape class XFSHoster(SimpleHoster): __name__ = "XFSHoster" __type__ = "hoster" - __version__ = "0.48" + __version__ = "0.49" __pattern__ = r'^unmatchable$' @@ -79,7 +79,6 @@ class XFSHoster(SimpleHoster): self.LINK_PATTERN = pattern % self.HOSTER_DOMAIN.replace('.', '\.') self.captcha = None - self.errmsg = None super(XFSHoster, self).prepare() @@ -149,7 +148,7 @@ class XFSHoster(SimpleHoster): action, inputs = self.parseHtmlForm('F1') if not inputs: - self.retry(reason=self.errmsg or _("TEXTAREA F1 not found")) + self.retry(reason=self.info['error'] if 'error' in self.info else _("TEXTAREA F1 not found")) self.logDebug(inputs) @@ -178,65 +177,6 @@ class XFSHoster(SimpleHoster): self.link = header['location'] - def checkErrors(self): - m = re.search(self.ERROR_PATTERN, self.html) - if m is None: - self.errmsg = None - - if re.search(self.HAPPY_HOUR_PATTERN, self.html): - self.multiDL = True - else: - self.setup() - - else: - self.errmsg = m.group(1).strip() - - self.logWarning(re.sub(r"<.*?>", " ", self.errmsg)) - - if 'wait' in self.errmsg: - wait_time = sum(int(v) * {"hr": 3600, "hour": 3600, "min": 60, "sec": 1, "": 1}[u.lower()] for v, u in - re.findall(r'(\d+)\s*(hr|hour|min|sec|)', self.errmsg, re.I)) - self.wait(wait_time, wait_time > 300) - - elif 'country' in self.errmsg: - self.fail(_("Downloads are disabled for your country")) - - elif 'captcha' in self.errmsg: - self.invalidCaptcha() - - elif 'premium' in self.errmsg and 'require' in self.errmsg: - self.fail(_("File can be downloaded by premium users only")) - - elif 'limit' in self.errmsg: - if 'day' in self.errmsg: - delay = secondsToMidnight(gmt=2) - retries = 3 - else: - delay = 1 * 60 * 60 - retries = 24 - - self.wantReconnect = True - self.retry(retries, delay, _("Download limit exceeded")) - - elif 'countdown' in self.errmsg or 'Expired' in self.errmsg: - self.retry(reason=_("Link expired")) - - elif 'maintenance' in self.errmsg or 'maintainance' in self.errmsg: - self.tempOffline() - - elif 'up to' in self.errmsg: - self.fail(_("File too large for free download")) - - else: - self.wantReconnect = True - self.retry(wait_time=60, reason=self.errmsg) - - if self.errmsg: - self.info['error'] = self.errmsg - else: - self.info.pop('error', None) - - def getPostParameters(self): if self.FORM_PATTERN or self.FORM_INPUTS_MAP: action, inputs = self.parseHtmlForm(self.FORM_PATTERN or "", self.FORM_INPUTS_MAP or {}) @@ -246,7 +186,7 @@ class XFSHoster(SimpleHoster): if not inputs: action, inputs = self.parseHtmlForm('F1') if not inputs: - self.retry(reason=self.errmsg or _("TEXTAREA F1 not found")) + self.retry(reason=self.info['error'] if 'error' in self.info else _("TEXTAREA F1 not found")) self.logDebug(inputs) -- cgit v1.2.3 From 14600aa22812176c4f61ffcfd4ae3b0ee62ae368 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@users.noreply.github.com> Date: Mon, 18 May 2015 05:25:09 +0200 Subject: Spare plugins updates --- module/plugins/hoster/BezvadataCz.py | 6 +++--- module/plugins/hoster/CatShareNet.py | 10 +--------- module/plugins/hoster/CloudzillaTo.py | 13 +++++++++---- module/plugins/hoster/DateiTo.py | 16 ++-------------- module/plugins/hoster/GigapetaCom.py | 17 +++++------------ module/plugins/hoster/NitroflareCom.py | 26 +------------------------- 6 files changed, 21 insertions(+), 67 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/BezvadataCz.py b/module/plugins/hoster/BezvadataCz.py index fbb17635c..b47c2902d 100644 --- a/module/plugins/hoster/BezvadataCz.py +++ b/module/plugins/hoster/BezvadataCz.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class BezvadataCz(SimpleHoster): __name__ = "BezvadataCz" __type__ = "hoster" - __version__ = "0.26" + __version__ = "0.27" __pattern__ = r'http://(?:www\.)?bezvadata\.cz/stahnout/.+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -84,8 +84,8 @@ class BezvadataCz(SimpleHoster): self.longWait(5 * 60, 24) #: parallel dl limit elif '<div class="infobox' in self.html: self.tempOffline() - - self.info.pop('error', None) + else: + return super(BezvadataCz, self).checkErrors() def loadcaptcha(self, data, *args, **kwargs): diff --git a/module/plugins/hoster/CatShareNet.py b/module/plugins/hoster/CatShareNet.py index 9e3f28cfa..868be4033 100644 --- a/module/plugins/hoster/CatShareNet.py +++ b/module/plugins/hoster/CatShareNet.py @@ -9,7 +9,7 @@ from module.plugins.internal.CaptchaService import ReCaptcha class CatShareNet(SimpleHoster): __name__ = "CatShareNet" __type__ = "hoster" - __version__ = "0.13" + __version__ = "0.14" __pattern__ = r'http://(?:www\.)?catshare\.net/\w{16}' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -38,14 +38,6 @@ class CatShareNet(SimpleHoster): self.resumeDownload = True - def checkErrors(self): - m = re.search(self.IP_BLOCKED_PATTERN, self.html) - if m: - self.fail(_("Only connections from Polish IP address are allowed")) - - return super(CatShareNet, self).checkErrors() - - def handleFree(self, pyfile): recaptcha = ReCaptcha(self) diff --git a/module/plugins/hoster/CloudzillaTo.py b/module/plugins/hoster/CloudzillaTo.py index 362a8d953..09453137d 100644 --- a/module/plugins/hoster/CloudzillaTo.py +++ b/module/plugins/hoster/CloudzillaTo.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class CloudzillaTo(SimpleHoster): __name__ = "CloudzillaTo" __type__ = "hoster" - __version__ = "0.06" + __version__ = "0.07" __pattern__ = r'http://(?:www\.)?cloudzilla\.to/share/file/(?P<ID>[\w^_]+)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -25,12 +25,17 @@ class CloudzillaTo(SimpleHoster): def checkErrors(self): - m = re.search(self.PASSWORD_PATTERN, self.html) - if m: - self.html = self.load(self.pyfile.url, get={'key': self.getPassword()}) + if re.search(self.PASSWORD_PATTERN, self.html): + pw = self.getPassword() + if pw: + self.html = self.load(self.pyfile.url, get={'key': pw}) + else: + self.fail(_("Missing password")) if re.search(self.PASSWORD_PATTERN, self.html): self.retry(reason="Wrong password") + else: + return super(CloudzillaTo, self).checkErrors() def handleFree(self, pyfile): diff --git a/module/plugins/hoster/DateiTo.py b/module/plugins/hoster/DateiTo.py index 71a9eb4bf..f0ad95d1e 100644 --- a/module/plugins/hoster/DateiTo.py +++ b/module/plugins/hoster/DateiTo.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DateiTo(SimpleHoster): __name__ = "DateiTo" __type__ = "hoster" - __version__ = "0.07" + __version__ = "0.08" __pattern__ = r'http://(?:www\.)?datei\.to/datei/(?P<ID>\w+)\.html' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -24,7 +24,7 @@ class DateiTo(SimpleHoster): OFFLINE_PATTERN = r'>Datei wurde nicht gefunden<|>Bitte wähle deine Datei aus... <' WAIT_PATTERN = r'countdown\({seconds: (\d+)' - MULTIDL_PATTERN = r'>Du lädst bereits eine Datei herunter<' + DOWNLOAD_PATTERN = r'>Du lädst bereits eine Datei herunter' DATA_PATTERN = r'url: "(.*?)", data: "(.*?)",' @@ -60,18 +60,6 @@ class DateiTo(SimpleHoster): self.link = self.html - def checkErrors(self): - m = re.search(self.MULTIDL_PATTERN, self.html) - if m: - m = re.search(self.WAIT_PATTERN, self.html) - wait_time = int(m.group(1)) if m else 30 - - errmsg = self.info['error'] = _("Parallel downloads") - self.retry(wait_time=wait_time, reason=errmsg) - - self.info.pop('error', None) - - def doWait(self): m = re.search(self.WAIT_PATTERN, self.html) wait_time = int(m.group(1)) if m else 30 diff --git a/module/plugins/hoster/GigapetaCom.py b/module/plugins/hoster/GigapetaCom.py index e4d0601fc..c2feeb6f8 100644 --- a/module/plugins/hoster/GigapetaCom.py +++ b/module/plugins/hoster/GigapetaCom.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class GigapetaCom(SimpleHoster): __name__ = "GigapetaCom" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.04" __pattern__ = r'http://(?:www\.)?gigapeta\.com/dl/\w+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -20,10 +20,12 @@ class GigapetaCom(SimpleHoster): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - NAME_PATTERN = r'<img src=".*" alt="file" />-->\s*(?P<N>.*?)\s*</td>' - SIZE_PATTERN = r'<th>\s*Size\s*</th>\s*<td>\s*(?P<S>.*?)\s*</td>' + NAME_PATTERN = r'<img src=".*" alt="file" />-->\s*(?P<N>.*?)\s*</td>' + SIZE_PATTERN = r'<th>\s*Size\s*</th>\s*<td>\s*(?P<S>.*?)\s*</td>' OFFLINE_PATTERN = r'<div id="page_error">' + DOWNLOAD_PATTERN = r'"All threads for IP' + COOKIES = [("gigapeta.com", "lang", "us")] @@ -54,13 +56,4 @@ class GigapetaCom(SimpleHoster): self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 1) - def checkErrors(self): - if "All threads for IP" in self.html: - self.logDebug("Your IP is already downloading a file") - self.wait(5 * 60, True) - self.retry() - - self.info.pop('error', None) - - getInfo = create_getInfo(GigapetaCom) diff --git a/module/plugins/hoster/NitroflareCom.py b/module/plugins/hoster/NitroflareCom.py index 40bf0749f..e10bf130b 100644 --- a/module/plugins/hoster/NitroflareCom.py +++ b/module/plugins/hoster/NitroflareCom.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster class NitroflareCom(SimpleHoster): __name__ = "NitroflareCom" __type__ = "hoster" - __version__ = "0.09" + __version__ = "0.10" __pattern__ = r'https?://(?:www\.)?nitroflare\.com/view/(?P<ID>[\w^_]+)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -34,30 +34,6 @@ class NitroflareCom(SimpleHoster): ERROR_PATTERN = r'downloading is not possible' - def checkErrors(self): - if not self.html: - return - - if not self.premium and re.search(self.PREMIUM_ONLY_PATTERN, self.html): - self.fail(_("Link require a premium account to be handled")) - - elif hasattr(self, 'WAIT_PATTERN'): - m = re.search(self.WAIT_PATTERN, self.html) - if m: - wait_time = sum(int(v) * {"hr": 3600, "hour": 3600, "min": 60, "sec": 1}[u.lower()] for v, u in - re.findall(r'(\d+)\s*(hr|hour|min|sec)', m.group(0), re.I)) - self.wait(wait_time, wait_time > 300) - return - - elif hasattr(self, 'ERROR_PATTERN'): - m = re.search(self.ERROR_PATTERN, self.html) - if m: - errmsg = self.info['error'] = m.group(1) - self.error(errmsg) - - self.info.pop('error', None) - - def handleFree(self, pyfile): # used here to load the cookies which will be required later self.load(pyfile.url, post={'goToFreePage': ""}) -- cgit v1.2.3 From 623b63aa5449232738b938aff83e4d693750f4f7 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@users.noreply.github.com> Date: Mon, 18 May 2015 08:24:00 +0200 Subject: [SimpleHoster] Fix https://github.com/pyload/pyload/issues/1421 --- module/plugins/internal/SimpleHoster.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 27327c918..fddd6b677 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -244,7 +244,7 @@ def secondsToMidnight(gmt=0): class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "1.43" + __version__ = "1.44" __pattern__ = r'^unmatchable$' __config__ = [("use_premium", "bool", "Use premium account if available" , True), @@ -583,7 +583,7 @@ class SimpleHoster(Hoster): except Exception: errmsg = m.group(0).strip() - self.logWarning(re.sub(r'<.*?>', " ", self.errmsg)) + self.logWarning(re.sub(r'<.*?>', " ", errmsg)) self.info['error'] = errmsg if re.search('da(il)?y|today', errmsg, re.I): @@ -606,7 +606,7 @@ class SimpleHoster(Hoster): except Exception: errmsg = m.group(0).strip() - self.logWarning(re.sub(r'<.*?>', " ", self.errmsg)) + self.logWarning(re.sub(r'<.*?>', " ", errmsg)) self.info['error'] = errmsg if re.search('limit|wait', errmsg, re.I): -- cgit v1.2.3 From d86120df4f413c309ec87a3bc1ae7bd63d399e7b Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@users.noreply.github.com> Date: Mon, 18 May 2015 08:53:40 +0200 Subject: [XFSAccount] Fix https://github.com/pyload/pyload/issues/1420 --- module/plugins/internal/SimpleHoster.py | 10 +++++----- module/plugins/internal/XFSAccount.py | 11 +++++++---- 2 files changed, 12 insertions(+), 9 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index fddd6b677..9303bcf2e 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -74,7 +74,7 @@ def parseHtmlForm(attr_str, html, input_names={}): if name: value = parseHtmlTagAttrValue("value", inputtag.group(1)) if not value: - inputs[name] = inputtag.group(3) or '' + inputs[name] = inputtag.group(3) or "" else: inputs[name] = value @@ -583,8 +583,8 @@ class SimpleHoster(Hoster): except Exception: errmsg = m.group(0).strip() - self.logWarning(re.sub(r'<.*?>', " ", errmsg)) - self.info['error'] = errmsg + self.info['error'] = re.sub(r'<.*?>', " ", errmsg) + self.logWarning(self.info['error']) if re.search('da(il)?y|today', errmsg, re.I): wait_time = secondsToMidnight(gmt=2) @@ -606,8 +606,8 @@ class SimpleHoster(Hoster): except Exception: errmsg = m.group(0).strip() - self.logWarning(re.sub(r'<.*?>', " ", errmsg)) - self.info['error'] = errmsg + self.info['error'] = re.sub(r'<.*?>', " ", errmsg) + self.logWarning(self.info['error']) if re.search('limit|wait', errmsg, re.I): if re.search("da(il)?y|today", errmsg): diff --git a/module/plugins/internal/XFSAccount.py b/module/plugins/internal/XFSAccount.py index 41e1bde4d..e619cb038 100644 --- a/module/plugins/internal/XFSAccount.py +++ b/module/plugins/internal/XFSAccount.py @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import parseHtmlForm, set_cookies class XFSAccount(Account): __name__ = "XFSAccount" __type__ = "account" - __version__ = "0.36" + __version__ = "0.37" __description__ = """XFileSharing account plugin""" __license__ = "GPLv3" @@ -170,9 +170,12 @@ class XFSAccount(Account): inputs.update({'login' : user, 'password': data['password']}) - if not action: - action = self.HOSTER_URL - html = req.load(action, post=inputs, decode=True) + if action: + url = urlparse.urljoin("http://", action) + else: + url = self.HOSTER_URL + + html = req.load(url, post=inputs, decode=True) if re.search(self.LOGIN_FAIL_PATTERN, html): self.wrongPassword() -- cgit v1.2.3 From 41faf73af4deb8dcd73e0c2e55073f1ef7656a7f Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@users.noreply.github.com> Date: Mon, 18 May 2015 09:48:07 +0200 Subject: [XFSHoster] Fix https://github.com/pyload/pyload/issues/1296 --- module/plugins/hooks/UserAgentSwitcher.py | 8 ++++---- module/plugins/internal/XFSHoster.py | 16 +++++----------- 2 files changed, 9 insertions(+), 15 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/UserAgentSwitcher.py b/module/plugins/hooks/UserAgentSwitcher.py index 912c2ef09..0b36e38ec 100644 --- a/module/plugins/hooks/UserAgentSwitcher.py +++ b/module/plugins/hooks/UserAgentSwitcher.py @@ -15,10 +15,10 @@ class UserAgentSwitcher(Hook): __type__ = "hook" __version__ = "0.04" - __config__ = [("activated", "bool", "Activated" , True ), - ("uaf" , "file", "Random user-agents file" , "" ), - ("uar" , "bool", "Random user-agent" , False ), - ("uas" , "str" , "Custom user-agent string", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:37.0) Gecko/20100101 Firefox/37.0")] + __config__ = [("activated", "bool", "Activated" , True ), + ("uaf" , "file", "Random user-agent by file" , "" ), + ("uar" , "bool", "Random user-agent" , False ), + ("uas" , "str" , "Custom user-agent string" , "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:37.0) Gecko/20100101 Firefox/37.0")] __description__ = """Custom user-agent""" __license__ = "GPLv3" diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py index e8b79c8cd..57357c06e 100644 --- a/module/plugins/internal/XFSHoster.py +++ b/module/plugins/internal/XFSHoster.py @@ -13,7 +13,7 @@ from module.utils import html_unescape class XFSHoster(SimpleHoster): __name__ = "XFSHoster" __type__ = "hoster" - __version__ = "0.49" + __version__ = "0.50" __pattern__ = r'^unmatchable$' @@ -78,8 +78,6 @@ class XFSHoster(SimpleHoster): pattern = r'(https?://(?:www\.)?([^/]*?%s|\d+\.\d+\.\d+\.\d+)(\:\d+)?(/d/|(/files)?/\d+/\w+/).+?)["\'<]' self.LINK_PATTERN = pattern % self.HOSTER_DOMAIN.replace('.', '\.') - self.captcha = None - super(XFSHoster, self).prepare() if self.DIRECT_LINK is None: @@ -204,8 +202,7 @@ class XFSHoster(SimpleHoster): wait_time = int(m.group(1)) self.setWait(wait_time, False) - self.captcha = self.handleCaptcha(inputs) - + self.handleCaptcha(inputs) self.wait() else: inputs['referer'] = self.pyfile.url @@ -225,7 +222,7 @@ class XFSHoster(SimpleHoster): if m: captcha_url = m.group(1) inputs['code'] = self.decryptCaptcha(captcha_url) - return 1 + return m = re.search(self.CAPTCHA_BLOCK_PATTERN, self.html, re.S) if m: @@ -237,7 +234,7 @@ class XFSHoster(SimpleHoster): inputs['code'] = "".join(a[1] for a in sorted(numerals, key=lambda num: int(num[0]))) self.logDebug("Captcha code: %s" % inputs['code'], numerals) - return 2 + return recaptcha = ReCaptcha(self) try: @@ -251,7 +248,7 @@ class XFSHoster(SimpleHoster): if captcha_key: inputs['recaptcha_response_field'], inputs['recaptcha_challenge_field'] = recaptcha.challenge(captcha_key) - return 3 + return solvemedia = SolveMedia(self) try: @@ -265,6 +262,3 @@ class XFSHoster(SimpleHoster): if captcha_key: inputs['adcopy_response'], inputs['adcopy_challenge'] = solvemedia.challenge(captcha_key) - return 4 - - return 0 -- cgit v1.2.3 From 339b2e07d78b15ca014ee12f1501cdb235d9b064 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@users.noreply.github.com> Date: Mon, 18 May 2015 11:50:43 +0200 Subject: [SimpleHoster] Fix create_getInfo --- module/plugins/crypter/LinkCryptWs.py | 6 +----- module/plugins/hooks/UserAgentSwitcher.py | 8 ++++---- module/plugins/hoster/ShareonlineBiz.py | 8 +++----- module/plugins/hoster/UploadedTo.py | 4 ++-- module/plugins/internal/DeadCrypter.py | 6 +++--- module/plugins/internal/DeadHoster.py | 6 +++--- module/plugins/internal/SimpleHoster.py | 30 +++++++++--------------------- 7 files changed, 25 insertions(+), 43 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/crypter/LinkCryptWs.py b/module/plugins/crypter/LinkCryptWs.py index d3e75aad4..5c65e726d 100644 --- a/module/plugins/crypter/LinkCryptWs.py +++ b/module/plugins/crypter/LinkCryptWs.py @@ -91,7 +91,7 @@ class LinkCryptWs(Crypter): def isOnline(self): if "<title>Linkcrypt.ws // Error 404" in self.html: - self.logDebug("folder doesen't exist anymore") + self.logDebug("Folder doesn't exist anymore") return False else: return True @@ -197,8 +197,6 @@ class LinkCryptWs(Crypter): for idx, weblink_id in enumerate(ids): try: - self.logDebug("Decrypting Web link %d, %s" % (idx + 1, weblink_id)) - res = self.load("http://linkcrypt.ws/out.html", post = {'file':weblink_id}) indexs = res.find("window.location =") + 19 @@ -206,8 +204,6 @@ class LinkCryptWs(Crypter): link2 = res[indexs:indexe] - self.logDebug(link2) - link2 = html_unescape(link2) package_links.append(link2) diff --git a/module/plugins/hooks/UserAgentSwitcher.py b/module/plugins/hooks/UserAgentSwitcher.py index 0b36e38ec..6915fc0f4 100644 --- a/module/plugins/hooks/UserAgentSwitcher.py +++ b/module/plugins/hooks/UserAgentSwitcher.py @@ -15,10 +15,10 @@ class UserAgentSwitcher(Hook): __type__ = "hook" __version__ = "0.04" - __config__ = [("activated", "bool", "Activated" , True ), - ("uaf" , "file", "Random user-agent by file" , "" ), - ("uar" , "bool", "Random user-agent" , False ), - ("uas" , "str" , "Custom user-agent string" , "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:37.0) Gecko/20100101 Firefox/37.0")] + __config__ = [("activated", "bool", "Activated" , True ), + ("uaf" , "file", "Random user-agent by file", "" ), + ("uar" , "bool", "Random user-agent" , False ), + ("uas" , "str" , "Custom user-agent string" , "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0")] __description__ = """Custom user-agent""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index 505222fce..9d0cb631b 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -36,15 +36,13 @@ class ShareonlineBiz(SimpleHoster): @classmethod - def getInfo(cls, url="", html=""): - info = {'name': urlparse.urlparse(urllib.unquote(url)).path.split('/')[-1] or _("Unknown"), 'size': 0, 'status': 3 if url else 1, 'url': url} + def apiInfo(cls, url): + info = super(ShareonlineBiz, cls).apiInfo(url) if url: - info['pattern'] = re.match(cls.__pattern__, url).groupdict() - field = getURL("http://api.share-online.biz/linkcheck.php", get={'md5': "1"}, - post={'links': info['pattern']['ID']}, + post={'links': re.match(cls.__pattern__, url).group("ID")}, decode=True).split(";") if field[1] == "OK": diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py index 75710ea8b..669694b22 100644 --- a/module/plugins/hoster/UploadedTo.py +++ b/module/plugins/hoster/UploadedTo.py @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UploadedTo(SimpleHoster): __name__ = "UploadedTo" __type__ = "hoster" - __version__ = "0.87" + __version__ = "0.88" __pattern__ = r'https?://(?:www\.)?(uploaded\.(to|net)|ul\.to)(/file/|/?\?id=|.*?&id=|/)(?P\w+)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -36,7 +36,7 @@ class UploadedTo(SimpleHoster): @classmethod - def apiInfo(cls, url="", get={}, post={}): + def apiInfo(cls, url): info = super(UploadedTo, cls).apiInfo(url) for _i in xrange(5): diff --git a/module/plugins/internal/DeadCrypter.py b/module/plugins/internal/DeadCrypter.py index 866d177cf..c93447164 100644 --- a/module/plugins/internal/DeadCrypter.py +++ b/module/plugins/internal/DeadCrypter.py @@ -7,7 +7,7 @@ from module.plugins.Crypter import Crypter as _Crypter class DeadCrypter(_Crypter): __name__ = "DeadCrypter" __type__ = "crypter" - __version__ = "0.04" + __version__ = "0.05" __pattern__ = r'^unmatchable$' @@ -17,8 +17,8 @@ class DeadCrypter(_Crypter): @classmethod - def apiInfo(cls, url="", get={}, post={}): - api = super(DeadCrypter, self).apiInfo(url, get, post) + def apiInfo(cls, url): + api = super(DeadCrypter, cls).apiInfo(url) api['status'] = 1 return api diff --git a/module/plugins/internal/DeadHoster.py b/module/plugins/internal/DeadHoster.py index a6ad92607..f159ae5fa 100644 --- a/module/plugins/internal/DeadHoster.py +++ b/module/plugins/internal/DeadHoster.py @@ -7,7 +7,7 @@ from module.plugins.Hoster import Hoster as _Hoster class DeadHoster(_Hoster): __name__ = "DeadHoster" __type__ = "hoster" - __version__ = "0.14" + __version__ = "0.15" __pattern__ = r'^unmatchable$' @@ -17,8 +17,8 @@ class DeadHoster(_Hoster): @classmethod - def apiInfo(cls, url="", get={}, post={}): - api = super(DeadHoster, self).apiInfo(url, get, post) + def apiInfo(cls, url): + api = super(DeadHoster, cls).apiInfo(url) api['status'] = 1 return api diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 9303bcf2e..aae3bac8c 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -100,7 +100,7 @@ def parseHtmlForm(attr_str, html, input_names={}): return {}, None #: no matching form found -#: Deprecated +#@TODO: Remove in 0.4.10 def parseFileInfo(plugin, url="", html=""): if hasattr(plugin, "getInfo"): info = plugin.getInfo(url, html) @@ -119,19 +119,14 @@ def parseFileInfo(plugin, url="", html=""): #@TODO: Remove in 0.4.10 -#@NOTE: Every plugin must have own parseInfos classmethod to work with 0.4.10 def create_getInfo(plugin): + def getInfo(urls): + for url in urls: + if hasattr(plugin, "URL_REPLACEMENTS"): + url = replace_patterns(url, plugin.URL_REPLACEMENTS) + yield parseFileInfo(plugin, url) - def generator(list): - for x in list: - yield x - - if hasattr(plugin, "parseInfos"): - fn = lambda urls: generator((info['name'], info['size'], info['status'], info['url']) for info in plugin.parseInfos(urls)) - else: - fn = lambda urls: generator(parseFileInfo(url) for url in urls) - - return fn + return getInfo def timestamp(): @@ -244,7 +239,7 @@ def secondsToMidnight(gmt=0): class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "1.44" + __version__ = "1.45" __pattern__ = r'^unmatchable$' __config__ = [("use_premium", "bool", "Use premium account if available" , True), @@ -325,14 +320,7 @@ class SimpleHoster(Hoster): @classmethod - def parseInfos(cls, urls): #@TODO: Built-in in 0.4.10 core (remove from plugins) - for url in urls: - url = replace_patterns(url, cls.URL_REPLACEMENTS) - yield cls.getInfo(url) - - - @classmethod - def apiInfo(cls, url="", get={}, post={}): + def apiInfo(cls, url): url = urllib.unquote(url) url_p = urlparse.urlparse(url) return {'name' : (url_p.path.split('/')[-1] -- cgit v1.2.3 From 66946591842ec27705bcc015e04016a7dabc388c Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 18 May 2015 12:06:22 +0200 Subject: [SimpleHoster] Fix https://github.com/pyload/pyload/issues/1404 --- module/plugins/internal/SimpleHoster.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index aae3bac8c..4bf41a478 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -148,7 +148,7 @@ def getFileURL(self, url, follow_location=None): self.logDebug("Redirect #%d to: %s" % (i, url)) header = self.load(url, just_header=True, decode=True) - except Exception: #: Bad bad bad... + except Exception: #: Bad bad bad... rewrite this part in 0.4.10 req = pyreq.getHTTPRequest() res = req.load(url, just_header=True, decode=True) @@ -239,7 +239,7 @@ def secondsToMidnight(gmt=0): class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "1.45" + __version__ = "1.46" __pattern__ = r'^unmatchable$' __config__ = [("use_premium", "bool", "Use premium account if available" , True), @@ -334,7 +334,7 @@ class SimpleHoster(Hoster): @classmethod def getInfo(cls, url="", html=""): info = cls.apiInfo(url) - online = False if info['status'] != 2 else True + online = True if info['status'] is 2 else False try: info['pattern'] = re.match(cls.__pattern__, url).groupdict() #: pattern groups will be saved here @@ -347,7 +347,7 @@ class SimpleHoster(Hoster): info['error'] = "missing url" info['status'] = 1 - elif info['status'] is 3 and not getFileURL(None, url): + elif info['status'] is 3: try: html = getURL(url, cookies=cls.COOKIES, decode=not cls.TEXT_ENCODING) @@ -363,6 +363,9 @@ class SimpleHoster(Hoster): elif e.code is 503: info['status'] = 6 + except Exception: + pass + if html: if hasattr(cls, "OFFLINE_PATTERN") and re.search(cls.OFFLINE_PATTERN, html): info['status'] = 1 -- cgit v1.2.3 From 0aa29b3284c28079cc8da3d8774bd111e6cf4abc Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 18 May 2015 12:45:08 +0200 Subject: [UptoboxCom] Set LOGIN_ACCOUNT to True --- module/plugins/hoster/UptoboxCom.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/UptoboxCom.py b/module/plugins/hoster/UptoboxCom.py index 991bc640e..4dc3c07b9 100644 --- a/module/plugins/hoster/UptoboxCom.py +++ b/module/plugins/hoster/UptoboxCom.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class UptoboxCom(XFSHoster): __name__ = "UptoboxCom" __type__ = "hoster" - __version__ = "0.18" + __version__ = "0.19" __pattern__ = r'https?://(?:www\.)?(uptobox|uptostream)\.com/\w{12}' @@ -15,6 +15,8 @@ class UptoboxCom(XFSHoster): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + LOGIN_ACCOUNT = True + INFO_PATTERN = r'"para_title">(?P.+) \((?P[\d.,]+) (?P[\w^_]+)\)' OFFLINE_PATTERN = r'>(File not found|Access Denied|404 Not Found)' TEMP_OFFLINE_PATTERN = r'>Service Unavailable' -- cgit v1.2.3 From d22cf4a5b0e51716c353e9f2504eb02ae879501d Mon Sep 17 00:00:00 2001 From: gsasch Date: Mon, 18 May 2015 16:23:37 +0200 Subject: New OCR CircleCaptcha --- module/plugins/captcha/CircleCaptcha.py | 781 ++++++++++++++++++++++++++++++++ 1 file changed, 781 insertions(+) create mode 100644 module/plugins/captcha/CircleCaptcha.py (limited to 'module/plugins') diff --git a/module/plugins/captcha/CircleCaptcha.py b/module/plugins/captcha/CircleCaptcha.py new file mode 100644 index 000000000..d4f08018d --- /dev/null +++ b/module/plugins/captcha/CircleCaptcha.py @@ -0,0 +1,781 @@ +# -*- coding: utf-8 -*- + +from __future__ import division + +import Image +import ImageDraw +import cStringIO +import math +import operator +import urllib + +from module.plugins.captcha.OCR import OCR + + +class ImageSequence: + + def __init__(self, im): + self.im = im + + def __getitem__(self, ix): + try: + if ix: + self.im.seek(ix) + return self.im + except EOFError: + raise IndexError # end of sequence + + +class CircleCaptcha(OCR): + __name__ = "CircleCaptcha" + __type__ = "ocr" + __version__ = "1.00" + + __description__ = """Circle captcha ocr plugin""" + __license__ = "GPLv3" + __authors__ = [("Sasch", "gsasch@gmail.com")] + + + _DEBUG = False + pointsofcirclefound = [] + + BACKGROUND = 250 + BLACKCOLOR = 5 + + + def cleanImage(self, im, pix): + cleandeep = 1 + + imageheight = range(1,int(im.size[1])) + imagewidth = range(1,int(im.size[0])) + howmany = 0 + curcolor = self.BACKGROUND + + for y in imageheight: + jump = True + howmany = 0 + for x in imagewidth: + curpix = pix[x,y] + + if curpix > self.BACKGROUND: + if howmany <= cleandeep and howmany > 0: + # clean pixel + for ic in range(1,cleandeep+1): + if x -ic > 0: + pix[x-ic,y] = self.BACKGROUND + jump = False + howmany = 0 + curcolor = curpix + # print (x, y), jump,2 + else: + if howmany == 0: + # found pixel + jump = True + howmany = howmany + 1 + curcolor = curpix + # print (x, y), jump,2 + else: + howmany = howmany + 1 + if howmany == 1: + # clean pixel + pix[x-1,y] = self.BACKGROUND + + curcolor = self.BACKGROUND + for x in imagewidth: + jump = True + howmany = 0 + for y in imageheight: + curpix = pix[x,y] + # if jump == True: + if curpix > self.BACKGROUND: + if howmany <= cleandeep and howmany > 0: + # clean pixel + for ic in range(1,cleandeep+1): + # raw_input('2'+str(ic)) + if y-ic > 0: + pix[x,y-ic] = self.BACKGROUND + jump = False + howmany = 0 + curcolor = curpix + # print (x, y), jump + else: + if howmany == 0: + # found pixel + jump = True + howmany = howmany + 1 + curcolor = curpix + # print (x, y), jump + else: + howmany = howmany + 1 + if howmany == 1: + # clean pixel + pix[x-1,y] = self.BACKGROUND + + # return -1 + + + def findFirstPixelX(self, im, pix, curx, cury, color = -1, ExitWithBlack = False): + imageheight = range(1,int(im.size[1])) + imagewidth = range(curx+1,int(im.size[0])) + jump = True + newx = (-1,-1) + blackfound = 0 + for x in imagewidth: + curpix = pix[x,cury] + + if curpix < self.BLACKCOLOR: + blackfound = blackfound + 1 + if ExitWithBlack == True and blackfound >= 3: + break; #exit if found black + else: + continue; + + if curpix >= self.BACKGROUND: + # found first pixel white + jump = False + continue; + + if (curpix < self.BACKGROUND and color == -1) or (curpix == color and color > -1): + if jump == False: + # found pixel + curcolor = curpix + newx = x, curcolor + break; + + return newx + + + def findLastPixelX(self, im, pix, curx, cury, color = -1, ExitWithBlack = False): + imageheight = range(1,int(im.size[1])) + imagewidth = range(curx+1,int(im.size[0])) + newx = (-1,-1) + blackfound = 0 + for x in imagewidth: + curpix = pix[x,cury] + + if curpix < self.BLACKCOLOR: + blackfound = blackfound + 1 + if ExitWithBlack == True and blackfound >= 3: + break; #exit if found black + else: + continue; + + if curpix >= self.BACKGROUND: + if newx != (-1,-1): + # found last pixel and the first white + break; + + if (curpix < self.BACKGROUND and color == -1) or (curpix == color and color > -1): + # found pixel + curcolor = curpix + newx = x, curcolor + + return newx + + + def findLastPixelY(self, im, pix, curx, cury, DownToUp, color = -1, ExitWithBlack = False): + if DownToUp == False: + imageheight = range(int(cury)+1,int(im.size[1])-1) + else: + imageheight = range(int(cury)-1,1,-1) + imagewidth = range(int(curx),int(im.size[0])) + newy = (-1,-1) + blackfound = 0 + for y in imageheight: + curpix = pix[curx,y] + + if curpix < self.BLACKCOLOR: + blackfound = blackfound + 1 + if ExitWithBlack == True and blackfound >= 3: + break; #exit if found black + else: + continue; + + if curpix >= self.BACKGROUND: + if newy != (-1,-1): + # found last pixel and the first white + break; + + if (curpix < self.BACKGROUND and color == -1) or (curpix == color and color > -1): + # found pixel + curcolor = curpix + newy = y, color + + return newy + + + def findCircle(self, pix, x1, y1, x2, y2, x3, y3): + # trasposizione coordinate + # A(0,0) B(x2-x1,y2-y1) C(x3-x1,y3-y1) + # x**2+y**2+ax+bx+c=0 + p1 = (0,0) + p2 = (x2-x1,y2-y1) + p3 = (x3-x1,y3-y1) + + # 1 + c=0 + # 2 + # p2[0]**2+a*p2[0]+c=0 + # a*p2[0]=-1*(p2[0]**2-c) + # a=(-1*(p2[0]**2-c))/p2[0] + a=(-1*(p2[0]**2-c))/p2[0] + # 3 + # p3[0]**2+p3[1]**2+a*p3[0]+b*p3[1]+c=0 + # b*p3[1]=-(p3[0]**2+p3[1]**2+a*p3[0]+c) + # b=(-1 * (p3[0]**2+p3[1]**2+a*p3[0]+c)) / p3[1] + b=(-1 * (p3[0]**2+p3[1]**2+a*p3[0]+c)) / p3[1] + + r=math.floor(math.sqrt((-1*(a/2))**2+(-1*(b/2))**2)) + cx=math.floor((-1*(a/2))+x1) + cy=math.floor((-1*(b/2))+y1) + + return cx,cy,r + + + def verifyCircleNew(self, im, pix, c): + """ + This is the MAIN function to recognize the circle + returns: + 1 -> Found closed circle + 0 -> Found open circle + -1 -> Not found circle + -2 -> Found black position then leave position + """ + + imageheight = range(int(c[1]-c[2]),int(c[1]+c[2])) + imagewidth = range(int(c[0]-c[2]),int(c[0]+c[2])) + + min_ray = 15 + max_ray = 30 + exactfind = False + + howmany = 0 + missing = 0 + missingconsecutive = 0 + missinglist = [] + minX = 0; maxX = 0; minY = 0; maxY = 0 + pointsofcircle = [] + + if (c[2] < min_ray) or (c[2] > max_ray): + return -1 + + # check cardinal points (at least 3) (if found i have to leave this position) + if pix[c[0] + c[2],c[1]] < self.BLACKCOLOR: + return -2; + if pix[c[0] - c[2],c[1]] < self.BLACKCOLOR: + return -2; + if pix[c[0],c[1] + c[2]] < self.BLACKCOLOR: + return -2; + if pix[c[0],c[1] - c[2]] < self.BLACKCOLOR: + return -2; + + cardinalpoints = 0 + if self.verifyPoint(im, pix,c[0] + c[2],c[1],True) == 1: + cardinalpoints = cardinalpoints + 1 + if self.verifyPoint(im, pix,c[0] + c[2],c[1],False) == -1: + return -2; + if self.verifyPoint(im, pix,c[0] - c[2],c[1],True) == 1: + cardinalpoints = cardinalpoints + 1 + if self.verifyPoint(im, pix,c[0] - c[2],c[1],False) == -1: + return -2; + if self.verifyPoint(im, pix,c[0],c[1] + c[2],True) == 1: + cardinalpoints = cardinalpoints + 1 + if self.verifyPoint(im, pix,c[0],c[1] + c[2],False) == -1: + return -2; + if self.verifyPoint(im, pix,c[0],c[1] - c[2],True) == 1: + cardinalpoints = cardinalpoints + 1 + if self.verifyPoint(im, pix,c[0],c[1] - c[2],False) == -1: + return -2; + if cardinalpoints < 3: + return -1; + + for x in imagewidth: + # Pitagora + y = int(round(c[1]- math.sqrt(c[2]**2-(c[0]-x)**2))) + y2= int(round(c[1]+ math.sqrt(c[2]**2-(c[0]-x)**2))) + + howmany = howmany + 2 + if self.verifyPoint(im, pix, x,y,exactfind) == 0: + missing = missing + 1 + missinglist.append((x,y)) + else: + pointsofcircle.append((x,y)) + + if self.verifyPoint(im, pix, x,y,False) == -1: + return -2; + + if self.verifyPoint(im, pix, x,y2,exactfind) == 0: + missing = missing + 1 + missinglist.append((x,y2)) + else: + pointsofcircle.append((x,y2)) + + if self.verifyPoint(im, pix, x,y2,False) == -1: + return -2; + + + def verifyCircle(self, im, pix, c): + """ + This is the MAIN function to recognize the circle + returns: + 1 -> Found closed circle + 0 -> Found open circle + -1 -> Not found circle + -2 -> Found black position then leave position + """ + + imageheight = range(int(c[1]-c[2]),int(c[1]+c[2])) + imagewidth = range(int(c[0]-c[2]),int(c[0]+c[2])) + + min_ray = 15 + max_ray = 30 + exactfind = False + + howmany = 0 + missing = 0 + missingconsecutive = 0 + missinglist = [] + minX = 0; maxX = 0; minY = 0; maxY = 0 + pointsofcircle = [] + + if (c[2] < min_ray) or (c[2] > max_ray): + return -1 + + # check cardinal points (at least 3) (if found i have to leave this position) + if pix[c[0] + c[2],c[1]] < self.BLACKCOLOR: + return -2; + if pix[c[0] - c[2],c[1]] < self.BLACKCOLOR: + return -2; + if pix[c[0],c[1] + c[2]] < self.BLACKCOLOR: + return -2; + if pix[c[0],c[1] - c[2]] < self.BLACKCOLOR: + return -2; + + cardinalpoints = 0 + if self.verifyPoint(im, pix,c[0] + c[2],c[1],True) == 1: + cardinalpoints = cardinalpoints + 1 + if self.verifyPoint(im, pix,c[0] + c[2],c[1],False) == -1: + return -2; + if self.verifyPoint(im, pix,c[0] - c[2],c[1],True) == 1: + cardinalpoints = cardinalpoints + 1 + if self.verifyPoint(im, pix,c[0] - c[2],c[1],False) == -1: + return -2; + if self.verifyPoint(im, pix,c[0],c[1] + c[2],True) == 1: + cardinalpoints = cardinalpoints + 1 + if self.verifyPoint(im, pix,c[0],c[1] + c[2],False) == -1: + return -2; + if self.verifyPoint(im, pix,c[0],c[1] - c[2],True) == 1: + cardinalpoints = cardinalpoints + 1 + if self.verifyPoint(im, pix,c[0],c[1] - c[2],False) == -1: + return -2; + if cardinalpoints < 3: + return -1; + + for x in imagewidth: + # Pitagora + y = int(round(c[1]- math.sqrt(c[2]**2-(c[0]-x)**2))) + y2= int(round(c[1]+ math.sqrt(c[2]**2-(c[0]-x)**2))) + + howmany = howmany + 2 + if self.verifyPoint(im, pix, x,y,exactfind) == 0: + missing = missing + 1 + missinglist.append((x,y)) + else: + pointsofcircle.append((x,y)) + + if self.verifyPoint(im, pix, x,y,False) == -1: + return -2; + + if self.verifyPoint(im, pix, x,y2,exactfind) == 0: + missing = missing + 1 + missinglist.append((x,y2)) + else: + pointsofcircle.append((x,y2)) + + if self.verifyPoint(im, pix, x,y2,False) == -1: + return -2; + + for y in imageheight: + # Pitagora + x = int(round(c[0]- math.sqrt(c[2]**2-(c[1]-y)**2))) + x2= int(round(c[0]+ math.sqrt(c[2]**2-(c[1]-y)**2))) + + howmany = howmany + 2 + if self.verifyPoint(im, pix, x,y,exactfind) == 0: + missing = missing + 1 + missinglist.append((x,y)) + else: + pointsofcircle.append((x,y)) + + if self.verifyPoint(im, pix, x,y,False) == -1: + return -2; + + if self.verifyPoint(im, pix, x2,y,exactfind) == 0: + missing = missing + 1 + missinglist.append((x2,y)) + else: + pointsofcircle.append((x2,y)) + + if self.verifyPoint(im, pix, x2,y,exactfind) == -1: + return -2; + + for p in missinglist: + # left and bottom + if (self.verifyPoint(im, pix, p[0]-1, p[1],exactfind) == 1 and \ + self.verifyPoint(im, pix, p[0], p[1]+1,exactfind) == 1): + missing = missing - 1 + elif (self.verifyPoint(im, pix, p[0]-1, p[1],exactfind) == 1 and \ + self.verifyPoint(im, pix, p[0], p[1]-1,exactfind) == 1): + missing = missing - 1 + # right and bottom + elif (self.verifyPoint(im, pix, p[0]+1, p[1],exactfind) == 1 and \ + self.verifyPoint(im, pix, p[0], p[1]+1,exactfind) == 1): + missing = missing - 1 + # right and up + elif (self.verifyPoint(im, pix, p[0]+1, p[1],exactfind) == 1 and \ + self.verifyPoint(im, pix, p[0], p[1]-1,exactfind) == 1): + missing = missing - 1 + + if (p[0], p[1]+1) in missinglist or \ + (p[0], p[1]-1) in missinglist or \ + (p[0]+1, p[1]) in missinglist or \ + (p[0]-1, p[1]) in missinglist or \ + (p[0]+1, p[1]+1) in missinglist or \ + (p[0]-1, p[1]+1) in missinglist or \ + (p[0]+1, p[1]-1) in missinglist or \ + (p[0]-1, p[1]-1) in missinglist or \ + self.verifyPoint(im, pix, p[0], p[1],False) == 1: + missingconsecutive = missingconsecutive + 1 + # else: + # pix[p[0], p[1]] = 0 + + if missing / howmany > 0: + indice = c[2] * (missing / howmany) + else: + indice = 0 + + if len(missinglist) > 0: + minX = min(missinglist, key=operator.itemgetter(0))[0] + maxX = max(missinglist, key=operator.itemgetter(0))[0] + + minY = min(missinglist, key=operator.itemgetter(1))[1] + maxY = max(missinglist, key=operator.itemgetter(1))[1] + + # Assial Simmetric + if self._DEBUG == True: + print "Center: " + str(c) + print "Missing: " + str(missing) + print "Howmany: " + str(howmany) + print "Ratio: " + str(missing / howmany) + print "Missing consecutives: " + str(missingconsecutive) + print "Missing X lenght: " + str(minX) + ":" + str(maxX) + print "Missing Y lenght: " + str(minY) + ":" + str(maxY) + print "Ratio without consecutives: " + str((missing - missingconsecutive) / howmany) + print "List missing: " + str(missinglist) + + # Lenght of missing cannot be over 75% of diameter + + if maxX - minX >= c[2] * 2 * 0.75: + return -1; + if maxY - minY >= c[2] * 2 * 0.75: + # raw_input('tro') + return -1; + """ + # Lenght of missing cannot be less 10% of diameter + if maxX - minX < c[2] * 2 * 0.10 and maxY - minY < c[2] * 2 * 0.10: + return -1; + """ + + if missing / howmany > 0.25 or \ + missingconsecutive >= (howmany / 4) * 2 or \ + howmany < 80: + return -1; + # elif missing / howmany < 0.10: + elif missing == 0: + self.pointsofcirclefound.extend(pointsofcircle) + return 1; + elif (missing - missingconsecutive) / howmany < 0.20: + return 0; + else: + self.pointsofcirclefound.extend(pointsofcircle) + return 1; + + + def verifyPoint(self, im, pix, x,y,exact,color = -1): + # Verify point + result = 0 + + if x < 0 or x >= im.size[0]: + return result; + if y < 0 or y >= im.size[1]: + return result; + + curpix = pix[x,y] + if (curpix == color and color > -1) or (curpix < self.BACKGROUND and color == -1): + if curpix > self.BLACKCOLOR: + result = 1 + else: + result = -1 + + # Verify around + if (exact == False): + if x + 1 < im.size[0]: + curpix = pix[x+1,y] + if (curpix == color and color > -1) or (curpix < self.BACKGROUND and color == -1): + if curpix > self.BLACKCOLOR: + result = 1 + if curpix <= self.BLACKCOLOR: + result = -1 + + if x > 0: + curpix = pix[x-1,y] + if (curpix == color and color > -1) or (curpix < self.BACKGROUND and color == -1): + if curpix > self.BLACKCOLOR: + result = 1 + if curpix <= self.BLACKCOLOR: + result = -1 + # print str((x,y)) + " = " + str(result); + return result + + + def decrypt(self, img): + iDebugSaveFile = 0 + mypalette = None + for im in ImageSequence(img): + im.save("orig.png", "png") + if mypalette != None: + im.putpalette(mypalette) + mypalette = im.getpalette() + im = im.convert('L') + + if self._DEBUG == True: + iDebugSaveFile = iDebugSaveFile + 1 + # if iDebugSaveFile < 7: continue; + im.save("output" + str(iDebugSaveFile) + ".png", "png") + raw_input('frame: '+ str(im)) + + pix = im.load() + + stepheight = range(1,im.size[1],2) + # stepheight = range(45,47) + imagewidth = range(1,im.size[0]) + lstPoints = [] # Declares an empty list for the points + lstX = [] # CoordinateX + lstY = [] # CoordinateY + lstColors = [] # Declares an empty list named lst + min_distance = 10 + max_diameter = 70 + + if self._DEBUG == True: + imdebug = im.copy() + draw = ImageDraw.Draw(imdebug) + pixcopy = imdebug.load() + + # Clean image for powerfull search + self.cleanImage(im, pix) + im.save("cleaned" + str(iDebugSaveFile) + ".png", "png") + + found = set() + findnewcircle = True + + # finding all the circles + for y1 in stepheight: + x1 = 1 + curcolor = -1 + for k in range(1,100): + findnewcircle = False + retval = self.findFirstPixelX(im, pix, x1, y1, -1, False) + x1 = retval[0] + curcolor = retval[1] + if x1 == -2: + break; + if x1 == -1: + break; + if self._DEBUG == True: print "x1, y1 -> " + str((x1,y1)) + ": " + str(pix[x1,y1]) + + if (x1,y1) in self.pointsofcirclefound: + if self._DEBUG == True: print 'found ' + str((x1,y1)) + continue; + + if self._DEBUG == True: pixcopy[x1,y1] = 45 #(255,0,0,255) + # found 1 pixel, seeking x2,y2 + x2 = x1 + y2 = y1 + for i in range(1,100): + retval = self.findLastPixelX(im, pix, x2, y2, -1, True) + x2 = retval[0] + if x1 == -2: + findnewcircle = True + break; + if x2 == -1: + break; + if self._DEBUG == True: print "x2, y2 -> " + str((x2,y1)) + ": " + str(pix[x2,y1]) + if abs(x2 - x1) < min_distance: + continue; + if abs(x2 - x1) > (im.size[1] * 2 / 3): + break; + if abs(x2 - x1) > max_diameter: + break; + + if self._DEBUG == True: pixcopy[x2,y2] = 65 #(0,255,0,255) + # found 2 pixel, seeking x3,y3 + # verify cord + + for invert in range(0,2): + x3 = math.floor(x2 - ((x2 - x1) / 2)) + y3 = y1 + for j in range(1,50): + retval = self.findLastPixelY(im, pix, x3, y3, True if invert == 1 else False, -1, True) + # print (x3, y3,retval[0],invert) + y3 = retval[0] + if y3 == -2: + findnewcircle = True + break; + if y3 == -1: + break; + + if self._DEBUG == True: print "x3, y3 -> " + str((x3,y3)) + ": " + str(pix[x3,y3]) + # verify cord + if abs(y3 - y2) < min_distance: + continue; + if abs(y3 - y2) > (im.size[1] * 2 / 3): + break; + if abs(y3 - y2) > max_diameter: + break; + + if self._DEBUG == True: pixcopy[x3,y3] = 85 + # found 3 pixel. try circle + c = self.findCircle(pix, x1,y1,x2,y2,x3,y3) + + if c[0] + c[2] >= im.size[0] or c[1] + c[2] >= im.size[1] or c[0] - c[2] <= 0 or c[1] - c[2] <= 0: + continue; + + if self._DEBUG == True: pixcopy[c[0],c[1]] = 0 + # (x-r, y-r, x+r, y+r) + verified = self.verifyCircle(im, pix, c) + + if verified == -1: + verified = -1 + elif verified == 0: + found.add(((c[0],c[1],c[2]),verified)) + findnewcircle = True + elif verified == 1: + found.add(((c[0],c[1],c[2]),verified)) + findnewcircle = True + + if self._DEBUG == True: + _pause = "" + # if verified == -1: + # draw.ellipse((c[0]-c[2],c[1]-c[2],c[0]+c[2],c[1]+c[2]),outline=0) + # _pause = "NOTDOUND" + # imdebug.save("debug.png", "png") + if verified == 0: + draw.ellipse((c[0]-c[2],c[1]-c[2],c[0]+c[2],c[1]+c[2]),outline=120) + _pause = "OPENED" + + if verified == 1: + draw.ellipse((c[0]-c[2],c[1]-c[2],c[0]+c[2],c[1]+c[2]),outline=65) + _pause = "CLOSED" + + imdebug.save("debug.png", "png") + + if _pause != "": + valore = raw_input('Found ' + _pause + ' CIRCLE circle press [Enter] = continue / [q] for Quit: ' + str(verified)) + if valore == 'q': + sys.exit(); + + if findnewcircle == True: + break; + if findnewcircle == True: + break; + if findnewcircle == True: + break; + + if self._DEBUG == True: + print 'Howmany opened circle? ' + str(len(found)) + ' ' + str(found) + + # clean results + for c in found: + verify = c[1] + if verify == 0: + p = c[0] + if ( + ((p[0], p[1]+1,p[2]),1) in found or \ + ((p[0], p[1]-1,p[2]),1) in found or \ + ((p[0]+1, p[1],p[2]),1) in found or \ + ((p[0]-1, p[1],p[2]),1) in found or \ + ((p[0]+1, p[1]+1,p[2]),1) in found or \ + ((p[0]-1, p[1]+1,p[2]),1) in found or \ + ((p[0]+1, p[1]-1,p[2]),1) in found or \ + ((p[0]-1, p[1]-1,p[2]),1) in found \ + ): + + # delete nearly circle + verify = -1 + if ( + ((p[0], p[1]+1,p[2]+1),1) in found or \ + ((p[0], p[1]-1,p[2]+1),1) in found or \ + ((p[0]+1, p[1],p[2]+1),1) in found or \ + ((p[0]-1, p[1],p[2]+1),1) in found or \ + ((p[0]+1, p[1]+1,p[2]+1),1) in found or \ + ((p[0]-1, p[1]+1,p[2]+1),1) in found or \ + ((p[0]+1, p[1]-1,p[2]+1),1) in found or \ + ((p[0]-1, p[1]-1,p[2]+1),1) in found \ + ): + + # delete nearly circle + verify = -1 + if ( + ((p[0], p[1]+1,p[2]-1),1) in found or \ + ((p[0], p[1]-1,p[2]-1),1) in found or \ + ((p[0]+1, p[1],p[2]-1),1) in found or \ + ((p[0]-1, p[1],p[2]-1),1) in found or \ + ((p[0]+1, p[1]+1,p[2]-1),1) in found or \ + ((p[0]-1, p[1]+1,p[2]-1),1) in found or \ + ((p[0]+1, p[1]-1,p[2]-1),1) in found or \ + ((p[0]-1, p[1]-1,p[2]-1),1) in found \ + ): + + # delete nearly circle + verify = -1 + + # if verify == 0: + # if self._DEBUG == True: + # pix[c[0][0],c[0][1]] = 90 #(255,255,0) + # im.save("output.png", "png") + # return c[0][0],c[0][1] + # elif verify == 1: + # if self._DEBUG == True: + # pix[c[0][0],c[0][1]] = 40 #(255,0,0) + # im.save("output.png", "png") + # else: + # if self._DEBUG == True: + # pix[c[0][0],c[0][1]] = 180 #(0,0,255) + # im.save("output.png", "png") + + if self._DEBUG == True: + im.save("output.png", "png") + + + # Return coordinates of opened circle (eg (x,y)) + def decrypt_from_web(self, url): + file = cStringIO.StringIO(urllib.urlopen(url).read()) + img = Image.open(file) + coords = self.decrypt(img); + print "Coords: " + str(coords) + + + # Return coordinates of opened circle (eg (x,y)) + def decrypt_from_file(self, filename): + coords = self.decrypt(Image.open(filename)); #Can be many different formats. + print "Coords: " + str(coords) + + +##DEBUG +# import datetime +# a = datetime.datetime.now() +# x = CircleCaptcha() +# coords = x.decrypt_from_file("decripter/captx.html2.gif") +# coords = x.decrypt_from_web("http://ncrypt.in/classes/captcha/circlecaptcha.php") +# b = datetime.datetime.now() +# print 'Elapsed time: ' + str((b-a).seconds) + ' seconds' -- cgit v1.2.3 From c27b60578e661a24dfe49a0c285fd58751711587 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 20 May 2015 17:31:43 +0200 Subject: [SimpleHoster] Tiny code cosmetics --- module/plugins/internal/SimpleHoster.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 4bf41a478..547c412ad 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -251,27 +251,27 @@ class SimpleHoster(Hoster): """ - Info patterns should be defined by each hoster: + Info patterns: - INFO_PATTERN: (optional) Name and Size of the file + INFO_PATTERN: (mandatory) Name and Size of the file example: INFO_PATTERN = r'(?Pfile_name) (?Pfile_size) (?Psize_unit)' or - NAME_PATTERN: (optional) Name that will be set for the file + NAME_PATTERN: (mandatory) Name that will be set for the file example: NAME_PATTERN = r'(?Pfile_name)' - SIZE_PATTERN: (optional) Size that will be checked for the file + SIZE_PATTERN: (mandatory) Size that will be checked for the file example: SIZE_PATTERN = r'(?Pfile_size) (?Psize_unit)' HASHSUM_PATTERN: (optional) Hash code and type of the file example: HASHSUM_PATTERN = r'(?Phash_code) (?PMD5)' - OFFLINE_PATTERN: (optional) Check if the page is unreachable + OFFLINE_PATTERN: (mandatory) Check if the page is unreachable example: OFFLINE_PATTERN = r'File (deleted|not found)' TEMP_OFFLINE_PATTERN: (optional) Check if the page is temporarily unreachable example: TEMP_OFFLINE_PATTERN = r'Server (maintenance|maintainance)' - Error handling patterns are all optional: + Error patterns: WAIT_PATTERN: (optional) Detect waiting time example: WAIT_PATTERN = r'' @@ -280,22 +280,22 @@ class SimpleHoster(Hoster): example: PREMIUM_ONLY_PATTERN = r'Premium account required' HAPPY_HOUR_PATTERN: (optional) - example: + example: HAPPY_HOUR_PATTERN = r'Happy hour' IP_BLOCKED_PATTERN: (optional) - example: + example: IP_BLOCKED_PATTERN = r'in your country' DOWNLOAD_LIMIT_PATTERN: (optional) - example: + example: DOWNLOAD_LIMIT_PATTERN = r'download limit' SIZE_LIMIT_PATTERN: (optional) - example: + example: SIZE_LIMIT_PATTERN = r'up to' ERROR_PATTERN: (optional) Detect any error preventing download example: ERROR_PATTERN = r'' - Instead overriding handleFree and handlePremium methods you can define the following patterns for direct download: + Instead overriding handleFree and handlePremium methods you may define the following patterns for basic link handling: LINK_FREE_PATTERN: (optional) group(1) should be the direct link for free download example: LINK_FREE_PATTERN = r'