From 67587fbe0335cacfde28a86ba729b9d567ce1da7 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 7 Dec 2014 00:27:18 +0100 Subject: Plugin code cosmetics (3) --- module/plugins/hoster/AlldebridCom.py | 8 +++----- module/plugins/hoster/BezvadataCz.py | 3 ++- module/plugins/hoster/BitshareCom.py | 2 +- module/plugins/hoster/CatShareNet.py | 2 +- module/plugins/hoster/DataHu.py | 2 +- module/plugins/hoster/DlFreeFr.py | 15 ++++++++------- module/plugins/hoster/FastixRu.py | 7 +++++-- module/plugins/hoster/FileStoreTo.py | 3 ++- module/plugins/hoster/FilecloudIo.py | 5 +++-- module/plugins/hoster/FileserveCom.py | 4 ++-- module/plugins/hoster/FreeWayMe.py | 4 ++-- module/plugins/hoster/GamefrontCom.py | 5 +++-- module/plugins/hoster/GooIm.py | 3 ++- module/plugins/hoster/JumbofilesCom.py | 3 ++- module/plugins/hoster/KingfilesNet.py | 2 +- module/plugins/hoster/MegasharesCom.py | 19 +++++++++++-------- module/plugins/hoster/NetloadIn.py | 11 ++++++++--- module/plugins/hoster/NowDownloadSx.py | 5 +++-- module/plugins/hoster/NowVideoSx.py | 2 +- module/plugins/hoster/OneFichierCom.py | 2 +- module/plugins/hoster/PremiumTo.py | 8 +++++--- module/plugins/hoster/PremiumizeMe.py | 9 +++++---- module/plugins/hoster/RapidgatorNet.py | 2 +- module/plugins/hoster/RapidshareCom.py | 2 +- module/plugins/hoster/RealdebridCom.py | 9 +++++---- module/plugins/hoster/RehostTo.py | 5 +++-- module/plugins/hoster/SimplyPremiumCom.py | 2 +- module/plugins/hoster/SimplydebridCom.py | 7 ++++--- module/plugins/hoster/StreamCz.py | 2 +- module/plugins/hoster/TwoSharedCom.py | 3 ++- module/plugins/hoster/UlozTo.py | 2 +- module/plugins/hoster/UnrestrictLi.py | 2 +- module/plugins/hoster/UploadedTo.py | 2 +- module/plugins/hoster/VeohCom.py | 5 +++-- module/plugins/hoster/VimeoCom.py | 5 +++-- module/plugins/hoster/YoutubeCom.py | 3 ++- module/plugins/hoster/ZeveraCom.py | 5 +++-- 37 files changed, 104 insertions(+), 76 deletions(-) (limited to 'module/plugins/hoster') diff --git a/module/plugins/hoster/AlldebridCom.py b/module/plugins/hoster/AlldebridCom.py index c7240415d..bdd8ccdff 100644 --- a/module/plugins/hoster/AlldebridCom.py +++ b/module/plugins/hoster/AlldebridCom.py @@ -45,12 +45,10 @@ class AlldebridCom(Hoster): self.fail(_("No AllDebrid account provided")) else: self.logDebug("Old URL: %s" % pyfile.url) - password = self.getPassword().splitlines() - password = "" if not password else password[0] + password = self.getPassword().splitlines()[0] or "" - url = "http://www.alldebrid.com/service.php?link=%s&json=true&pw=%s" % (pyfile.url, password) - page = self.load(url) - data = json_loads(page) + data = json_loads(self.load("http://www.alldebrid.com/service.php", + get={'link': pyfile.url, 'json': "true", 'pw': password})) self.logDebug("Json data", data) diff --git a/module/plugins/hoster/BezvadataCz.py b/module/plugins/hoster/BezvadataCz.py index d89616c86..3a0b8e58c 100644 --- a/module/plugins/hoster/BezvadataCz.py +++ b/module/plugins/hoster/BezvadataCz.py @@ -23,7 +23,8 @@ class BezvadataCz(SimpleHoster): def setup(self): - self.multiDL = self.resumeDownload = True + self.resumeDownload = True + self.multiDL = True def handleFree(self): diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index da393f8fc..1483e5d1e 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -31,7 +31,7 @@ class BitshareCom(SimpleHoster): def setup(self): - self.multiDL = self.premium + self.multiDL = self.premium self.chunkLimit = 1 diff --git a/module/plugins/hoster/CatShareNet.py b/module/plugins/hoster/CatShareNet.py index 63ae2c11c..0caac5913 100644 --- a/module/plugins/hoster/CatShareNet.py +++ b/module/plugins/hoster/CatShareNet.py @@ -31,7 +31,7 @@ class CatShareNet(SimpleHoster): def setup(self): - self.multiDL = self.premium + self.multiDL = self.premium self.resumeDownload = True diff --git a/module/plugins/hoster/DataHu.py b/module/plugins/hoster/DataHu.py index 74d631e7b..437fea7cd 100644 --- a/module/plugins/hoster/DataHu.py +++ b/module/plugins/hoster/DataHu.py @@ -28,7 +28,7 @@ class DataHu(SimpleHoster): def setup(self): self.resumeDownload = True - self.multiDL = self.premium + self.multiDL = self.premium def handleFree(self): diff --git a/module/plugins/hoster/DlFreeFr.py b/module/plugins/hoster/DlFreeFr.py index 8bc883fea..f07d46768 100644 --- a/module/plugins/hoster/DlFreeFr.py +++ b/module/plugins/hoster/DlFreeFr.py @@ -59,10 +59,10 @@ class AdYouLike: # "all":{"element_id":"ayl_private_cap_92300","lang":"fr","env":"prod"}} ayl_data = json_loads(adyoulike_data_string) - res = self.plugin.load( - r'http://api-ayl.appspot.com/challenge?key=%(ayl_key)s&env=%(ayl_env)s&callback=%(callback)s' % { - "ayl_key": ayl_data[self.engine]['key'], "ayl_env": ayl_data['all']['env'], - "callback": self.ADYOULIKE_CALLBACK}) + res = self.plugin.load("http://api-ayl.appspot.com/challenge", + get={'key' : ayl_data[self.engine]['key'], + 'env' : ayl_data['all']['env'], + 'callback': self.ADYOULIKE_CALLBACK}) m = re.search(self.ADYOULIKE_CHALLENGE_PATTERN, res) challenge_string = None @@ -130,9 +130,10 @@ class DlFreeFr(SimpleHoster): def setup(self): - self.multiDL = self.resumeDownload = True - self.limitDL = 5 - self.chunkLimit = 1 + self.resumeDownload = True + self.multiDL = True + self.limitDL = 5 + self.chunkLimit = 1 def init(self): diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py index 59b4bd24f..1e47638ea 100644 --- a/module/plugins/hoster/FastixRu.py +++ b/module/plugins/hoster/FastixRu.py @@ -46,10 +46,13 @@ class FastixRu(Hoster): self.logDebug("Old URL: %s" % pyfile.url) api_key = self.account.getAccountData(self.user) api_key = api_key['api'] - url = "http://fastix.ru/api_v2/?apikey=%s&sub=getdirectlink&link=%s" % (api_key, pyfile.url) - page = self.load(url) + + page = self.load("http://fastix.ru/api_v2/", + get={'apikey': api_key, 'sub': "getdirectlink", 'link': pyfile.url}) data = json_loads(page) + self.logDebug("Json data", data) + if "error\":true" in page: self.offline() else: diff --git a/module/plugins/hoster/FileStoreTo.py b/module/plugins/hoster/FileStoreTo.py index 8e3ba7177..e1bd8da71 100644 --- a/module/plugins/hoster/FileStoreTo.py +++ b/module/plugins/hoster/FileStoreTo.py @@ -23,7 +23,8 @@ class FileStoreTo(SimpleHoster): def setup(self): - self.resumeDownload = self.multiDL = True + self.resumeDownload = True + self.multiDL = True def handleFree(self): diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index 85ea3dae4..495f2268d 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -34,8 +34,9 @@ class FilecloudIo(SimpleHoster): def setup(self): - self.resumeDownload = self.multiDL = True - self.chunkLimit = 1 + self.resumeDownload = True + self.multiDL = True + self.chunkLimit = 1 def handleFree(self): diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index 2266e49b0..82d40fba6 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -59,9 +59,9 @@ class FileserveCom(Hoster): def setup(self): self.resumeDownload = self.multiDL = self.premium - self.file_id = re.match(self.__pattern__, self.pyfile.url).group('id') - self.url = "%s%s" % (self.URLS[0], self.file_id) + self.url = "%s%s" % (self.URLS[0], self.file_id) + self.logDebug("File ID: %s URL: %s" % (self.file_id, self.url)) diff --git a/module/plugins/hoster/FreeWayMe.py b/module/plugins/hoster/FreeWayMe.py index 84a56419b..a27dc04b8 100644 --- a/module/plugins/hoster/FreeWayMe.py +++ b/module/plugins/hoster/FreeWayMe.py @@ -17,8 +17,8 @@ class FreeWayMe(Hoster): def setup(self): self.resumeDownload = False - self.chunkLimit = 1 - self.multiDL = self.premium + self.multiDL = self.premium + self.chunkLimit = 1 def process(self, pyfile): diff --git a/module/plugins/hoster/GamefrontCom.py b/module/plugins/hoster/GamefrontCom.py index 919d40891..c68866f87 100644 --- a/module/plugins/hoster/GamefrontCom.py +++ b/module/plugins/hoster/GamefrontCom.py @@ -25,8 +25,9 @@ class GamefrontCom(Hoster): def setup(self): - self.resumeDownload = self.multiDL = True - self.chunkLimit = -1 + self.resumeDownload = True + self.multiDL = True + self.chunkLimit = -1 def process(self, pyfile): diff --git a/module/plugins/hoster/GooIm.py b/module/plugins/hoster/GooIm.py index 854e348c8..436d825a9 100644 --- a/module/plugins/hoster/GooIm.py +++ b/module/plugins/hoster/GooIm.py @@ -25,7 +25,8 @@ class GooIm(SimpleHoster): def setup(self): - self.multiDL = self.resumeDownload = True + self.resumeDownload = True + self.multiDL = True def handleFree(self): diff --git a/module/plugins/hoster/JumbofilesCom.py b/module/plugins/hoster/JumbofilesCom.py index d566ec0e2..2df639ac1 100644 --- a/module/plugins/hoster/JumbofilesCom.py +++ b/module/plugins/hoster/JumbofilesCom.py @@ -23,7 +23,8 @@ class JumbofilesCom(SimpleHoster): def setup(self): - self.resumeDownload = self.multiDL = True + self.resumeDownload = True + self.multiDL = True def handleFree(self): diff --git a/module/plugins/hoster/KingfilesNet.py b/module/plugins/hoster/KingfilesNet.py index 202ab4a77..c84e3bb0f 100644 --- a/module/plugins/hoster/KingfilesNet.py +++ b/module/plugins/hoster/KingfilesNet.py @@ -30,8 +30,8 @@ class KingfilesNet(SimpleHoster): def setup(self): - self.multiDL = True self.resumeDownload = True + self.multiDL = True def handleFree(self): diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index 6b1472dd8..9d8441c6f 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -36,7 +36,7 @@ class MegasharesCom(SimpleHoster): def setup(self): self.resumeDownload = True - self.multiDL = self.premium + self.multiDL = self.premium def handlePremium(self): @@ -55,15 +55,18 @@ class MegasharesCom(SimpleHoster): for _i in xrange(5): random_num = re.search(self.REACTIVATE_NUM_PATTERN, self.html).group(1) - verifyinput = self.decryptCaptcha( - "http://d01.megashares.com/index.php?secgfx=gfx&random_num=%s" % random_num) + verifyinput = self.decryptCaptcha("http://d01.megashares.com/index.php", + get={'secgfx': "gfx", 'random_num': random_num}) + self.logInfo(_("Reactivating passport %s: %s %s") % (passport_num, random_num, verifyinput)) - url = ("http://d01.megashares.com%s&rs=check_passport_renewal" % request_uri + - "&rsargs[]=%s&rsargs[]=%s&rsargs[]=%s" % (verifyinput, random_num, passport_num) + - "&rsargs[]=replace_sec_pprenewal&rsrnd=%s" % str(int(time() * 1000))) - self.logDebug(url) - res = self.load(url) + res = self.load("http://d01.megashares.com%s" % request_uri, + get={'rs' : "check_passport_renewal", + 'rsargs[]': verifyinput, + 'rsargs[]': random_num, + 'rsargs[]': passport_num, + 'rsargs[]': "replace_sec_pprenewal", + 'rsrnd[]' : str(int(time() * 1000))}) if 'Thank you for reactivating your passport.' in res: self.correctCaptcha() diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index b866b51c5..f5c5ee802 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -14,7 +14,7 @@ from module.plugins.internal.CaptchaService import ReCaptcha def getInfo(urls): ## returns list of tupels (name, size (in bytes), status (see FileDatabase), url) - apiurl = "http://api.netload.in/info.php?auth=Zf9SnQh9WiReEsb18akjvQGqT0I830e8&bz=1&md5=1&file_id=" + apiurl = "http://api.netload.in/info.php" id_regex = re.compile(NetloadIn.__pattern__) urls_per_query = 80 @@ -25,7 +25,12 @@ def getInfo(urls): if match: ids = ids + match.group(1) + ";" - api = getURL(apiurl + ids, decode=True) + api = getURL(apiurl, + get={'auth' : "Zf9SnQh9WiReEsb18akjvQGqT0I830e8", + 'bz' : 1, + 'md5' : 1, + 'file_id': ids}, + decode=True) if api is None or len(api) < 10: self.logDebug("Prefetch failed") @@ -91,7 +96,7 @@ class NetloadIn(Hoster): if self.premium: self.logDebug("Use Premium Account") - settings = self.load("http://www.netload.in/index.php?id=2&lang=en") + settings = self.load("http://www.netload.in/index.php", get={'id': 2, 'lang': "en"}) if '