diff options
201 files changed, 1355 insertions, 1853 deletions
diff --git a/module/plugins/accounts/AlldebridCom.py b/module/plugins/accounts/AlldebridCom.py index 845c1b835..357dd5380 100644 --- a/module/plugins/accounts/AlldebridCom.py +++ b/module/plugins/accounts/AlldebridCom.py @@ -12,7 +12,7 @@ from module.plugins.internal.Account import Account class AlldebridCom(Account): __name__ = "AlldebridCom" __type__ = "account" - __version__ = "0.27" + __version__ = "0.28" __status__ = "testing" __description__ = """AllDebrid.com account plugin""" @@ -20,8 +20,13 @@ class AlldebridCom(Account): __authors__ = [("Andy Voigt", "spamsales@online.de")] - def grab_info(self, user, password, data, req): - data = self.get_data(user) + def grab_hosters(self, user, password, data): + html = self.load("https://www.alldebrid.com/api.php", + get={'action': "get_host"}).replace("\"", "").strip() + return [x.strip() for x in html.split(",") if x.strip()] + + + def grab_info(self, user, password, data): html = self.load("http://www.alldebrid.com/account/") soup = BeautifulSoup.BeautifulSoup(html) @@ -38,7 +43,6 @@ class AlldebridCom(Account): #: Get expiration date from API except Exception: - data = self.get_data(user) html = self.load("https://www.alldebrid.com/api.php", get={'action': "info_user", 'login' : user, @@ -54,7 +58,7 @@ class AlldebridCom(Account): 'premium' : True } - def login(self, user, password, data, req): + def signin(self, user, password, data): html = self.load("https://www.alldebrid.com/register/", get={'action' : "login", 'login_login' : user, diff --git a/module/plugins/accounts/AniStreamCom.py b/module/plugins/accounts/AniStreamCom.py index 53ca1d5b8..5c7ac9fff 100644 --- a/module/plugins/accounts/AniStreamCom.py +++ b/module/plugins/accounts/AniStreamCom.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class AniStreamCom(XFSAccount): __name__ = "AniStreamCom" __type__ = "account" - __version__ = "0.01" + __version__ = "0.02" __status__ = "testing" __description__ = """Ani-Stream.com account plugin""" @@ -14,4 +14,4 @@ class AniStreamCom(XFSAccount): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_DOMAIN = "ani-stream.com" + PLUGIN_DOMAIN = "ani-stream.com" diff --git a/module/plugins/accounts/BackinNet.py b/module/plugins/accounts/BackinNet.py index 58939c13a..d903f020c 100644 --- a/module/plugins/accounts/BackinNet.py +++ b/module/plugins/accounts/BackinNet.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class BackinNet(XFSAccount): __name__ = "BackinNet" __type__ = "account" - __version__ = "0.02" + __version__ = "0.03" __status__ = "testing" __description__ = """Backin.net account plugin""" @@ -14,4 +14,4 @@ class BackinNet(XFSAccount): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_DOMAIN = "backin.net" + PLUGIN_DOMAIN = "backin.net" diff --git a/module/plugins/accounts/BitshareCom.py b/module/plugins/accounts/BitshareCom.py index 16eeb02b2..e8028b9d0 100644 --- a/module/plugins/accounts/BitshareCom.py +++ b/module/plugins/accounts/BitshareCom.py @@ -6,7 +6,7 @@ from module.plugins.internal.Account import Account class BitshareCom(Account): __name__ = "BitshareCom" __type__ = "account" - __version__ = "0.16" + __version__ = "0.17" __status__ = "testing" __description__ = """Bitshare account plugin""" @@ -14,7 +14,7 @@ class BitshareCom(Account): __authors__ = [("Paul King", None)] - def grab_info(self, user, password, data, req): + def grab_info(self, user, password, data): html = self.load("http://bitshare.com/mysettings.html") if "\"http://bitshare.com/myupgrade.html\">Free" in html: @@ -26,11 +26,11 @@ class BitshareCom(Account): return {'validuntil': -1, 'trafficleft': -1, 'premium': True} - def login(self, user, password, data, req): + def signin(self, user, password, data): html = self.load("https://bitshare.com/login.html", post={'user' : user, 'password': password, 'submit' : "Login"}) - if "login" in req.lastEffectiveURL: + if "login" in self.req.lastEffectiveURL: self.fail_login() diff --git a/module/plugins/accounts/CatShareNet.py b/module/plugins/accounts/CatShareNet.py index a8a164352..6e11064a6 100644 --- a/module/plugins/accounts/CatShareNet.py +++ b/module/plugins/accounts/CatShareNet.py @@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account class CatShareNet(Account): __name__ = "CatShareNet" __type__ = "account" - __version__ = "0.09" + __version__ = "0.10" __status__ = "testing" __description__ = """Catshare.net account plugin""" @@ -22,7 +22,7 @@ class CatShareNet(Account): TRAFFIC_LEFT_PATTERN = r'<a href="/premium">([0-9.]+ [kMG]B)' - def grab_info(self, user, password, data, req): + def grab_info(self, user, password, data): premium = False validuntil = -1 trafficleft = -1 @@ -50,7 +50,7 @@ class CatShareNet(Account): return {'premium': premium, 'trafficleft': trafficleft, 'validuntil': validuntil} - def login(self, user, password, data, req): + def signin(self, user, password, data): html = self.load("http://catshare.net/login", #@TODO: Revert to `https` in 0.4.10 post={'user_email' : user, 'user_password' : password, diff --git a/module/plugins/accounts/CloudsixMe.py b/module/plugins/accounts/CloudsixMe.py index 973e37044..3410af002 100644 --- a/module/plugins/accounts/CloudsixMe.py +++ b/module/plugins/accounts/CloudsixMe.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class CloudsixMe(XFSAccount): __name__ = "CloudsixMe" __type__ = "account" - __version__ = "0.01" + __version__ = "0.02" __status__ = "testing" __description__ = """Cloudsix.me account plugin""" @@ -14,4 +14,4 @@ class CloudsixMe(XFSAccount): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_DOMAIN = "cloudsix.me" + PLUGIN_DOMAIN = "cloudsix.me" diff --git a/module/plugins/accounts/CloudzillaTo.py b/module/plugins/accounts/CloudzillaTo.py index 127e226a2..821975ef0 100644 --- a/module/plugins/accounts/CloudzillaTo.py +++ b/module/plugins/accounts/CloudzillaTo.py @@ -8,7 +8,7 @@ from module.plugins.internal.Account import Account class CloudzillaTo(Account): __name__ = "CloudzillaTo" __type__ = "account" - __version__ = "0.05" + __version__ = "0.06" __status__ = "testing" __description__ = """Cloudzilla.to account plugin""" @@ -19,7 +19,7 @@ class CloudzillaTo(Account): PREMIUM_PATTERN = r'<h2>account type</h2>\s*Premium Account' - def grab_info(self, user, password, data, req): + def grab_info(self, user, password, data): html = self.load("http://www.cloudzilla.to/") premium = True if re.search(self.PREMIUM_PATTERN, html) else False @@ -27,7 +27,7 @@ class CloudzillaTo(Account): return {'validuntil': -1, 'trafficleft': -1, 'premium': premium} - def login(self, user, password, data, req): + def signin(self, user, password, data): html = self.load("https://www.cloudzilla.to/", post={'lusername': user, 'lpassword': password, diff --git a/module/plugins/accounts/CramitIn.py b/module/plugins/accounts/CramitIn.py index d3f2e0d77..084aa79a6 100644 --- a/module/plugins/accounts/CramitIn.py +++ b/module/plugins/accounts/CramitIn.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class CramitIn(XFSAccount): __name__ = "CramitIn" __type__ = "account" - __version__ = "0.04" + __version__ = "0.05" __status__ = "testing" __description__ = """Cramit.in account plugin""" @@ -14,4 +14,4 @@ class CramitIn(XFSAccount): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - HOSTER_DOMAIN = "cramit.in" + PLUGIN_DOMAIN = "cramit.in" diff --git a/module/plugins/accounts/CzshareCom.py b/module/plugins/accounts/CzshareCom.py index 77d1073ca..448722dd9 100644 --- a/module/plugins/accounts/CzshareCom.py +++ b/module/plugins/accounts/CzshareCom.py @@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account class CzshareCom(Account): __name__ = "CzshareCom" __type__ = "account" - __version__ = "0.21" + __version__ = "0.22" __status__ = "testing" __description__ = """Czshare.com account plugin, now Sdilej.cz""" @@ -21,7 +21,7 @@ class CzshareCom(Account): CREDIT_LEFT_PATTERN = r'<tr class="active">\s*<td>([\d ,]+) (KiB|MiB|GiB)</td>\s*<td>([^<]*)</td>\s*</tr>' - def grab_info(self, user, password, data, req): + def grab_info(self, user, password, data): premium = False validuntil = None trafficleft = None @@ -44,7 +44,7 @@ class CzshareCom(Account): 'trafficleft': trafficleft} - def login(self, user, password, data, req): + def signin(self, user, password, data): html = self.load('https://sdilej.cz/index.php', post={'Prihlasit' : "Prihlasit", "login-password": password, diff --git a/module/plugins/accounts/DebridItaliaCom.py b/module/plugins/accounts/DebridItaliaCom.py index 35fd6262e..fee7925e7 100644 --- a/module/plugins/accounts/DebridItaliaCom.py +++ b/module/plugins/accounts/DebridItaliaCom.py @@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account class DebridItaliaCom(Account): __name__ = "DebridItaliaCom" __type__ = "account" - __version__ = "0.16" + __version__ = "0.17" __status__ = "testing" __description__ = """Debriditalia.com account plugin""" @@ -21,7 +21,11 @@ class DebridItaliaCom(Account): WALID_UNTIL_PATTERN = r'Premium valid till: (.+?) \|' - def grab_info(self, user, password, data, req): + def grab_hosters(self, user, password, data): + return self.load("http://debriditalia.com/api.php", get={'hosts': ""}).replace('"', '').split(',') + + + def grab_info(self, user, password, data): info = {'premium': False, 'validuntil': None, 'trafficleft': None} html = self.load("http://debriditalia.com/") @@ -36,7 +40,7 @@ class DebridItaliaCom(Account): return info - def login(self, user, password, data, req): + def signin(self, user, password, data): html = self.load("https://debriditalia.com/login.php", get={'u': user, 'p': password}) diff --git a/module/plugins/accounts/DepositfilesCom.py b/module/plugins/accounts/DepositfilesCom.py index 6e4bf9a1b..35df3f939 100644 --- a/module/plugins/accounts/DepositfilesCom.py +++ b/module/plugins/accounts/DepositfilesCom.py @@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account class DepositfilesCom(Account): __name__ = "DepositfilesCom" __type__ = "account" - __version__ = "0.35" + __version__ = "0.36" __status__ = "testing" __description__ = """Depositfiles.com account plugin""" @@ -19,7 +19,7 @@ class DepositfilesCom(Account): ("Walter Purcaro", "vuolter@gmail.com")] - def grab_info(self, user, password, data, req): + def grab_info(self, user, password, data): html = self.load("https://dfiles.eu/de/gold/") validuntil = re.search(r"Sie haben Gold Zugang bis: <b>(.*?)</b></div>", html).group(1) @@ -28,7 +28,7 @@ class DepositfilesCom(Account): return {'validuntil': validuntil, 'trafficleft': -1} - def login(self, user, password, data, req): + def signin(self, user, password, data): html = self.load("https://dfiles.eu/de/login.php", get={'return': "/de/gold/payment.php"}, post={'login' : user, diff --git a/module/plugins/accounts/EasybytezCom.py b/module/plugins/accounts/EasybytezCom.py index 5e1a4f962..3f8254117 100644 --- a/module/plugins/accounts/EasybytezCom.py +++ b/module/plugins/accounts/EasybytezCom.py @@ -8,7 +8,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class EasybytezCom(XFSAccount): __name__ = "EasybytezCom" __type__ = "account" - __version__ = "0.13" + __version__ = "0.14" __status__ = "testing" __description__ = """EasyBytez.com account plugin""" @@ -17,4 +17,9 @@ class EasybytezCom(XFSAccount): ("guidobelix", "guidobelix@hotmail.it")] - HOSTER_DOMAIN = "easybytez.com" + PLUGIN_DOMAIN = "easybytez.com" + + + def grab_hosters(self, user, password, data): + return re.search(r'</textarea>\s*Supported sites:(.*)', + self.load("http://www.easybytez.com")).group(1).split(',') diff --git a/module/plugins/accounts/EuroshareEu.py b/module/plugins/accounts/EuroshareEu.py index 2b90bfc13..09f08dc01 100644 --- a/module/plugins/accounts/EuroshareEu.py +++ b/module/plugins/accounts/EuroshareEu.py @@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account class EuroshareEu(Account): __name__ = "EuroshareEu" __type__ = "account" - __version__ = "0.05" + __version__ = "0.06" __status__ = "testing" __description__ = """Euroshare.eu account plugin""" @@ -17,7 +17,7 @@ class EuroshareEu(Account): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - def grab_info(self, user, password, data, req): + def grab_info(self, user, password, data): self.relogin(user) html = self.load("http://euroshare.eu/customer-zone/settings/") @@ -32,7 +32,7 @@ class EuroshareEu(Account): return {'validuntil': validuntil, 'trafficleft': -1, 'premium': premium} - def login(self, user, password, data, req): + def signin(self, user, password, data): html = self.load('http://euroshare.eu/customer-zone/login/', post={'trvale' : "1", 'login' : user, diff --git a/module/plugins/accounts/ExashareCom.py b/module/plugins/accounts/ExashareCom.py index 26594c702..6b352e40e 100644 --- a/module/plugins/accounts/ExashareCom.py +++ b/module/plugins/accounts/ExashareCom.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class ExashareCom(XFSAccount): __name__ = "ExashareCom" __type__ = "account" - __version__ = "0.02" + __version__ = "0.03" __status__ = "testing" __description__ = """Exashare.com account plugin""" @@ -14,4 +14,4 @@ class ExashareCom(XFSAccount): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_DOMAIN = "exashare.com" + PLUGIN_DOMAIN = "exashare.com" diff --git a/module/plugins/accounts/FastixRu.py b/module/plugins/accounts/FastixRu.py index 31e7d8bca..f48dfee5f 100644 --- a/module/plugins/accounts/FastixRu.py +++ b/module/plugins/accounts/FastixRu.py @@ -7,7 +7,7 @@ from module.common.json_layer import json_loads class FastixRu(Account): __name__ = "FastixRu" __type__ = "account" - __version__ = "0.07" + __version__ = "0.08" __status__ = "testing" __description__ = """Fastix account plugin""" @@ -15,7 +15,7 @@ class FastixRu(Account): __authors__ = [("Massimo Rosamilia", "max@spiritix.eu")] - def grab_hosters(self, user, password, data, req): + def grab_hosters(self, user, password, data): html = self.load("http://fastix.ru/api_v2", get={'apikey': "5182964c3f8f9a7f0b00000a_kelmFB4n1IrnCDYuIFn2y", 'sub' : "allowed_sources"}) @@ -24,8 +24,7 @@ class FastixRu(Account): return host_list - def grab_info(self, user, password, data, req): - data = self.get_data(user) + def grab_info(self, user, password, data): html = json_loads(self.load("http://fastix.ru/api_v2/", get={'apikey': data['apikey'], 'sub' : "getaccountdetails"})) @@ -40,7 +39,7 @@ class FastixRu(Account): return account_info - def login(self, user, password, data, req): + def signin(self, user, password, data): api = json_loads(self.load("https://fastix.ru/api_v2/", get={'sub' : "get_apikey", 'email' : user, diff --git a/module/plugins/accounts/FastshareCz.py b/module/plugins/accounts/FastshareCz.py index 6cf2551d0..a6a2e2ac6 100644 --- a/module/plugins/accounts/FastshareCz.py +++ b/module/plugins/accounts/FastshareCz.py @@ -9,7 +9,7 @@ from module.plugins.internal.Plugin import set_cookie class FastshareCz(Account): __name__ = "FastshareCz" __type__ = "account" - __version__ = "0.10" + __version__ = "0.11" __status__ = "testing" __description__ = """Fastshare.cz account plugin""" @@ -21,7 +21,7 @@ class FastshareCz(Account): CREDIT_PATTERN = r'Credit\s*:\s*</td>\s*<td>(.+?)\s*<' - def grab_info(self, user, password, data, req): + def grab_info(self, user, password, data): validuntil = -1 trafficleft = None premium = False @@ -39,8 +39,8 @@ class FastshareCz(Account): 'premium' : premium} - def login(self, user, password, data, req): - set_cookie(req.cj, "fastshare.cz", "lang", "en") + def signin(self, user, password, data): + set_cookie(self.req.cj, "fastshare.cz", "lang", "en") self.load('http://www.fastshare.cz/login') #@NOTE: Do not remove or it will not login diff --git a/module/plugins/accounts/File4SafeCom.py b/module/plugins/accounts/File4SafeCom.py index 54c3a2359..8e5f437b3 100644 --- a/module/plugins/accounts/File4SafeCom.py +++ b/module/plugins/accounts/File4SafeCom.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class File4SafeCom(XFSAccount): __name__ = "File4SafeCom" __type__ = "account" - __version__ = "0.06" + __version__ = "0.07" __status__ = "testing" __description__ = """File4Safe.com account plugin""" @@ -14,6 +14,6 @@ class File4SafeCom(XFSAccount): __authors__ = [("stickell", "l.stickell@yahoo.it")] - HOSTER_DOMAIN = "file4safe.com" + PLUGIN_DOMAIN = "file4safe.com" LOGIN_FAIL_PATTERN = r'input_login' diff --git a/module/plugins/accounts/FileParadoxIn.py b/module/plugins/accounts/FileParadoxIn.py index 21f43be6e..86183f4d3 100644 --- a/module/plugins/accounts/FileParadoxIn.py +++ b/module/plugins/accounts/FileParadoxIn.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class FileParadoxIn(XFSAccount): __name__ = "FileParadoxIn" __type__ = "account" - __version__ = "0.03" + __version__ = "0.04" __status__ = "testing" __description__ = """FileParadox.in account plugin""" @@ -14,4 +14,4 @@ class FileParadoxIn(XFSAccount): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_DOMAIN = "fileparadox.in" + PLUGIN_DOMAIN = "fileparadox.in" diff --git a/module/plugins/accounts/FilecloudIo.py b/module/plugins/accounts/FilecloudIo.py index 075778af4..d80a8b9d6 100644 --- a/module/plugins/accounts/FilecloudIo.py +++ b/module/plugins/accounts/FilecloudIo.py @@ -8,7 +8,7 @@ from module.plugins.internal.Plugin import set_cookie class FilecloudIo(Account): __name__ = "FilecloudIo" __type__ = "account" - __version__ = "0.08" + __version__ = "0.09" __status__ = "testing" __description__ = """FilecloudIo account plugin""" @@ -17,7 +17,7 @@ class FilecloudIo(Account): ("stickell", "l.stickell@yahoo.it")] - def grab_info(self, user, password, data, req): + def grab_info(self, user, password, data): #: It looks like the first API request always fails, so we retry 5 times, it should work on the second try for _i in xrange(5): rep = self.load("https://secure.filecloud.io/api-fetch_apikey.api", @@ -43,8 +43,8 @@ class FilecloudIo(Account): return {'premium': False} - def login(self, user, password, data, req): - set_cookie(req.cj, "secure.filecloud.io", "lang", "en") + def signin(self, user, password, data): + set_cookie(self.req.cj, "secure.filecloud.io", "lang", "en") html = self.load('https://secure.filecloud.io/user-login.html') if not hasattr(self, "form_data"): diff --git a/module/plugins/accounts/FilefactoryCom.py b/module/plugins/accounts/FilefactoryCom.py index 69b1a7d7e..0bb814039 100644 --- a/module/plugins/accounts/FilefactoryCom.py +++ b/module/plugins/accounts/FilefactoryCom.py @@ -10,7 +10,7 @@ from module.plugins.internal.Account import Account class FilefactoryCom(Account): __name__ = "FilefactoryCom" __type__ = "account" - __version__ = "0.18" + __version__ = "0.19" __status__ = "testing" __description__ = """Filefactory.com account plugin""" @@ -22,7 +22,7 @@ class FilefactoryCom(Account): VALID_UNTIL_PATTERN = r'Premium valid until: <strong>(?P<D>\d{1,2})\w{1,2} (?P<M>\w{3}), (?P<Y>\d{4})</strong>' - def grab_info(self, user, password, data, req): + def grab_info(self, user, password, data): html = self.load("http://www.filefactory.com/account/") m = re.search(self.VALID_UNTIL_PATTERN, html) @@ -37,13 +37,13 @@ class FilefactoryCom(Account): return {'premium': premium, 'trafficleft': -1, 'validuntil': validuntil} - def login(self, user, password, data, req): - req.http.c.setopt(pycurl.REFERER, "http://www.filefactory.com/member/login.php") + def signin(self, user, password, data): + self.req.http.c.setopt(pycurl.REFERER, "http://www.filefactory.com/member/login.php") html = self.load("https://www.filefactory.com/member/signin.php", post={'loginEmail' : user, 'loginPassword': password, 'Submit' : "Sign In"}) - if req.lastEffectiveURL != "http://www.filefactory.com/account/": + if self.req.lastEffectiveURL != "http://www.filefactory.com/account/": self.fail_login() diff --git a/module/plugins/accounts/FilejungleCom.py b/module/plugins/accounts/FilejungleCom.py index a2ab676ee..a7a1c3f56 100644 --- a/module/plugins/accounts/FilejungleCom.py +++ b/module/plugins/accounts/FilejungleCom.py @@ -10,7 +10,7 @@ from module.plugins.internal.Account import Account class FilejungleCom(Account): __name__ = "FilejungleCom" __type__ = "account" - __version__ = "0.15" + __version__ = "0.16" __status__ = "testing" __description__ = """Filejungle.com account plugin""" @@ -25,7 +25,7 @@ class FilejungleCom(Account): LOGIN_FAILED_PATTERN = r'<span htmlfor="loginUser(Name|Password)" generated="true" class="fail_info">' - def grab_info(self, user, password, data, req): + def grab_info(self, user, password, data): html = self.load(self.URL + "dashboard.php") m = re.search(self.TRAFFIC_LEFT_PATTERN, html) if m: @@ -38,7 +38,7 @@ class FilejungleCom(Account): return {'premium': premium, 'trafficleft': -1, 'validuntil': validuntil} - def login(self, user, password, data, req): + def signin(self, user, password, data): html = self.load(urlparse.urljoin(self.URL, "login.php"), post={'loginUserName' : user, 'loginUserPassword' : password, diff --git a/module/plugins/accounts/FileomCom.py b/module/plugins/accounts/FileomCom.py index 957f4ef05..0bd0b60cf 100644 --- a/module/plugins/accounts/FileomCom.py +++ b/module/plugins/accounts/FileomCom.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class FileomCom(XFSAccount): __name__ = "FileomCom" __type__ = "account" - __version__ = "0.03" + __version__ = "0.04" __status__ = "testing" __description__ = """Fileom.com account plugin""" @@ -14,4 +14,4 @@ class FileomCom(XFSAccount): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_DOMAIN = "fileom.com" + PLUGIN_DOMAIN = "fileom.com" diff --git a/module/plugins/accounts/FilerNet.py b/module/plugins/accounts/FilerNet.py index 8cfc39ef5..96bdebd81 100644 --- a/module/plugins/accounts/FilerNet.py +++ b/module/plugins/accounts/FilerNet.py @@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account class FilerNet(Account): __name__ = "FilerNet" __type__ = "account" - __version__ = "0.08" + __version__ = "0.09" __status__ = "testing" __description__ = """Filer.net account plugin""" @@ -23,7 +23,7 @@ class FilerNet(Account): FREE_PATTERN = r'Account Status</th>\s*<td>\s*Free' - def grab_info(self, user, password, data, req): + def grab_info(self, user, password, data): html = self.load("https://filer.net/profile") #: Free user @@ -43,7 +43,7 @@ class FilerNet(Account): return {'premium': False, 'validuntil': None, 'trafficleft': None} - def login(self, user, password, data, req): + def signin(self, user, password, data): html = self.load("https://filer.net/login") token = re.search(self.TOKEN_PATTERN, html).group(1) diff --git a/module/plugins/accounts/FilerioCom.py b/module/plugins/accounts/FilerioCom.py index 8a4750036..d843dd605 100644 --- a/module/plugins/accounts/FilerioCom.py +++ b/module/plugins/accounts/FilerioCom.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class FilerioCom(XFSAccount): __name__ = "FilerioCom" __type__ = "account" - __version__ = "0.04" + __version__ = "0.05" __status__ = "testing" __description__ = """FileRio.in account plugin""" @@ -14,4 +14,4 @@ class FilerioCom(XFSAccount): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - HOSTER_DOMAIN = "filerio.in" + PLUGIN_DOMAIN = "filerio.in" diff --git a/module/plugins/accounts/FilesMailRu.py b/module/plugins/accounts/FilesMailRu.py index cbbdd7528..551a7b8e5 100644 --- a/module/plugins/accounts/FilesMailRu.py +++ b/module/plugins/accounts/FilesMailRu.py @@ -6,7 +6,7 @@ from module.plugins.internal.Account import Account class FilesMailRu(Account): __name__ = "FilesMailRu" __type__ = "account" - __version__ = "0.14" + __version__ = "0.15" __status__ = "testing" __description__ = """Filesmail.ru account plugin""" @@ -14,11 +14,11 @@ class FilesMailRu(Account): __authors__ = [("RaNaN", "RaNaN@pyload.org")] - def grab_info(self, user, password, data, req): + def grab_info(self, user, password, data): return {'validuntil': None, 'trafficleft': None} - def login(self, user, password, data, req): + def signin(self, user, password, data): user, domain = user.split("@") html = self.load("https://swa.mail.ru/cgi-bin/auth", diff --git a/module/plugins/accounts/FileserveCom.py b/module/plugins/accounts/FileserveCom.py index 86401a486..bc56d4b96 100644 --- a/module/plugins/accounts/FileserveCom.py +++ b/module/plugins/accounts/FileserveCom.py @@ -9,7 +9,7 @@ from module.common.json_layer import json_loads class FileserveCom(Account): __name__ = "FileserveCom" __type__ = "account" - __version__ = "0.23" + __version__ = "0.24" __status__ = "testing" __description__ = """Fileserve.com account plugin""" @@ -17,9 +17,7 @@ class FileserveCom(Account): __authors__ = [("mkaay", "mkaay@mkaay.de")] - def grab_info(self, user, password, data, req): - data = self.get_data(user) - + def grab_info(self, user, password, data): html = self.load("http://app.fileserve.com/api/login/", post={'username': user, 'password': password, @@ -33,7 +31,7 @@ class FileserveCom(Account): return {'premium': False, 'trafficleft': None, 'validuntil': None} - def login(self, user, password, data, req): + def signin(self, user, password, data): html = self.load("http://app.fileserve.com/api/login/", post={'username': user, 'password': password, diff --git a/module/plugins/accounts/FourSharedCom.py b/module/plugins/accounts/FourSharedCom.py index 913de1a55..05e75f326 100644 --- a/module/plugins/accounts/FourSharedCom.py +++ b/module/plugins/accounts/FourSharedCom.py @@ -7,7 +7,7 @@ from module.plugins.internal.Plugin import set_cookie class FourSharedCom(Account): __name__ = "FourSharedCom" __type__ = "account" - __version__ = "0.08" + __version__ = "0.09" __status__ = "testing" __description__ = """FourShared.com account plugin""" @@ -16,13 +16,13 @@ class FourSharedCom(Account): ("stickell", "l.stickell@yahoo.it")] - def grab_info(self, user, password, data, req): + def grab_info(self, user, password, data): #: Free mode only for now return {'premium': False} - def login(self, user, password, data, req): - set_cookie(req.cj, "4shared.com", "4langcookie", "en") + def signin(self, user, password, data): + set_cookie(self.req.cj, "4shared.com", "4langcookie", "en") res = self.load("https://www.4shared.com/web/login", post={'login' : user, diff --git a/module/plugins/accounts/FreakshareCom.py b/module/plugins/accounts/FreakshareCom.py index f02741ed2..42551b732 100644 --- a/module/plugins/accounts/FreakshareCom.py +++ b/module/plugins/accounts/FreakshareCom.py @@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account class FreakshareCom(Account): __name__ = "FreakshareCom" __type__ = "account" - __version__ = "0.16" + __version__ = "0.17" __status__ = "testing" __description__ = """Freakshare.com account plugin""" @@ -17,7 +17,7 @@ class FreakshareCom(Account): __authors__ = [("RaNaN", "RaNaN@pyload.org")] - def grab_info(self, user, password, data, req): + def grab_info(self, user, password, data): premium = False validuntil = None trafficleft = None @@ -41,7 +41,7 @@ class FreakshareCom(Account): return {'premium': premium, 'validuntil': validuntil, 'trafficleft': trafficleft} - def login(self, user, password, data, req): + def signin(self, user, password, data): self.load("http://freakshare.com/index.php?language=EN") html = self.load("https://freakshare.com/login.html", diff --git a/module/plugins/accounts/FreeWayMe.py b/module/plugins/accounts/FreeWayMe.py index 0cf80348a..dc8027b3c 100644 --- a/module/plugins/accounts/FreeWayMe.py +++ b/module/plugins/accounts/FreeWayMe.py @@ -7,7 +7,7 @@ from module.common.json_layer import json_loads class FreeWayMe(Account): __name__ = "FreeWayMe" __type__ = "account" - __version__ = "0.17" + __version__ = "0.18" __status__ = "testing" __description__ = """FreeWayMe account plugin""" @@ -15,8 +15,16 @@ class FreeWayMe(Account): __authors__ = [("Nicolas Giese", "james@free-way.me")] - def grab_info(self, user, password, data, req): - status = self.get_account_status(user, password, req) + def grab_hosters(self, user, password, data): + hostis = self.load("http://www.free-way.bz/ajax/jd.php", + get={'id' : 3, + 'user': user, + 'pass': password}).replace("\"", "") #@TODO: Revert to `https` in 0.4.10 + return [x.strip() for x in hostis.split(",") if x.strip()] + + + def grab_info(self, user, password, data): + status = self.get_account_status(user, password) self.log_debug(status) @@ -33,15 +41,15 @@ class FreeWayMe(Account): return account_info - def login(self, user, password, data, req): - status = self.get_account_status(user, password, req) + def signin(self, user, password, data): + status = self.get_account_status(user, password) #: Check if user and password are valid if not status: self.fail_login() - def get_account_status(self, user, password, req): + def get_account_status(self, user, password): answer = self.load("http://www.free-way.bz/ajax/jd.php", #@TODO: Revert to `https` in 0.4.10 get={'id': 4, 'user': user, 'pass': password}) diff --git a/module/plugins/accounts/FshareVn.py b/module/plugins/accounts/FshareVn.py index 3bd6d9d7f..4e078ccc9 100644 --- a/module/plugins/accounts/FshareVn.py +++ b/module/plugins/accounts/FshareVn.py @@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account class FshareVn(Account): __name__ = "FshareVn" __type__ = "account" - __version__ = "0.12" + __version__ = "0.13" __status__ = "testing" __description__ = """Fshare.vn account plugin""" @@ -24,7 +24,7 @@ class FshareVn(Account): DIRECT_DOWNLOAD_PATTERN = ur'<input type="checkbox"\s*([^=>]*)[^>]*/>KÃch hoạt download trá»±c tiếp</dt>' - def grab_info(self, user, password, data, req): + def grab_info(self, user, password, data): html = self.load("http://www.fshare.vn/account_info.php") if re.search(self.LIFETIME_PATTERN, html): @@ -45,7 +45,7 @@ class FshareVn(Account): return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} - def login(self, user, password, data, req): + def signin(self, user, password, data): html = self.load("https://www.fshare.vn/login.php", post={'LoginForm[email]' : user, 'LoginForm[password]' : password, diff --git a/module/plugins/accounts/Ftp.py b/module/plugins/accounts/Ftp.py index 2d35ab7bb..d73b557ef 100644 --- a/module/plugins/accounts/Ftp.py +++ b/module/plugins/accounts/Ftp.py @@ -6,7 +6,7 @@ from module.plugins.internal.Account import Account class Ftp(Account): __name__ = "Ftp" __type__ = "account" - __version__ = "0.03" + __version__ = "0.04" __status__ = "testing" __description__ = """Ftp dummy account plugin""" diff --git a/module/plugins/accounts/HellshareCz.py b/module/plugins/accounts/HellshareCz.py index 7dbc828a0..3031c26b6 100644 --- a/module/plugins/accounts/HellshareCz.py +++ b/module/plugins/accounts/HellshareCz.py @@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account class HellshareCz(Account): __name__ = "HellshareCz" __type__ = "account" - __version__ = "0.19" + __version__ = "0.20" __status__ = "testing" __description__ = """Hellshare.cz account plugin""" @@ -20,7 +20,7 @@ class HellshareCz(Account): CREDIT_LEFT_PATTERN = r'<div class="credit-link">\s*<table>\s*<tr>\s*<th>(\d+|\d\d\.\d\d\.)</th>' - def grab_info(self, user, password, data, req): + def grab_info(self, user, password, data): self.relogin(user) html = self.load("http://www.hellshare.com/") @@ -53,13 +53,13 @@ class HellshareCz(Account): return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} - def login(self, user, password, data, req): + def signin(self, user, password, data): html = self.load('http://www.hellshare.com/') - if req.lastEffectiveURL != 'http://www.hellshare.com/': + if self.req.lastEffectiveURL != 'http://www.hellshare.com/': #: Switch to English - self.log_debug("Switch lang - URL: %s" % req.lastEffectiveURL) + self.log_debug("Switch lang - URL: %s" % self.req.lastEffectiveURL) - json = self.load("%s?do=locRouter-show" % req.lastEffectiveURL) + json = self.load("%s?do=locRouter-show" % self.req.lastEffectiveURL) hash = re.search(r"(\-\-[0-9a-f]+\-)", json).group(1) self.log_debug("Switch lang - HASH: %s" % hash) diff --git a/module/plugins/accounts/HighWayMe.py b/module/plugins/accounts/HighWayMe.py index 5189870b0..14cd1081c 100644 --- a/module/plugins/accounts/HighWayMe.py +++ b/module/plugins/accounts/HighWayMe.py @@ -7,7 +7,7 @@ from module.plugins.internal.Account import Account class HighWayMe(Account): __name__ = "HighWayMe.py" __type__ = "account" - __version__ = "0.05" + __version__ = "0.06" __status__ = "testing" __description__ = """High-Way.me account plugin""" @@ -15,7 +15,13 @@ class HighWayMe(Account): __authors__ = [("EvolutionClip", "evolutionclip@live.de")] - def grab_info(self, user, password, data, req): + def grab_hosters(self, user, password, data): + json_data = json_loads(self.load("https://high-way.me/api.php", + get={'hoster': 1})) + return [element['name'] for element in json_data['hoster']] + + + def grab_info(self, user, password, data): premium = False validuntil = -1 trafficleft = None @@ -40,7 +46,7 @@ class HighWayMe(Account): 'trafficleft': trafficleft} - def login(self, user, password, data, req): + def signin(self, user, password, data): html = self.load("https://high-way.me/api.php?login", post={'login': '1', 'user': user, diff --git a/module/plugins/accounts/Http.py b/module/plugins/accounts/Http.py index dcab156ee..261b3b240 100644 --- a/module/plugins/accounts/Http.py +++ b/module/plugins/accounts/Http.py @@ -6,7 +6,7 @@ from module.plugins.internal.Account import Account class Http(Account): __name__ = "Http" __type__ = "account" - __version__ = "0.03" + __version__ = "0.04" __status__ = "testing" __description__ = """Http dummy account plugin""" diff --git a/module/plugins/accounts/HugefilesNet.py b/module/plugins/accounts/HugefilesNet.py index fa64945a3..a5920f4a4 100644 --- a/module/plugins/accounts/HugefilesNet.py +++ b/module/plugins/accounts/HugefilesNet.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class HugefilesNet(XFSAccount): __name__ = "HugefilesNet" __type__ = "account" - __version__ = "0.03" + __version__ = "0.04" __status__ = "testing" __description__ = """Hugefiles.net account plugin""" @@ -14,4 +14,4 @@ class HugefilesNet(XFSAccount): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_DOMAIN = "hugefiles.net" + PLUGIN_DOMAIN = "hugefiles.net" diff --git a/module/plugins/accounts/HundredEightyUploadCom.py b/module/plugins/accounts/HundredEightyUploadCom.py index a8527d62c..8b757de61 100644 --- a/module/plugins/accounts/HundredEightyUploadCom.py +++ b/module/plugins/accounts/HundredEightyUploadCom.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class HundredEightyUploadCom(XFSAccount): __name__ = "HundredEightyUploadCom" __type__ = "account" - __version__ = "0.04" + __version__ = "0.05" __status__ = "testing" __description__ = """180upload.com account plugin""" @@ -14,4 +14,4 @@ class HundredEightyUploadCom(XFSAccount): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_DOMAIN = "180upload.com" + PLUGIN_DOMAIN = "180upload.com" diff --git a/module/plugins/accounts/JunkyvideoCom.py b/module/plugins/accounts/JunkyvideoCom.py index 5fcefda36..316332fd9 100644 --- a/module/plugins/accounts/JunkyvideoCom.py +++ b/module/plugins/accounts/JunkyvideoCom.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class JunkyvideoCom(XFSAccount): __name__ = "JunkyvideoCom" __type__ = "account" - __version__ = "0.02" + __version__ = "0.03" __status__ = "testing" __description__ = """Junkyvideo.com account plugin""" @@ -14,4 +14,4 @@ class JunkyvideoCom(XFSAccount): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_DOMAIN = "junkyvideo.com" + PLUGIN_DOMAIN = "junkyvideo.com" diff --git a/module/plugins/accounts/JunocloudMe.py b/module/plugins/accounts/JunocloudMe.py index 791835dfe..95bc57640 100644 --- a/module/plugins/accounts/JunocloudMe.py +++ b/module/plugins/accounts/JunocloudMe.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class JunocloudMe(XFSAccount): __name__ = "JunocloudMe" __type__ = "account" - __version__ = "0.03" + __version__ = "0.04" __status__ = "testing" __description__ = """Junocloud.me account plugin""" @@ -14,4 +14,4 @@ class JunocloudMe(XFSAccount): __authors__ = [("guidobelix", "guidobelix@hotmail.it")] - HOSTER_DOMAIN = "junocloud.me" + PLUGIN_DOMAIN = "junocloud.me" diff --git a/module/plugins/accounts/Keep2ShareCc.py b/module/plugins/accounts/Keep2ShareCc.py index f67219af0..e76ec212c 100644 --- a/module/plugins/accounts/Keep2ShareCc.py +++ b/module/plugins/accounts/Keep2ShareCc.py @@ -10,7 +10,7 @@ from module.plugins.internal.Plugin import set_cookie class Keep2ShareCc(Account): __name__ = "Keep2ShareCc" __type__ = "account" - __version__ = "0.09" + __version__ = "0.10" __status__ = "testing" __description__ = """Keep2Share.cc account plugin""" @@ -25,7 +25,7 @@ class Keep2ShareCc(Account): LOGIN_FAIL_PATTERN = r'Please fix the following input errors' - def grab_info(self, user, password, data, req): + def grab_info(self, user, password, data): validuntil = None trafficleft = -1 premium = False @@ -61,8 +61,8 @@ class Keep2ShareCc(Account): return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} - def login(self, user, password, data, req): - set_cookie(req.cj, "keep2share.cc", "lang", "en") + def signin(self, user, password, data): + set_cookie(self.req.cj, "keep2share.cc", "lang", "en") html = self.load("https://keep2share.cc/login.html", post={'LoginForm[username]' : user, diff --git a/module/plugins/accounts/LetitbitNet.py b/module/plugins/accounts/LetitbitNet.py index f829e5737..f7350e547 100644 --- a/module/plugins/accounts/LetitbitNet.py +++ b/module/plugins/accounts/LetitbitNet.py @@ -7,7 +7,7 @@ from module.plugins.internal.Account import Account class LetitbitNet(Account): __name__ = "LetitbitNet" __type__ = "account" - __version__ = "0.05" + __version__ = "0.06" __status__ = "testing" __description__ = """Letitbit.net account plugin""" @@ -15,7 +15,7 @@ class LetitbitNet(Account): __authors__ = [("stickell", "l.stickell@yahoo.it")] - def grab_info(self, user, password, data, req): + def grab_info(self, user, password, data): ## DISABLED BECAUSE IT GET 'key exausted' EVEN IF VALID ## # json_data = [password, ['key/info']] # api_rep = self.load("http://api.letitbit.net/json", @@ -30,6 +30,6 @@ class LetitbitNet(Account): return {'premium': True} - def login(self, user, password, data, req): + def signin(self, user, password, data): #: API_KEY is the username and the PREMIUM_KEY is the password self.log_info(_("You must use your API KEY as username and the PREMIUM KEY as password")) diff --git a/module/plugins/accounts/LinksnappyCom.py b/module/plugins/accounts/LinksnappyCom.py index 53801c8b0..6e2b400f1 100644 --- a/module/plugins/accounts/LinksnappyCom.py +++ b/module/plugins/accounts/LinksnappyCom.py @@ -9,7 +9,7 @@ from module.common.json_layer import json_loads class LinksnappyCom(Account): __name__ = "LinksnappyCom" __type__ = "account" - __version__ = "0.08" + __version__ = "0.09" __status__ = "testing" __description__ = """Linksnappy.com account plugin""" @@ -17,8 +17,14 @@ class LinksnappyCom(Account): __authors__ = [("stickell", "l.stickell@yahoo.it")] - def grab_info(self, user, password, data, req): - data = self.get_data(user) + def grab_hosters(self, user, password, data): + json_data = self.load("http://gen.linksnappy.com/lseAPI.php", get={'act': "FILEHOSTS"}) + json_data = json_loads(json_data) + + return json_data['return'].keys() + + + def grab_info(self, user, password, data): r = self.load('http://gen.linksnappy.com/lseAPI.php', get={'act' : 'USERDETAILS', 'username': user, @@ -52,7 +58,7 @@ class LinksnappyCom(Account): 'trafficleft': trafficleft} - def login(self, user, password, data, req): + def signin(self, user, password, data): html = self.load("https://gen.linksnappy.com/lseAPI.php", get={'act' : 'USERDETAILS', 'username': user, diff --git a/module/plugins/accounts/MegaDebridEu.py b/module/plugins/accounts/MegaDebridEu.py index 7a14730ce..b6f7660e9 100644 --- a/module/plugins/accounts/MegaDebridEu.py +++ b/module/plugins/accounts/MegaDebridEu.py @@ -7,7 +7,7 @@ from module.common.json_layer import json_loads class MegaDebridEu(Account): __name__ = "MegaDebridEu" __type__ = "account" - __version__ = "0.23" + __version__ = "0.24" __status__ = "testing" __description__ = """Mega-debrid.eu account plugin""" @@ -19,8 +19,20 @@ class MegaDebridEu(Account): API_URL = "https://www.mega-debrid.eu/api.php" - def grab_info(self, user, password, data, req): - data = self.get_data(user) + def grab_hosters(self, user, password, data): + reponse = self.load("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.log_error(_("Unable to retrieve hoster list")) + host_list = [] + + return host_list + + + def grab_info(self, user, password, data): jsonResponse = self.load(self.API_URL, get={'action' : 'connectUser', 'login' : user, @@ -34,7 +46,7 @@ class MegaDebridEu(Account): return {'status': False, 'premium': False} - def login(self, user, password, data, req): + def signin(self, user, password, data): jsonResponse = self.load(self.API_URL, get={'action' : 'connectUser', 'login' : user, diff --git a/module/plugins/accounts/MegaRapidCz.py b/module/plugins/accounts/MegaRapidCz.py index 8a5f92404..00ffcb742 100644 --- a/module/plugins/accounts/MegaRapidCz.py +++ b/module/plugins/accounts/MegaRapidCz.py @@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account class MegaRapidCz(Account): __name__ = "MegaRapidCz" __type__ = "account" - __version__ = "0.38" + __version__ = "0.39" __status__ = "testing" __description__ = """MegaRapid.cz account plugin""" @@ -25,12 +25,11 @@ class MegaRapidCz(Account): TRAFFIC_LEFT_PATTERN = r'<tr><td>Kredit</td><td>(.*?) GiB' - def grab_info(self, user, password, data, req): + def grab_info(self, user, password, data): htmll = self.load("http://megarapid.cz/mujucet/") m = re.search(self.LIMITDL_PATTERN, htmll) if m: - data = self.get_data(user) data['options']['limitDL'] = [int(m.group(1))] m = re.search(self.VALID_UNTIL_PATTERN, htmll) @@ -46,7 +45,7 @@ class MegaRapidCz(Account): return {'premium': False, 'trafficleft': None, 'validuntil': None} - def login(self, user, password, data, req): + def signin(self, user, password, data): html = self.load("http://megarapid.cz/prihlaseni/") if "Heslo:" in html: diff --git a/module/plugins/accounts/MegaRapidoNet.py b/module/plugins/accounts/MegaRapidoNet.py index f11cf284c..84ef65e61 100644 --- a/module/plugins/accounts/MegaRapidoNet.py +++ b/module/plugins/accounts/MegaRapidoNet.py @@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account class MegaRapidoNet(Account): __name__ = "MegaRapidoNet" __type__ = "account" - __version__ = "0.05" + __version__ = "0.06" __status__ = "testing" __description__ = """MegaRapido.net account plugin""" @@ -21,7 +21,68 @@ class MegaRapidoNet(Account): USER_ID_PATTERN = r'<\s*?div[^>]*?class\s*?=\s*?["\']checkbox_compartilhar["\'].*?>.*?<\s*?input[^>]*?name\s*?=\s*?["\']usar["\'].*?>.*?<\s*?input[^>]*?name\s*?=\s*?["\']user["\'][^>]*?value\s*?=\s*?["\'](.*?)\s*?["\']' - def grab_info(self, user, password, data, req): + def grab_hosters(self, user, password, data): + 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.values(): + hoster_list.extend(item) + + return hoster_list + + + def grab_info(self, user, password, data): validuntil = None trafficleft = None premium = False @@ -40,7 +101,7 @@ class MegaRapidoNet(Account): 'premium' : premium} - def login(self, user, password, data, req): + def signin(self, user, password, data): self.load("http://megarapido.net/login") self.load("http://megarapido.net/painel_user/ajax/logar.php", post={'login': user, diff --git a/module/plugins/accounts/MegasharesCom.py b/module/plugins/accounts/MegasharesCom.py index da8d6d62f..6967a7502 100644 --- a/module/plugins/accounts/MegasharesCom.py +++ b/module/plugins/accounts/MegasharesCom.py @@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account class MegasharesCom(Account): __name__ = "MegasharesCom" __type__ = "account" - __version__ = "0.06" + __version__ = "0.07" __status__ = "testing" __description__ = """Megashares.com account plugin""" @@ -20,7 +20,7 @@ class MegasharesCom(Account): VALID_UNTIL_PATTERN = r'<p class="premium_info_box">Period Ends: (\w{3} \d{1,2}, \d{4})</p>' - def grab_info(self, user, password, data, req): + def grab_info(self, user, password, data): # self.relogin(user) html = self.load("http://d01.megashares.com/myms.php") @@ -38,7 +38,7 @@ class MegasharesCom(Account): return {'validuntil': validuntil, 'trafficleft': -1, 'premium': premium} - def login(self, user, password, data, req): + def signin(self, user, password, data): html = self.load('http://d01.megashares.com/myms_login.php', post={'httpref' : "", 'myms_login' : "Login", diff --git a/module/plugins/accounts/MovReelCom.py b/module/plugins/accounts/MovReelCom.py index 090950bf2..1594a2b6a 100644 --- a/module/plugins/accounts/MovReelCom.py +++ b/module/plugins/accounts/MovReelCom.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class MovReelCom(XFSAccount): __name__ = "MovReelCom" __type__ = "account" - __version__ = "0.04" + __version__ = "0.05" __status__ = "testing" __description__ = """Movreel.com account plugin""" @@ -17,4 +17,4 @@ class MovReelCom(XFSAccount): login_timeout = 60 info_threshold = 30 - HOSTER_DOMAIN = "movreel.com" + PLUGIN_DOMAIN = "movreel.com" diff --git a/module/plugins/accounts/MultihostersCom.py b/module/plugins/accounts/MultihostersCom.py index ed04ad3c2..1ede88574 100644 --- a/module/plugins/accounts/MultihostersCom.py +++ b/module/plugins/accounts/MultihostersCom.py @@ -6,7 +6,7 @@ from module.plugins.accounts.ZeveraCom import ZeveraCom class MultihostersCom(ZeveraCom): __name__ = "MultihostersCom" __type__ = "account" - __version__ = "0.04" + __version__ = "0.05" __status__ = "testing" __description__ = """Multihosters.com account plugin""" @@ -14,4 +14,4 @@ class MultihostersCom(ZeveraCom): __authors__ = [("tjeh", "tjeh@gmx.net")] - HOSTER_DOMAIN = "multihosters.com" + PLUGIN_DOMAIN = "multihosters.com" diff --git a/module/plugins/accounts/MultishareCz.py b/module/plugins/accounts/MultishareCz.py index b1cbdea8a..62c149561 100644 --- a/module/plugins/accounts/MultishareCz.py +++ b/module/plugins/accounts/MultishareCz.py @@ -8,7 +8,7 @@ from module.plugins.internal.Account import Account class MultishareCz(Account): __name__ = "MultishareCz" __type__ = "account" - __version__ = "0.08" + __version__ = "0.09" __status__ = "testing" __description__ = """Multishare.cz account plugin""" @@ -19,8 +19,15 @@ class MultishareCz(Account): TRAFFIC_LEFT_PATTERN = r'<span class="profil-zvyrazneni">Kredit:</span>\s*<strong>(?P<S>[\d.,]+) (?P<U>[\w^_]+)</strong>' ACCOUNT_INFO_PATTERN = r'<input type="hidden" id="(u_ID|u_hash)" name=".+?" value="(.+?)">' + PLUGIN_PATTERN = r'<img class="logo-shareserveru"[^>]*?alt="(.+?)"></td>\s*<td class="stav">[^>]*?alt="OK"' - def grab_info(self, user, password, data, req): + + def grab_hosters(self, user, password, data): + html = self.load("http://www.multishare.cz/monitoring/") + return re.findall(self.PLUGIN_PATTERN, html) + + + def grab_info(self, user, password, data): # self.relogin(user) html = self.load("http://www.multishare.cz/profil/") @@ -34,7 +41,7 @@ class MultishareCz(Account): return dict(mms_info, **{'validuntil': -1, 'trafficleft': trafficleft}) - def login(self, user, password, data, req): + def signin(self, user, password, data): html = self.load('https://www.multishare.cz/html/prihlaseni_process.php', post={'akce' : "PÅihlásit", 'heslo': password, diff --git a/module/plugins/accounts/MyfastfileCom.py b/module/plugins/accounts/MyfastfileCom.py index 244a7408b..1b4854751 100644 --- a/module/plugins/accounts/MyfastfileCom.py +++ b/module/plugins/accounts/MyfastfileCom.py @@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account class MyfastfileCom(Account): __name__ = "MyfastfileCom" __type__ = "account" - __version__ = "0.07" + __version__ = "0.08" __status__ = "testing" __description__ = """Myfastfile.com account plugin""" @@ -17,7 +17,14 @@ class MyfastfileCom(Account): __authors__ = [("stickell", "l.stickell@yahoo.it")] - def grab_info(self, user, password, data, req): + def grab_hosters(self, user, password, data): + json_data = self.load("http://myfastfile.com/api.php", get={'hosts': ""}) + self.log_debug("JSON data", json_data) + json_data = json_loads(json_data) + + return json_data['hosts'] + + def grab_info(self, user, password, data): if 'days_left' in self.json_data: validuntil = time.time() + self.json_data['days_left'] * 24 * 60 * 60 return {'premium': True, 'validuntil': validuntil, 'trafficleft': -1} @@ -25,7 +32,7 @@ class MyfastfileCom(Account): self.log_error(_("Unable to get account information")) - def login(self, user, password, data, req): + def signin(self, user, password, data): #: Password to use is the API-Password written in http://myfastfile.com/myaccount html = self.load("https://myfastfile.com/api.php", get={'user': user, diff --git a/module/plugins/accounts/NitroflareCom.py b/module/plugins/accounts/NitroflareCom.py index ec90ac341..11a3a43e7 100644 --- a/module/plugins/accounts/NitroflareCom.py +++ b/module/plugins/accounts/NitroflareCom.py @@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account class NitroflareCom(Account): __name__ = "NitroflareCom" __type__ = "account" - __version__ = "0.07" + __version__ = "0.08" __status__ = "testing" __description__ = """Nitroflare.com account plugin""" @@ -24,7 +24,7 @@ class NitroflareCom(Account): TOKEN_PATTERN = r'name="token" value="(.+?)"' - def grab_info(self, user, password, data, req): + def grab_info(self, user, password, data): validuntil = -1 trafficleft = None premium = False @@ -68,7 +68,7 @@ class NitroflareCom(Account): 'premium' : premium} - def login(self, user, password, data, req): + def signin(self, user, password, data): html = self.load("https://nitroflare.com/login") token = re.search(self.TOKEN_PATTERN, html).group(1) diff --git a/module/plugins/accounts/NoPremiumPl.py b/module/plugins/accounts/NoPremiumPl.py index e8de0f4cf..6d6b372b7 100644 --- a/module/plugins/accounts/NoPremiumPl.py +++ b/module/plugins/accounts/NoPremiumPl.py @@ -6,12 +6,13 @@ import time from module.common.json_layer import json_loads from module.plugins.internal.Account import Account +# from module.plugins.internal.MultiAccount import MultiAccount class NoPremiumPl(Account): __name__ = "NoPremiumPl" __type__ = "account" - __version__ = "0.05" + __version__ = "0.06" __status__ = "testing" __description__ = "NoPremium.pl account plugin" @@ -27,13 +28,16 @@ class NoPremiumPl(Account): 'loc' : "1" , 'info' : "1" } - _req = None - _usr = None - _pwd = None + def grab_hosters(self, user, password, data): + hostings = json_loads(self.load("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.log_debug(hostings_domains) - def grab_info(self, user, password, data, req): - self._req = req + return hostings_domains + + + def grab_info(self, user, password, data): try: result = json_loads(self.run_auth_query()) @@ -55,10 +59,9 @@ class NoPremiumPl(Account): 'premium' : premium } - def login(self, user, password, data, req): - self._usr = user - self._pwd = hashlib.sha1(hashlib.md5(password).hexdigest()).hexdigest() - self._req = req + def signin(self, user, password, data): + data['usr'] = user + data['pwd'] = hashlib.sha1(hashlib.md5(password).hexdigest()).hexdigest() try: response = json_loads(self.run_auth_query()) @@ -69,14 +72,11 @@ class NoPremiumPl(Account): if "errno" in response.keys(): self.fail_login() - data['usr'] = self._usr - data['pwd'] = self._pwd - def create_auth_query(self): query = self.API_QUERY - query['username'] = self._usr - query['password'] = self._pwd + query['username'] = self.info['data']['usr'] + query['password'] = self.info['data']['pwd'] return query diff --git a/module/plugins/accounts/NosuploadCom.py b/module/plugins/accounts/NosuploadCom.py index 5febc8d66..65ac8d4fc 100644 --- a/module/plugins/accounts/NosuploadCom.py +++ b/module/plugins/accounts/NosuploadCom.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class NosuploadCom(XFSAccount): __name__ = "NosuploadCom" __type__ = "account" - __version__ = "0.03" + __version__ = "0.04" __status__ = "testing" __description__ = """Nosupload.com account plugin""" @@ -14,4 +14,4 @@ class NosuploadCom(XFSAccount): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_DOMAIN = "nosupload.com" + PLUGIN_DOMAIN = "nosupload.com" diff --git a/module/plugins/accounts/NovafileCom.py b/module/plugins/accounts/NovafileCom.py index 524c01087..1506ec315 100644 --- a/module/plugins/accounts/NovafileCom.py +++ b/module/plugins/accounts/NovafileCom.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class NovafileCom(XFSAccount): __name__ = "NovafileCom" __type__ = "account" - __version__ = "0.03" + __version__ = "0.04" __status__ = "testing" __description__ = """Novafile.com account plugin""" @@ -14,4 +14,4 @@ class NovafileCom(XFSAccount): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_DOMAIN = "novafile.com" + PLUGIN_DOMAIN = "novafile.com" diff --git a/module/plugins/accounts/NowVideoSx.py b/module/plugins/accounts/NowVideoSx.py index f2b2b7bdc..3d8484b8b 100644 --- a/module/plugins/accounts/NowVideoSx.py +++ b/module/plugins/accounts/NowVideoSx.py @@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account class NowVideoSx(Account): __name__ = "NowVideoSx" __type__ = "account" - __version__ = "0.06" + __version__ = "0.07" __status__ = "testing" __description__ = """NowVideo.at account plugin""" @@ -20,7 +20,7 @@ class NowVideoSx(Account): VALID_UNTIL_PATTERN = r'>Your premium membership expires on: (.+?)<' - def grab_info(self, user, password, data, req): + def grab_info(self, user, password, data): validuntil = None trafficleft = -1 premium = None @@ -48,7 +48,7 @@ class NowVideoSx(Account): return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} - def login(self, user, password, data, req): + def signin(self, user, password, data): html = self.load("http://www.nowvideo.sx/login.php", post={'user': user, 'pass': password}) diff --git a/module/plugins/accounts/OboomCom.py b/module/plugins/accounts/OboomCom.py index abb223e65..c19396854 100644 --- a/module/plugins/accounts/OboomCom.py +++ b/module/plugins/accounts/OboomCom.py @@ -23,7 +23,7 @@ from module.plugins.internal.Account import Account class OboomCom(Account): __name__ = "OboomCom" __type__ = "account" - __version__ = "0.28" + __version__ = "0.29" __status__ = "testing" __description__ = """Oboom.com account plugin""" @@ -31,10 +31,9 @@ class OboomCom(Account): __authors__ = [("stanley", "stanley.foerster@gmail.com")] - def load_account_data(self, user, req): - passwd = self.get_info(user)['login']['password'] - salt = passwd[::-1] - pbkdf2 = PBKDF2(passwd, salt, 1000).hexread(16) + def load_account_data(self, user, password): + salt = password[::-1] + pbkdf2 = PBKDF2(password, salt, 1000).hexread(16) result = json_loads(self.load("http://www.oboom.com/1/login", #@TODO: Revert to `https` in 0.4.10 get={'auth': user, @@ -47,8 +46,8 @@ class OboomCom(Account): return result[1] - def grab_info(self, name, req): - account_data = self.load_account_data(name, req) + def grab_info(self, user, password, data): + account_data = self.load_account_data(user, password) userData = account_data['user'] @@ -73,5 +72,5 @@ class OboomCom(Account): 'session' : session} - def login(self, user, password, data, req): - self.load_account_data(user, req) + def signin(self, user, password, data): + self.load_account_data(user, password) diff --git a/module/plugins/accounts/OneFichierCom.py b/module/plugins/accounts/OneFichierCom.py index e215e1fe0..9be982bee 100644 --- a/module/plugins/accounts/OneFichierCom.py +++ b/module/plugins/accounts/OneFichierCom.py @@ -10,7 +10,7 @@ from module.plugins.internal.Account import Account class OneFichierCom(Account): __name__ = "OneFichierCom" __type__ = "account" - __version__ = "0.16" + __version__ = "0.17" __status__ = "testing" __description__ = """1fichier.com account plugin""" @@ -22,7 +22,7 @@ class OneFichierCom(Account): VALID_UNTIL_PATTERN = r'Your subscription will end the (\d+-\d+-\d+)' - def grab_info(self, user, password, data, req): + def grab_info(self, user, password, data): validuntil = None trafficleft = -1 premium = None @@ -45,8 +45,8 @@ class OneFichierCom(Account): return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium or False} - def login(self, user, password, data, req): - req.http.c.setopt(pycurl.REFERER, "https://1fichier.com/login.pl?lg=en") + def signin(self, user, password, data): + self.req.http.c.setopt(pycurl.REFERER, "https://1fichier.com/login.pl?lg=en") html = self.load("https://1fichier.com/login.pl?lg=en", post={'mail' : user, diff --git a/module/plugins/accounts/OverLoadMe.py b/module/plugins/accounts/OverLoadMe.py index cdb500767..9a26ac368 100644 --- a/module/plugins/accounts/OverLoadMe.py +++ b/module/plugins/accounts/OverLoadMe.py @@ -7,7 +7,7 @@ from module.common.json_layer import json_loads class OverLoadMe(Account): __name__ = "OverLoadMe" __type__ = "account" - __version__ = "0.07" + __version__ = "0.08" __status__ = "testing" __description__ = """Over-Load.me account plugin""" @@ -15,8 +15,13 @@ class OverLoadMe(Account): __authors__ = [("marley", "marley@over-load.me")] - def grab_info(self, user, password, data, req): - data = self.get_data(user) + def grab_hosters(self, user, password, data): + html = self.load("https://api.over-load.me/hoster.php", + get={'auth': "0001-cb1f24dadb3aa487bda5afd3b76298935329be7700cd7-5329be77-00cf-1ca0135f"}).replace("\"", "").strip() + return [x.strip() for x in html.split(",") if x.strip()] + + + def grab_info(self, user, password, data): html = self.load("https://api.over-load.me/account.php", get={'user': user, 'auth': password}).strip() @@ -31,7 +36,7 @@ class OverLoadMe(Account): return {'premium': True, 'validuntil': data['expirationunix'], 'trafficleft': -1} - def login(self, user, password, data, req): + def signin(self, user, password, data): jsondata = self.load("https://api.over-load.me/account.php", get={'user': user, 'auth': password}).strip() diff --git a/module/plugins/accounts/PremiumTo.py b/module/plugins/accounts/PremiumTo.py index 946ee4f80..2b24f6edf 100644 --- a/module/plugins/accounts/PremiumTo.py +++ b/module/plugins/accounts/PremiumTo.py @@ -6,7 +6,7 @@ from module.plugins.internal.Account import Account class PremiumTo(Account): __name__ = "PremiumTo" __type__ = "account" - __version__ = "0.12" + __version__ = "0.13" __status__ = "testing" __description__ = """Premium.to account plugin""" @@ -16,10 +16,17 @@ class PremiumTo(Account): ("stickell", "l.stickell@yahoo.it")] - def grab_info(self, user, password, data, req): + def grab_hosters(self, user, password, data): + html = self.load("http://premium.to/api/hosters.php", + get={'username': user, + 'password': password}) + return [x.strip() for x in html.replace("\"", "").split(";")] + + + def grab_info(self, user, password, data): traffic = self.load("http://premium.to/api/straffic.php", #@TODO: Revert to `https` in 0.4.10 - get={'username': self.username, - 'password': self.password}) + get={'username': user, + 'password': password}) if "wrong username" not in traffic: trafficleft = sum(map(float, traffic.split(';'))) / 1024 #@TODO: Remove `/ 1024` in 0.4.10 @@ -28,12 +35,10 @@ class PremiumTo(Account): return {'premium': False, 'trafficleft': None, 'validuntil': None} - def login(self, user, password, data, req): - self.username = user - self.password = password + def signin(self, user, password, data): authcode = self.load("http://premium.to/api/getauthcode.php", #@TODO: Revert to `https` in 0.4.10 get={'username': user, - 'password': self.password}) + 'password': password}) if "wrong username" in authcode: self.fail_login() diff --git a/module/plugins/accounts/PremiumizeMe.py b/module/plugins/accounts/PremiumizeMe.py index fcc187efd..8fa2030c1 100644 --- a/module/plugins/accounts/PremiumizeMe.py +++ b/module/plugins/accounts/PremiumizeMe.py @@ -7,7 +7,7 @@ from module.plugins.internal.Account import Account class PremiumizeMe(Account): __name__ = "PremiumizeMe" __type__ = "account" - __version__ = "0.20" + __version__ = "0.21" __status__ = "testing" __description__ = """Premiumize.me account plugin""" @@ -15,7 +15,24 @@ class PremiumizeMe(Account): __authors__ = [("Florian Franzen", "FlorianFranzen@gmail.com")] - def grab_info(self, user, password, data, req): + def grab_hosters(self, user, password, data): + #: Get supported hosters list from premiumize.me using the + #: json API v1 (see https://secure.premiumize.me/?show=api) + answer = self.load("http://api.premiumize.me/pm-api/v1.php", #@TODO: Revert to `https` in 0.4.10 + get={'method' : "hosterlist", + 'params[login]': user, + 'params[pass]' : 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'] + + + def grab_info(self, user, password, data): #: Get user data from premiumize.me status = self.get_account_status(user, password) self.log_debug(status) @@ -30,7 +47,7 @@ class PremiumizeMe(Account): return account_info - def login(self, user, password, data, req): + def signin(self, user, password, data): #: Get user data from premiumize.me status = self.get_account_status(user, password) diff --git a/module/plugins/accounts/PutdriveCom.py b/module/plugins/accounts/PutdriveCom.py index 5356c4d1a..4da71f41b 100644 --- a/module/plugins/accounts/PutdriveCom.py +++ b/module/plugins/accounts/PutdriveCom.py @@ -6,7 +6,7 @@ from module.plugins.accounts.ZeveraCom import ZeveraCom class PutdriveCom(ZeveraCom): __name__ = "PutdriveCom" __type__ = "account" - __version__ = "0.03" + __version__ = "0.04" __status__ = "testing" __description__ = """Putdrive.com account plugin""" @@ -14,4 +14,4 @@ class PutdriveCom(ZeveraCom): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_DOMAIN = "putdrive.com" + PLUGIN_DOMAIN = "putdrive.com" diff --git a/module/plugins/accounts/QuickshareCz.py b/module/plugins/accounts/QuickshareCz.py index 97c320ec6..74377a052 100644 --- a/module/plugins/accounts/QuickshareCz.py +++ b/module/plugins/accounts/QuickshareCz.py @@ -8,7 +8,7 @@ from module.plugins.internal.Account import Account class QuickshareCz(Account): __name__ = "QuickshareCz" __type__ = "account" - __version__ = "0.06" + __version__ = "0.07" __status__ = "testing" __description__ = """Quickshare.cz account plugin""" @@ -19,7 +19,7 @@ class QuickshareCz(Account): TRAFFIC_LEFT_PATTERN = r'Stav kreditu: <strong>(.+?)</strong>' - def grab_info(self, user, password, data, req): + def grab_info(self, user, password, data): html = self.load("http://www.quickshare.cz/premium") m = re.search(self.TRAFFIC_LEFT_PATTERN, html) @@ -33,7 +33,7 @@ class QuickshareCz(Account): return {'validuntil': -1, 'trafficleft': trafficleft, 'premium': premium} - def login(self, user, password, data, req): + def signin(self, user, password, data): html = self.load('http://www.quickshare.cz/html/prihlaseni_process.php', post={'akce' : u'PÅihlásit', 'heslo': password, diff --git a/module/plugins/accounts/RPNetBiz.py b/module/plugins/accounts/RPNetBiz.py index f973ea4cd..2d2a7fba0 100644 --- a/module/plugins/accounts/RPNetBiz.py +++ b/module/plugins/accounts/RPNetBiz.py @@ -7,7 +7,7 @@ from module.common.json_layer import json_loads class RPNetBiz(Account): __name__ = "RPNetBiz" __type__ = "account" - __version__ = "0.16" + __version__ = "0.17" __status__ = "testing" __description__ = """RPNet.biz account plugin""" @@ -15,9 +15,24 @@ class RPNetBiz(Account): __authors__ = [("Dman", "dmanugm@gmail.com")] - def grab_info(self, user, password, data, req): + def grab_hosters(self, user, password, data): + res = self.load("https://premium.rpnet.biz/client_api.php", + get={'username': user, + 'password': 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'] + + + def grab_info(self, user, password, data): #: Get account information from rpnet.biz - res = self.get_account_status(user, password, req) + res = self.get_account_status(user, password) try: if res['accountInfo']['isPremium']: #: Parse account info. Change the trafficleft later to support per host info. @@ -33,16 +48,16 @@ class RPNetBiz(Account): return account_info - def login(self, user, password, data, req): + def signin(self, user, password, data): #: Get account information from rpnet.biz - res = self.get_account_status(user, password, req) + res = self.get_account_status(user, password) #: If we have an error in the res, we have wrong login information if 'error' in res: self.fail_login() - def get_account_status(self, user, password, req): + def get_account_status(self, user, password): #: Using the rpnet API, check if valid premium account res = self.load("https://premium.rpnet.biz/client_api.php", get={'username': user, 'password': password, diff --git a/module/plugins/accounts/RapideoPl.py b/module/plugins/accounts/RapideoPl.py index 4585bc718..6d1e124bc 100644 --- a/module/plugins/accounts/RapideoPl.py +++ b/module/plugins/accounts/RapideoPl.py @@ -6,12 +6,13 @@ import time from module.common.json_layer import json_loads from module.plugins.internal.Account import Account +# from module.plugins.internal.MultiAccount import MultiAccount class RapideoPl(Account): __name__ = "RapideoPl" __type__ = "account" - __version__ = "0.05" + __version__ = "0.06" __status__ = "testing" __description__ = "Rapideo.pl account plugin" @@ -27,13 +28,16 @@ class RapideoPl(Account): 'loc' : "1" , 'info' : "1" } - _req = None - _usr = None - _pwd = None + def grab_hosters(self, user, password, data): + hostings = json_loads(self.load("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.log_debug(hostings_domains) - def grab_info(self, user, password, data, req): - self._req = req + return hostings_domains + + + def grab_info(self, user, password, data): try: result = json_loads(self.run_auth_query()) @@ -55,10 +59,9 @@ class RapideoPl(Account): 'premium' : premium } - def login(self, user, password, data, req): - self._usr = user - self._pwd = hashlib.md5(password).hexdigest() - self._req = req + def signin(self, user, password, data): + data['usr'] = user + data['pwd'] = hashlib.md5(password).hexdigest() try: response = json_loads(self.run_auth_query()) @@ -69,14 +72,11 @@ class RapideoPl(Account): if "errno" in response.keys(): self.fail_login() - data['usr'] = self._usr - data['pwd'] = self._pwd - def create_auth_query(self): query = self.API_QUERY - query['username'] = self._usr - query['password'] = self._pwd + query['username'] = self.info['data']['usr'] + query['password'] = self.info['data']['pwd'] return query diff --git a/module/plugins/accounts/RapidfileshareNet.py b/module/plugins/accounts/RapidfileshareNet.py index 069b30900..a28c61b36 100644 --- a/module/plugins/accounts/RapidfileshareNet.py +++ b/module/plugins/accounts/RapidfileshareNet.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class RapidfileshareNet(XFSAccount): __name__ = "RapidfileshareNet" __type__ = "account" - __version__ = "0.06" + __version__ = "0.07" __status__ = "testing" __description__ = """Rapidfileshare.net account plugin""" @@ -14,6 +14,6 @@ class RapidfileshareNet(XFSAccount): __authors__ = [("guidobelix", "guidobelix@hotmail.it")] - HOSTER_DOMAIN = "rapidfileshare.net" + PLUGIN_DOMAIN = "rapidfileshare.net" TRAFFIC_LEFT_PATTERN = r'>Traffic available today:</TD><TD><label for="name">\s*(?P<S>[\d.,]+)\s*(?:(?P<U>[\w^_]+))?' diff --git a/module/plugins/accounts/RapidgatorNet.py b/module/plugins/accounts/RapidgatorNet.py index 65cf1b047..f1177530f 100644 --- a/module/plugins/accounts/RapidgatorNet.py +++ b/module/plugins/accounts/RapidgatorNet.py @@ -9,7 +9,7 @@ from module.common.json_layer import json_loads class RapidgatorNet(Account): __name__ = "RapidgatorNet" __type__ = "account" - __version__ = "0.14" + __version__ = "0.15" __status__ = "testing" __description__ = """Rapidgator.net account plugin""" @@ -20,14 +20,14 @@ class RapidgatorNet(Account): API_URL = "http://rapidgator.net/api/user/" - def grab_info(self, user, password, data, req): + def grab_info(self, user, password, data): validuntil = None trafficleft = None premium = False sid = None try: - sid = self.get_data(user).get('sid', None) + sid = data.get('sid', None) assert sid html = self.load(urlparse.urljoin(self.API_URL, "info"), @@ -39,7 +39,7 @@ class RapidgatorNet(Account): if json['response_status'] == 200: if "reset_in" in json['response']: - self.schedule_refresh(user, json['response']['reset_in']) + self._schedule_refresh(user, json['response']['reset_in']) validuntil = json['response']['expire_date'] trafficleft = float(json['response']['traffic_left']) / 1024 #@TODO: Remove `/ 1024` in 0.4.10 @@ -56,7 +56,7 @@ class RapidgatorNet(Account): 'sid' : sid} - def login(self, user, password, data, req): + def signin(self, user, password, data): try: html = self.load(urlparse.urljoin(self.API_URL, "login"), post={'username': user, diff --git a/module/plugins/accounts/RapiduNet.py b/module/plugins/accounts/RapiduNet.py index 30bac4fba..2566aacf6 100644 --- a/module/plugins/accounts/RapiduNet.py +++ b/module/plugins/accounts/RapiduNet.py @@ -10,7 +10,7 @@ from module.common.json_layer import json_loads class RapiduNet(Account): __name__ = "RapiduNet" __type__ = "account" - __version__ = "0.08" + __version__ = "0.09" __status__ = "testing" __description__ = """Rapidu.net account plugin""" @@ -26,7 +26,7 @@ class RapiduNet(Account): TRAFFIC_LEFT_PATTERN = r'class="tipsyS"><b>(.+?)<' - def grab_info(self, user, password, data, req): + def grab_info(self, user, password, data): validuntil = None trafficleft = -1 premium = False @@ -47,7 +47,7 @@ class RapiduNet(Account): return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} - def login(self, user, password, data, req): + def signin(self, user, password, data): self.load("https://rapidu.net/ajax.php", get={'a': "getChangeLang"}, post={'_go' : "", diff --git a/module/plugins/accounts/RarefileNet.py b/module/plugins/accounts/RarefileNet.py index 5f52ba147..0004c0f79 100644 --- a/module/plugins/accounts/RarefileNet.py +++ b/module/plugins/accounts/RarefileNet.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class RarefileNet(XFSAccount): __name__ = "RarefileNet" __type__ = "account" - __version__ = "0.05" + __version__ = "0.06" __status__ = "testing" __description__ = """RareFile.net account plugin""" @@ -14,4 +14,4 @@ class RarefileNet(XFSAccount): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - HOSTER_DOMAIN = "rarefile.net" + PLUGIN_DOMAIN = "rarefile.net" diff --git a/module/plugins/accounts/RealdebridCom.py b/module/plugins/accounts/RealdebridCom.py index f4c2c754d..3cdf04c18 100644 --- a/module/plugins/accounts/RealdebridCom.py +++ b/module/plugins/accounts/RealdebridCom.py @@ -8,7 +8,7 @@ from module.plugins.internal.Account import Account class RealdebridCom(Account): __name__ = "RealdebridCom" __type__ = "account" - __version__ = "0.49" + __version__ = "0.50" __status__ = "testing" __description__ = """Real-Debrid.com account plugin""" @@ -16,7 +16,12 @@ class RealdebridCom(Account): __authors__ = [("Devirex Hazzard", "naibaf_11@yahoo.de")] - def grab_info(self, user, password, data, req): + def grab_hosters(self, user, password, data): + html = self.load("https://real-debrid.com/api/hosters.php").replace("\"", "").strip() + return [x.strip() for x in html.split(",") if x.strip()] + + + def grab_info(self, user, password, data): if self.pin_code: return @@ -30,7 +35,7 @@ class RealdebridCom(Account): 'premium' : True } - def login(self, user, password, data, req): + def signin(self, user, password, data): self.pin_code = False html = self.load("https://real-debrid.com/ajax/login.php", diff --git a/module/plugins/accounts/RehostTo.py b/module/plugins/accounts/RehostTo.py index 50b64bff8..9406f22af 100644 --- a/module/plugins/accounts/RehostTo.py +++ b/module/plugins/accounts/RehostTo.py @@ -6,7 +6,7 @@ from module.plugins.internal.Account import Account class RehostTo(Account): __name__ = "RehostTo" __type__ = "account" - __version__ = "0.19" + __version__ = "0.20" __status__ = "testing" __description__ = """Rehost.to account plugin""" @@ -14,7 +14,14 @@ class RehostTo(Account): __authors__ = [("RaNaN", "RaNaN@pyload.org")] - def grab_info(self, user, password, data, req): + def grab_hosters(self, user, password, data): + html = self.load("http://rehost.to/api.php", + get={'cmd' : "get_supported_och_dl", + 'long_ses': data['session']}) + return [x.strip() for x in html.replace("\"", "").split(",")] + + + def grab_info(self, user, password, data): premium = False trafficleft = None validuntil = -1 @@ -47,7 +54,7 @@ class RehostTo(Account): 'session' : session} - def login(self, user, password, data, req): + def signin(self, user, password, data): html = self.load("https://rehost.to/api.php", get={'cmd': "login", 'user': user, diff --git a/module/plugins/accounts/RyushareCom.py b/module/plugins/accounts/RyushareCom.py index 3ab907a76..84b786bac 100644 --- a/module/plugins/accounts/RyushareCom.py +++ b/module/plugins/accounts/RyushareCom.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class RyushareCom(XFSAccount): __name__ = "RyushareCom" __type__ = "account" - __version__ = "0.07" + __version__ = "0.08" __status__ = "testing" __description__ = """Ryushare.com account plugin""" @@ -14,4 +14,4 @@ class RyushareCom(XFSAccount): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_DOMAIN = "ryushare.com" + PLUGIN_DOMAIN = "ryushare.com" diff --git a/module/plugins/accounts/SafesharingEu.py b/module/plugins/accounts/SafesharingEu.py index eb84d502f..632b2bff8 100644 --- a/module/plugins/accounts/SafesharingEu.py +++ b/module/plugins/accounts/SafesharingEu.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class SafesharingEu(XFSAccount): __name__ = "SafesharingEu" __type__ = "account" - __version__ = "0.03" + __version__ = "0.04" __status__ = "testing" __description__ = """Safesharing.eu account plugin""" @@ -14,4 +14,4 @@ class SafesharingEu(XFSAccount): __authors__ = [("guidobelix", "guidobelix@hotmail.it")] - HOSTER_DOMAIN = "safesharing.eu" + PLUGIN_DOMAIN = "safesharing.eu" diff --git a/module/plugins/accounts/SecureUploadEu.py b/module/plugins/accounts/SecureUploadEu.py index a81030b67..e3f2dbc4f 100644 --- a/module/plugins/accounts/SecureUploadEu.py +++ b/module/plugins/accounts/SecureUploadEu.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class SecureUploadEu(XFSAccount): __name__ = "SecureUploadEu" __type__ = "account" - __version__ = "0.03" + __version__ = "0.04" __status__ = "testing" __description__ = """SecureUpload.eu account plugin""" @@ -14,4 +14,4 @@ class SecureUploadEu(XFSAccount): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_DOMAIN = "secureupload.eu" + PLUGIN_DOMAIN = "secureupload.eu" diff --git a/module/plugins/accounts/SendmywayCom.py b/module/plugins/accounts/SendmywayCom.py index 2875e0d46..a1675b654 100644 --- a/module/plugins/accounts/SendmywayCom.py +++ b/module/plugins/accounts/SendmywayCom.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class SendmywayCom(XFSAccount): __name__ = "SendmywayCom" __type__ = "account" - __version__ = "0.03" + __version__ = "0.04" __status__ = "testing" __description__ = """Sendmyway.com account plugin""" @@ -14,4 +14,4 @@ class SendmywayCom(XFSAccount): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_DOMAIN = "sendmyway.com" + PLUGIN_DOMAIN = "sendmyway.com" diff --git a/module/plugins/accounts/SharebeastCom.py b/module/plugins/accounts/SharebeastCom.py index a104a4a46..b8ddbe34d 100644 --- a/module/plugins/accounts/SharebeastCom.py +++ b/module/plugins/accounts/SharebeastCom.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class SharebeastCom(XFSAccount): __name__ = "SharebeastCom" __type__ = "account" - __version__ = "0.02" + __version__ = "0.03" __status__ = "testing" __description__ = """Sharebeast.com account plugin""" @@ -14,4 +14,4 @@ class SharebeastCom(XFSAccount): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_DOMAIN = "sharebeast.com" + PLUGIN_DOMAIN = "sharebeast.com" diff --git a/module/plugins/accounts/ShareonlineBiz.py b/module/plugins/accounts/ShareonlineBiz.py index c0dc7e688..d7eb14bd6 100644 --- a/module/plugins/accounts/ShareonlineBiz.py +++ b/module/plugins/accounts/ShareonlineBiz.py @@ -9,7 +9,7 @@ from module.plugins.internal.Plugin import set_cookie class ShareonlineBiz(Account): __name__ = "ShareonlineBiz" __type__ = "account" - __version__ = "0.40" + __version__ = "0.41" __status__ = "testing" __description__ = """Share-online.biz account plugin""" @@ -17,7 +17,7 @@ class ShareonlineBiz(Account): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - def api_response(self, user, password, req): + def api_response(self, user, password): res = self.load("https://api.share-online.biz/cgi-bin", get={'q' : "userdetails", 'aux' : "traffic", @@ -38,13 +38,13 @@ class ShareonlineBiz(Account): return api - def grab_info(self, user, password, data, req): + def grab_info(self, user, password, data): premium = False validuntil = None trafficleft = -1 maxtraffic = 100 * 1024 * 1024 * 1024 #: 100 GB - api = self.api_response(user, password, req) + api = self.api_response(user, password) premium = api['group'] in ("PrePaid", "Premium", "Penalty-Premium") validuntil = float(api['expire_date']) @@ -64,6 +64,6 @@ class ShareonlineBiz(Account): 'maxtraffic' : maxtraffic} - def login(self, user, password, data, req): - api = self.api_response(user, password, req) - set_cookie(req.cj, "share-online.biz", 'a', api['a']) + def signin(self, user, password, data): + api = self.api_response(user, password) + set_cookie(self.req.cj, "share-online.biz", 'a', api['a']) diff --git a/module/plugins/accounts/SimplyPremiumCom.py b/module/plugins/accounts/SimplyPremiumCom.py index 133a96ec3..9de6ed55b 100644 --- a/module/plugins/accounts/SimplyPremiumCom.py +++ b/module/plugins/accounts/SimplyPremiumCom.py @@ -8,7 +8,7 @@ from module.plugins.internal.Plugin import set_cookie class SimplyPremiumCom(Account): __name__ = "SimplyPremiumCom" __type__ = "account" - __version__ = "0.09" + __version__ = "0.10" __status__ = "testing" __description__ = """Simply-Premium.com account plugin""" @@ -16,7 +16,16 @@ class SimplyPremiumCom(Account): __authors__ = [("EvolutionClip", "evolutionclip@live.de")] - def grab_info(self, user, password, data, req): + def grab_hosters(self, user, password, data): + json_data = self.load("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 + + + def grab_info(self, user, password, data): premium = False validuntil = -1 trafficleft = None @@ -39,8 +48,8 @@ class SimplyPremiumCom(Account): return {'premium': premium, 'validuntil': validuntil, 'trafficleft': trafficleft} - def login(self, user, password, data, req): - set_cookie(req.cj, "simply-premium.com", "lang", "EN") + def signin(self, user, password, data): + set_cookie(self.req.cj, "simply-premium.com", "lang", "EN") html = self.load("https://www.simply-premium.com/login.php", post={'key': user} if not password else {'login_name': user, 'login_pass': password}) diff --git a/module/plugins/accounts/SimplydebridCom.py b/module/plugins/accounts/SimplydebridCom.py index b8d679604..862cfe22b 100644 --- a/module/plugins/accounts/SimplydebridCom.py +++ b/module/plugins/accounts/SimplydebridCom.py @@ -8,7 +8,7 @@ from module.plugins.internal.Account import Account class SimplydebridCom(Account): __name__ = "SimplydebridCom" __type__ = "account" - __version__ = "0.14" + __version__ = "0.15" __status__ = "testing" __description__ = """Simply-Debrid.com account plugin""" @@ -16,7 +16,12 @@ class SimplydebridCom(Account): __authors__ = [("Kagenoshin", "kagenoshin@gmx.ch")] - def grab_info(self, user, password, data, req): + def grab_hosters(self, user, password, data): + html = self.load("http://simply-debrid.com/api.php", get={'list': 1}) + return [x.strip() for x in html.rstrip(';').replace("\"", "").split(";")] + + + def grab_info(self, user, password, data): res = self.load("http://simply-debrid.com/api.php", get={'login': 2, 'u' : user, @@ -28,7 +33,7 @@ class SimplydebridCom(Account): return {'trafficleft': -1, 'validuntil': time.mktime(time.strptime(str(data[2]), "%d/%m/%Y"))} - def login(self, user, password, data, req): + def signin(self, user, password, data): res = self.load("https://simply-debrid.com/api.php", get={'login': 1, 'u' : user, diff --git a/module/plugins/accounts/SmoozedCom.py b/module/plugins/accounts/SmoozedCom.py index 2da4563ab..84858574f 100644 --- a/module/plugins/accounts/SmoozedCom.py +++ b/module/plugins/accounts/SmoozedCom.py @@ -26,7 +26,7 @@ from module.plugins.internal.Account import Account class SmoozedCom(Account): __name__ = "SmoozedCom" __type__ = "account" - __version__ = "0.08" + __version__ = "0.09" __status__ = "testing" __description__ = """Smoozed.com account plugin""" @@ -34,8 +34,12 @@ class SmoozedCom(Account): __authors__ = [("", "")] - def grab_info(self, user, password, data, req): - status = self.get_account_status(user, password, req) + def grab_hosters(self, user, password, data): + return self.get_data('hosters') + + + def grab_info(self, user, password, data): + status = self.get_account_status(user, password) self.log_debug(status) @@ -61,16 +65,16 @@ class SmoozedCom(Account): return info - def login(self, user, password, data, req): + def signin(self, user, password, data): #: Get user data from premiumize.me - status = self.get_account_status(user, password, req) + status = self.get_account_status(user, password) #: Check if user and password are valid if status['state'] != 'ok': self.fail_login() - def get_account_status(self, user, password, req): + def get_account_status(self, user, password): password = password salt = hashlib.sha256(password).hexdigest() encrypted = PBKDF2(password, salt, iterations=1000).hexread(32) diff --git a/module/plugins/accounts/StreamcloudEu.py b/module/plugins/accounts/StreamcloudEu.py index 9549896cc..54dd8e2fe 100644 --- a/module/plugins/accounts/StreamcloudEu.py +++ b/module/plugins/accounts/StreamcloudEu.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class StreamcloudEu(XFSAccount): __name__ = "StreamcloudEu" __type__ = "account" - __version__ = "0.03" + __version__ = "0.04" __status__ = "testing" __description__ = """Streamcloud.eu account plugin""" @@ -14,4 +14,4 @@ class StreamcloudEu(XFSAccount): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_DOMAIN = "streamcloud.eu" + PLUGIN_DOMAIN = "streamcloud.eu" diff --git a/module/plugins/accounts/TurbobitNet.py b/module/plugins/accounts/TurbobitNet.py index cfec97545..b73f95fa5 100644 --- a/module/plugins/accounts/TurbobitNet.py +++ b/module/plugins/accounts/TurbobitNet.py @@ -10,7 +10,7 @@ from module.plugins.internal.Plugin import set_cookie class TurbobitNet(Account): __name__ = "TurbobitNet" __type__ = "account" - __version__ = "0.06" + __version__ = "0.07" __status__ = "testing" __description__ = """TurbobitNet account plugin""" @@ -18,7 +18,7 @@ class TurbobitNet(Account): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - def grab_info(self, user, password, data, req): + def grab_info(self, user, password, data): html = self.load("http://turbobit.net") m = re.search(r'<u>Turbo Access</u> to ([\d.]+)', html) @@ -32,8 +32,8 @@ class TurbobitNet(Account): return {'premium': premium, 'trafficleft': -1, 'validuntil': validuntil} - def login(self, user, password, data, req): - set_cookie(req.cj, "turbobit.net", "user_lang", "en") + def signin(self, user, password, data): + set_cookie(self.req.cj, "turbobit.net", "user_lang", "en") html = self.load("http://turbobit.net/user/login", post={"user[login]" : user, diff --git a/module/plugins/accounts/TusfilesNet.py b/module/plugins/accounts/TusfilesNet.py index c549bbaf7..d826e5a3d 100644 --- a/module/plugins/accounts/TusfilesNet.py +++ b/module/plugins/accounts/TusfilesNet.py @@ -9,7 +9,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class TusfilesNet(XFSAccount): __name__ = "TusfilesNet" __type__ = "account" - __version__ = "0.07" + __version__ = "0.08" __status__ = "testing" __description__ = """Tusfile.net account plugin""" @@ -17,7 +17,7 @@ class TusfilesNet(XFSAccount): __authors__ = [("guidobelix", "guidobelix@hotmail.it")] - HOSTER_DOMAIN = "tusfiles.net" + PLUGIN_DOMAIN = "tusfiles.net" VALID_UNTIL_PATTERN = r'<span class="label label-default">([^<]+)</span>' TRAFFIC_LEFT_PATTERN = r'<td><img src="//www\.tusfiles\.net/i/icon/meter\.png" alt=""/></td>\n<td> (?P<S>[\d.,]+)' diff --git a/module/plugins/accounts/UlozTo.py b/module/plugins/accounts/UlozTo.py index 79b1bd050..8380099e1 100644 --- a/module/plugins/accounts/UlozTo.py +++ b/module/plugins/accounts/UlozTo.py @@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account class UlozTo(Account): __name__ = "UlozTo" __type__ = "account" - __version__ = "0.13" + __version__ = "0.14" __status__ = "testing" __description__ = """Uloz.to account plugin""" @@ -21,7 +21,7 @@ class UlozTo(Account): TRAFFIC_LEFT_PATTERN = r'<li class="menu-kredit"><a .*?title=".+?GB = ([\d.]+) MB"' - def grab_info(self, user, password, data, req): + def grab_info(self, user, password, data): html = self.load("http://www.ulozto.net/") m = re.search(self.TRAFFIC_LEFT_PATTERN, html) @@ -32,7 +32,7 @@ class UlozTo(Account): return {'validuntil': -1, 'trafficleft': trafficleft, 'premium': premium} - def login(self, user, password, data, req): + def signin(self, user, password, data): login_page = self.load('http://www.ulozto.net/?do=web-login') action = re.findall('<form action="(.+?)"', login_page)[1].replace('&', '&') token = re.search('_token_" value="(.+?)"', login_page).group(1) diff --git a/module/plugins/accounts/UploadableCh.py b/module/plugins/accounts/UploadableCh.py index 6f9229a49..eefa1f3a0 100644 --- a/module/plugins/accounts/UploadableCh.py +++ b/module/plugins/accounts/UploadableCh.py @@ -6,7 +6,7 @@ from module.plugins.internal.Account import Account class UploadableCh(Account): __name__ = "UploadableCh" __type__ = "account" - __version__ = "0.06" + __version__ = "0.07" __status__ = "testing" __description__ = """Uploadable.ch account plugin""" @@ -14,7 +14,7 @@ class UploadableCh(Account): __authors__ = [("Sasch", "gsasch@gmail.com")] - def grab_info(self, user, password, data, req): + def grab_info(self, user, password, data): html = self.load("http://www.uploadable.ch/login.php") premium = '<a href="/logout.php"' in html @@ -23,7 +23,7 @@ class UploadableCh(Account): return {'validuntil': None, 'trafficleft': trafficleft, 'premium': premium} #@TODO: validuntil - def login(self, user, password, data, req): + def signin(self, user, password, data): html = self.load("http://www.uploadable.ch/login.php", post={'userName' : user, 'userPassword' : password, diff --git a/module/plugins/accounts/UploadcCom.py b/module/plugins/accounts/UploadcCom.py index 5b834ac3b..dbad01858 100644 --- a/module/plugins/accounts/UploadcCom.py +++ b/module/plugins/accounts/UploadcCom.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class UploadcCom(XFSAccount): __name__ = "UploadcCom" __type__ = "account" - __version__ = "0.03" + __version__ = "0.04" __status__ = "testing" __description__ = """Uploadc.com account plugin""" @@ -14,4 +14,4 @@ class UploadcCom(XFSAccount): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_DOMAIN = "uploadc.com" + PLUGIN_DOMAIN = "uploadc.com" diff --git a/module/plugins/accounts/UploadedTo.py b/module/plugins/accounts/UploadedTo.py index 5a96b04bc..c5cd9dd9f 100644 --- a/module/plugins/accounts/UploadedTo.py +++ b/module/plugins/accounts/UploadedTo.py @@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account class UploadedTo(Account): __name__ = "UploadedTo" __type__ = "account" - __version__ = "0.36" + __version__ = "0.37" __status__ = "testing" __description__ = """Uploaded.to account plugin""" @@ -24,7 +24,7 @@ class UploadedTo(Account): TRAFFIC_LEFT_PATTERN = r'<b class="cB">(?P<S>[\d.,]+) (?P<U>[\w^_]+)' - def grab_info(self, user, password, data, req): + def grab_info(self, user, password, data): validuntil = None trafficleft = None premium = None @@ -63,7 +63,7 @@ class UploadedTo(Account): 'premium' : premium} - def login(self, user, password, data, req): + def signin(self, user, password, data): self.load("http://uploaded.net/language/en") html = self.load("http://uploaded.net/io/login", diff --git a/module/plugins/accounts/UploadheroCom.py b/module/plugins/accounts/UploadheroCom.py index 2b676e90a..c5e684033 100644 --- a/module/plugins/accounts/UploadheroCom.py +++ b/module/plugins/accounts/UploadheroCom.py @@ -10,7 +10,7 @@ from module.plugins.internal.Account import Account class UploadheroCom(Account): __name__ = "UploadheroCom" __type__ = "account" - __version__ = "0.24" + __version__ = "0.25" __status__ = "testing" __description__ = """Uploadhero.co account plugin""" @@ -18,10 +18,9 @@ class UploadheroCom(Account): __authors__ = [("mcmyst", "mcmyst@hotmail.fr")] - def grab_info(self, user, password, data, req): + def grab_info(self, user, password, data): premium_pattern = re.compile('Il vous reste <span class="bleu">(\d+)</span> jours premium') - data = self.get_data(user) html = self.load("http://uploadhero.co/my-account") if premium_pattern.search(html): @@ -34,7 +33,7 @@ class UploadheroCom(Account): return account_info - def login(self, user, password, data, req): + def signin(self, user, password, data): html = self.load("http://uploadhero.co/lib/connexion.php", post={'pseudo_login': user, 'password_login': password}) diff --git a/module/plugins/accounts/UploadingCom.py b/module/plugins/accounts/UploadingCom.py index 9aaf395f9..cacc8df14 100644 --- a/module/plugins/accounts/UploadingCom.py +++ b/module/plugins/accounts/UploadingCom.py @@ -10,7 +10,7 @@ from module.plugins.internal.Plugin import set_cookies class UploadingCom(Account): __name__ = "UploadingCom" __type__ = "account" - __version__ = "0.15" + __version__ = "0.16" __status__ = "testing" __description__ = """Uploading.com account plugin""" @@ -22,7 +22,7 @@ class UploadingCom(Account): VALID_UNTIL_PATTERN = r'Valid Until:(.+?)<' - def grab_info(self, user, password, data, req): + def grab_info(self, user, password, data): validuntil = None trafficleft = None premium = None @@ -54,8 +54,8 @@ class UploadingCom(Account): 'premium' : premium} - def login(self, user, password, data, req): - set_cookies(req.cj, + def signin(self, user, password, data): + set_cookies(self.req.cj, [("uploading.com", "lang" , "1" ), ("uploading.com", "language", "1" ), ("uploading.com", "setlang" , "en"), diff --git a/module/plugins/accounts/UptoboxCom.py b/module/plugins/accounts/UptoboxCom.py index 54d733375..8df558e2a 100644 --- a/module/plugins/accounts/UptoboxCom.py +++ b/module/plugins/accounts/UptoboxCom.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class UptoboxCom(XFSAccount): __name__ = "UptoboxCom" __type__ = "account" - __version__ = "0.12" + __version__ = "0.13" __status__ = "testing" __description__ = """Uptobox.com account plugin""" @@ -14,6 +14,6 @@ class UptoboxCom(XFSAccount): __authors__ = [("benbox69", "dev@tollet.me")] - HOSTER_DOMAIN = "uptobox.com" - HOSTER_URL = "https://uptobox.com/" + PLUGIN_DOMAIN = "uptobox.com" + PLUGIN_URL = "https://uptobox.com/" LOGIN_URL = "https://login.uptobox.com/logarithme/" diff --git a/module/plugins/accounts/VidPlayNet.py b/module/plugins/accounts/VidPlayNet.py index d543c5671..e54515faf 100644 --- a/module/plugins/accounts/VidPlayNet.py +++ b/module/plugins/accounts/VidPlayNet.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class VidPlayNet(XFSAccount): __name__ = "VidPlayNet" __type__ = "account" - __version__ = "0.03" + __version__ = "0.04" __status__ = "testing" __description__ = """VidPlay.net account plugin""" @@ -14,4 +14,4 @@ class VidPlayNet(XFSAccount): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_DOMAIN = "vidplay.net" + PLUGIN_DOMAIN = "vidplay.net" diff --git a/module/plugins/accounts/WebshareCz.py b/module/plugins/accounts/WebshareCz.py index 33f851263..484ea06ce 100644 --- a/module/plugins/accounts/WebshareCz.py +++ b/module/plugins/accounts/WebshareCz.py @@ -12,7 +12,7 @@ from module.plugins.internal.Account import Account class WebshareCz(Account): __name__ = "WebshareCz" __type__ = "account" - __version__ = "0.11" + __version__ = "0.12" __status__ = "testing" __description__ = """Webshare.cz account plugin""" @@ -25,9 +25,9 @@ class WebshareCz(Account): TRAFFIC_LEFT_PATTERN = r'<bytes>(.+)</bytes>' - def grab_info(self, user, password, data, req): + def grab_info(self, user, password, data): html = self.load("https://webshare.cz/api/user_data/", - post={'wst': self.get_data(user).get('wst', None)}) + post={'wst': data.get('wst', None)}) self.log_debug("Response: " + html) @@ -41,7 +41,7 @@ class WebshareCz(Account): return {'validuntil': validuntil, 'trafficleft': -1, 'premium': premium} - def login(self, user, password, data, req): + def signin(self, user, password, data): salt = self.load("https://webshare.cz/api/salt/", post={'username_or_email': user, 'wst' : ""}) diff --git a/module/plugins/accounts/WorldbytezCom.py b/module/plugins/accounts/WorldbytezCom.py index ea409fd58..6987bc0cc 100644 --- a/module/plugins/accounts/WorldbytezCom.py +++ b/module/plugins/accounts/WorldbytezCom.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class WorldbytezCom(XFSAccount): __name__ = "WorldbytezCom" __type__ = "account" - __version__ = "0.02" + __version__ = "0.03" __status__ = "testing" __description__ = """Worldbytez.com account plugin""" @@ -14,4 +14,4 @@ class WorldbytezCom(XFSAccount): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_DOMAIN = "worldbytez.com" + PLUGIN_DOMAIN = "worldbytez.com" diff --git a/module/plugins/accounts/XFileSharingPro.py b/module/plugins/accounts/XFileSharingPro.py index f21247cf4..68797b7f0 100644 --- a/module/plugins/accounts/XFileSharingPro.py +++ b/module/plugins/accounts/XFileSharingPro.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class XFileSharingPro(XFSAccount): __name__ = "XFileSharingPro" __type__ = "account" - __version__ = "0.09" + __version__ = "0.10" __status__ = "testing" __description__ = """XFileSharingPro multi-purpose account plugin""" @@ -14,13 +14,13 @@ class XFileSharingPro(XFSAccount): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_DOMAIN = None + PLUGIN_DOMAIN = None - def login(self, user, password, data, req): + def signin(self, user, password, data): try: - return super(XFileSharingPro, self).login(user, data, req) + return super(XFileSharingPro, self).signin(user, password, data) except Fail: - self.HOSTER_URL = self.HOSTER_URL.replace("www.", "") - return super(XFileSharingPro, self).login(user, data, req) + self.PLUGIN_URL = self.PLUGIN_URL.replace("www.", "") + return super(XFileSharingPro, self).signin(user, password, data) diff --git a/module/plugins/accounts/YibaishiwuCom.py b/module/plugins/accounts/YibaishiwuCom.py index fdacfde4d..ba7454183 100644 --- a/module/plugins/accounts/YibaishiwuCom.py +++ b/module/plugins/accounts/YibaishiwuCom.py @@ -8,7 +8,7 @@ from module.plugins.internal.Account import Account class YibaishiwuCom(Account): __name__ = "YibaishiwuCom" __type__ = "account" - __version__ = "0.05" + __version__ = "0.06" __status__ = "testing" __description__ = """115.com account plugin""" @@ -19,7 +19,7 @@ class YibaishiwuCom(Account): ACCOUNT_INFO_PATTERN = r'var USER_PERMISSION = {(.*?)}' - def grab_info(self, user, password, data, req): + def grab_info(self, user, password, data): # self.relogin(user) html = self.load("http://115.com/") @@ -29,7 +29,7 @@ class YibaishiwuCom(Account): return dict({'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium}) - def login(self, user, password, data, req): + def signin(self, user, password, data): html = self.load("https://passport.115.com/?ac=login", post={'back' : "http://www.115.com/", 'goto' : "http://115.com/", diff --git a/module/plugins/accounts/ZeveraCom.py b/module/plugins/accounts/ZeveraCom.py index ac057b76a..f85389cf8 100644 --- a/module/plugins/accounts/ZeveraCom.py +++ b/module/plugins/accounts/ZeveraCom.py @@ -8,7 +8,7 @@ from module.plugins.internal.Account import Account class ZeveraCom(Account): __name__ = "ZeveraCom" __type__ = "account" - __version__ = "0.29" + __version__ = "0.30" __status__ = "testing" __description__ = """Zevera.com account plugin""" @@ -17,7 +17,13 @@ class ZeveraCom(Account): ("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_DOMAIN = "zevera.com" + PLUGIN_DOMAIN = "zevera.com" + + + def grab_hosters(self, user, password, data): + html = self.api_response(user, password, cmd="gethosters") + return [x.strip() for x in html.split(",")] + def __init__(self, manager, accounts): #@TODO: remove in 0.4.10 @@ -26,19 +32,19 @@ class ZeveraCom(Account): def init(self): - if not self.HOSTER_DOMAIN: - self.log_error(_("Missing HOSTER_DOMAIN")) + if not self.PLUGIN_DOMAIN: + self.log_error(_("Missing PLUGIN_DOMAIN")) if not hasattr(self, "API_URL"): - self.API_URL = "http://api.%s/jDownloader.ashx" % (self.HOSTER_DOMAIN or "") + self.API_URL = "http://api.%s/jDownloader.ashx" % (self.PLUGIN_DOMAIN or "") - def grab_info(self, user, password, data, req): + def grab_info(self, user, password, data): validuntil = None trafficleft = None premium = False - api = self.api_response(req) + api = self.api_response(user, password) if "No trafic" not in api and api['endsubscriptiondate'] != "Expired!": validuntil = time.mktime(time.strptime(api['endsubscriptiondate'], "%Y/%m/%d %H:%M:%S")) @@ -48,18 +54,15 @@ class ZeveraCom(Account): return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} - def login(self, user, password, data, req): - self.user = user - self.password = password - - if self.api_response(req) == "No trafic": + def signin(self, user, password, data): + if self.api_response(user, password) == "No trafic": self.fail_login() - def api_response(self, req, just_header=False, **kwargs): + def api_response(self, user, password=None, just_header=False, **kwargs): get_data = {'cmd' : "accountinfo", - 'login': self.user, - 'pass' : self.password} + 'login': user, + 'pass' : password} get_data.update(kwargs) diff --git a/module/plugins/container/DLC.py b/module/plugins/container/DLC.py index 145322942..c92ba64c4 100644 --- a/module/plugins/container/DLC.py +++ b/module/plugins/container/DLC.py @@ -17,7 +17,7 @@ class DLC(Container): __version__ = "0.26" __status__ = "testing" - __pattern__ = r'.+\.dlc$' + __pattern__ = r'(.+\.dlc|[\w+^_]+==[\w+^_/]+==)$' __description__ = """DLC container decrypter plugin""" __license__ = "GPLv3" diff --git a/module/plugins/crypter/Dereferer.py b/module/plugins/crypter/Dereferer.py index 9051abcc2..d7dfe52d7 100644 --- a/module/plugins/crypter/Dereferer.py +++ b/module/plugins/crypter/Dereferer.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter class Dereferer(SimpleCrypter): __name__ = "Dereferer" __type__ = "crypter" - __version__ = "0.18" + __version__ = "0.19" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(?:\w+\.)*?(?P<DOMAIN>(?:[\d.]+|[\w\-]{3,}(?:\.[a-zA-Z]{2,}){1,2})(?:\:\d+)?)/.*?(?P<LINK>(?:ht|f)tps?://.+)' @@ -20,12 +20,12 @@ class Dereferer(SimpleCrypter): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_DOMAIN = None - HOSTER_NAME = None + PLUGIN_DOMAIN = None + PLUGIN_NAME = None def _log(self, level, plugintype, pluginname, messages): - return super(Dereferer, self)._log(level, plugintype, pluginname, (self.HOSTER_NAME,) + messages) + return super(Dereferer, self)._log(level, plugintype, pluginname, (self.PLUGIN_NAME,) + messages) def init(self): @@ -33,8 +33,8 @@ class Dereferer(SimpleCrypter): self.__pattern__ = self.pyload.pluginManager.crypterPlugins[self.__name__]['pattern'] #@TODO: Recheck in 0.4.10 - self.HOSTER_DOMAIN = re.match(self.__pattern__, self.pyfile.url).group("DOMAIN").lower() - self.HOSTER_NAME = "".join(part.capitalize() for part in re.split(r'(\.|\d+)', self.HOSTER_DOMAIN) if part != '.') + self.PLUGIN_DOMAIN = re.match(self.__pattern__, self.pyfile.url).group("DOMAIN").lower() + self.PLUGIN_NAME = "".join(part.capitalize() for part in re.split(r'(\.|\d+)', self.PLUGIN_DOMAIN) if part != '.') def get_links(self): diff --git a/module/plugins/crypter/LinkdecrypterCom.py b/module/plugins/crypter/LinkdecrypterCom.py index d8812dbd5..0f0c3e7a9 100644 --- a/module/plugins/crypter/LinkdecrypterCom.py +++ b/module/plugins/crypter/LinkdecrypterCom.py @@ -8,7 +8,7 @@ from module.plugins.internal.MultiCrypter import MultiCrypter class LinkdecrypterCom(MultiCrypter): __name__ = "LinkdecrypterCom" __type__ = "crypter" - __version__ = "0.32" + __version__ = "0.33" __status__ = "testing" __pattern__ = r'^unmatchable$' @@ -28,7 +28,6 @@ class LinkdecrypterCom(MultiCrypter): def setup(self): - self.password = self.get_password() self.req.setOption("timeout", 300) @@ -61,7 +60,8 @@ class LinkdecrypterCom(MultiCrypter): elif self.PASSWORD_PATTERN in self.html: if self.password: self.log_info(_("Password protected link")) - self.html = self.load('http://linkdecrypter.com/', post={'password': self.password}) + self.html = self.load('http://linkdecrypter.com/', + post={'password': self.get_password()}) else: self.fail(_("Missing password")) diff --git a/module/plugins/crypter/ShSt.py b/module/plugins/crypter/ShSt.py index 754bc542c..43cc4e779 100644 --- a/module/plugins/crypter/ShSt.py +++ b/module/plugins/crypter/ShSt.py @@ -9,7 +9,7 @@ import re class ShSt(Crypter): __name__ = "ShSt" __type__ = "crypter" - __version__ = "0.04" + __version__ = "0.05" __status__ = "testing" __pattern__ = r'http://sh\.st/\w+' @@ -19,7 +19,7 @@ class ShSt(Crypter): __authors__ = [("Frederik Möllers", "fred-public@posteo.de")] - NAME_PATTERN = r'<title>(?P<N>.+?) - .+</title>' + NAME_PATTERN = r'<title>(?P<N>.+?) -' def decrypt(self, pyfile): diff --git a/module/plugins/crypter/ShareLinksBiz.py b/module/plugins/crypter/ShareLinksBiz.py index 2e9abff61..3316aea56 100644 --- a/module/plugins/crypter/ShareLinksBiz.py +++ b/module/plugins/crypter/ShareLinksBiz.py @@ -10,7 +10,7 @@ from module.plugins.internal.Crypter import Crypter class ShareLinksBiz(Crypter): __name__ = "ShareLinksBiz" __type__ = "crypter" - __version__ = "1.17" + __version__ = "1.18" __status__ = "testing" __pattern__ = r'http://(?:www\.)?(share-links|s2l)\.biz/(?P<ID>_?\w+)' @@ -131,7 +131,7 @@ class ShareLinksBiz(Crypter): href = self._resolve_coords(coords, captchaMap) if href is None: self.captcha.invalid() - self.retry(wait_time=5) + self.retry(delay=5) url = self.base_url + href self.html = self.load(url) @@ -161,7 +161,7 @@ class ShareLinksBiz(Crypter): if self.captcha: if "Your choice was wrong" in self.html: self.captcha.invalid() - self.retry(wait_time=5) + self.retry(delay=5) else: self.captcha.correct() diff --git a/module/plugins/crypter/XFileSharingProFolder.py b/module/plugins/crypter/XFileSharingProFolder.py index 584cc7668..f693698bc 100644 --- a/module/plugins/crypter/XFileSharingProFolder.py +++ b/module/plugins/crypter/XFileSharingProFolder.py @@ -8,7 +8,7 @@ from module.plugins.internal.XFSCrypter import XFSCrypter, create_getInfo class XFileSharingProFolder(XFSCrypter): __name__ = "XFileSharingProFolder" __type__ = "crypter" - __version__ = "0.13" + __version__ = "0.14" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(?:\w+\.)*?(?P<DOMAIN>(?:[\d.]+|[\w\-^_]{3,}(?:\.[a-zA-Z]{2,}){1,2})(?:\:\d+)?)/(?:user|folder)s?/\w+' @@ -23,7 +23,7 @@ class XFileSharingProFolder(XFSCrypter): def _log(self, level, plugintype, pluginname, messages): return super(XFileSharingProFolder, self)._log(level, plugintype, - "%s: %s" % (pluginname, self.HOSTER_NAME), + "%s: %s" % (pluginname, self.PLUGIN_NAME), messages) @@ -32,18 +32,18 @@ class XFileSharingProFolder(XFSCrypter): self.__pattern__ = self.pyload.pluginManager.crypterPlugins[self.__name__]['pattern'] - self.HOSTER_DOMAIN = re.match(self.__pattern__, self.pyfile.url).group("DOMAIN").lower() - self.HOSTER_NAME = "".join(part.capitalize() for part in re.split(r'(\.|\d+|\-)', self.HOSTER_DOMAIN) if part != '.') + self.PLUGIN_DOMAIN = re.match(self.__pattern__, self.pyfile.url).group("DOMAIN").lower() + self.PLUGIN_NAME = "".join(part.capitalize() for part in re.split(r'(\.|\d+|\-)', self.PLUGIN_DOMAIN) if part != '.') def _setup(self): - account_name = self.__name__ if self.account.HOSTER_DOMAIN is None else self.HOSTER_NAME + account_name = self.__name__ if self.account.PLUGIN_DOMAIN is None else self.PLUGIN_NAME self.chunk_limit = 1 self.multiDL = True if self.account: - self.req = self.pyload.requestFactory.getRequest(accountname, self.user) - self.premium = self.account.is_premium(self.user) + self.req = self.pyload.requestFactory.getRequest(accountname, self.account.user) + self.premium = self.account.premium self.resume_download = self.premium else: self.req = self.pyload.requestFactory.getRequest(account_name) @@ -56,19 +56,19 @@ class XFileSharingProFolder(XFSCrypter): self.req.close() if not self.account: - self.account = self.pyload.accountManager.getAccountPlugin(self.HOSTER_NAME) + self.account = self.pyload.accountManager.getAccountPlugin(self.PLUGIN_NAME) if not self.account: self.account = self.pyload.accountManager.getAccountPlugin(self.__name__) if self.account: - if not self.account.HOSTER_DOMAIN: - self.account.HOSTER_DOMAIN = self.HOSTER_DOMAIN + if not self.account.PLUGIN_DOMAIN: + self.account.PLUGIN_DOMAIN = self.PLUGIN_DOMAIN - if not self.user: - self.user = self.account.select()[0] + if not self.account.user: #@TODO: Move to `Account` in 0.4.10 + self.account.user = self.account.select()[0] - if not self.user or not self.account.is_logged(self.user, True): + if not self.account.logged: self.account = False diff --git a/module/plugins/hooks/AlldebridComHook.py b/module/plugins/hooks/AlldebridComHook.py deleted file mode 100644 index 402850d87..000000000 --- a/module/plugins/hooks/AlldebridComHook.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.internal.MultiHook import MultiHook - - -class AlldebridComHook(MultiHook): - __name__ = "AlldebridComHook" - __type__ = "hook" - __version__ = "0.17" - __status__ = "testing" - - __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__ = """Alldebrid.com hook plugin""" - __license__ = "GPLv3" - __authors__ = [("Andy Voigt", "spamsales@online.de")] - - - def get_hosters(self): - html = self.load("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/DebridItaliaComHook.py b/module/plugins/hooks/DebridItaliaComHook.py deleted file mode 100644 index 1b000c665..000000000 --- a/module/plugins/hooks/DebridItaliaComHook.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from module.plugins.internal.MultiHook import MultiHook - - -class DebridItaliaComHook(MultiHook): - __name__ = "DebridItaliaComHook" - __type__ = "hook" - __version__ = "0.13" - __status__ = "testing" - - __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__ = """Debriditalia.com hook plugin""" - __license__ = "GPLv3" - __authors__ = [("stickell" , "l.stickell@yahoo.it"), - ("Walter Purcaro", "vuolter@gmail.com" )] - - - def get_hosters(self): - return self.load("http://debriditalia.com/api.php", get={'hosts': ""}).replace('"', '').split(',') diff --git a/module/plugins/hooks/EasybytezComHook.py b/module/plugins/hooks/EasybytezComHook.py deleted file mode 100644 index 6f53619ac..000000000 --- a/module/plugins/hooks/EasybytezComHook.py +++ /dev/null @@ -1,30 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from module.plugins.internal.MultiHook import MultiHook - - -class EasybytezComHook(MultiHook): - __name__ = "EasybytezComHook" - __type__ = "hook" - __version__ = "0.08" - __status__ = "testing" - - __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__ = """EasyBytez.com hook plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - - def get_hosters(self): - user, info = self.account.select() - - html = self.load("http://www.easybytez.com", - req=self.account.get_request(user)) - - return re.search(r'</textarea>\s*Supported sites:(.*)', html).group(1).split(',') diff --git a/module/plugins/hooks/ExternalScripts.py b/module/plugins/hooks/ExternalScripts.py index 4ec526d35..c752ce6ac 100644 --- a/module/plugins/hooks/ExternalScripts.py +++ b/module/plugins/hooks/ExternalScripts.py @@ -94,7 +94,8 @@ class ExternalScripts(Addon): p.communicate() except Exception, e: - self.log_error(_("Runtime error: %s") % script, e or _("Unknown error")) + self.log_error(_("Runtime error: %s") % script, + e or _("Unknown error")) def pyload_start(self): diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 7d3d9237e..19d8bef94 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -4,7 +4,6 @@ from __future__ import with_statement import os import sys -import traceback # monkey patch bug in python 2.6 and lower # http://bugs.python.org/issue6122 , http://bugs.python.org/issue1236 , http://bugs.python.org/issue1731717 @@ -167,13 +166,9 @@ class ExtractArchive(Addon): self.log_warning(_("No %s installed") % p) else: self.log_warning(_("Could not activate: %s") % p, e) - if self.pyload.debug: - traceback.print_exc() except Exception, e: self.log_warning(_("Could not activate: %s") % p, e) - if self.pyload.debug: - traceback.print_exc() if self.extractors: self.log_debug(*["Found %s %s" % (Extractor.__name__, Extractor.VERSION) for Extractor in self.extractors]) @@ -510,8 +505,6 @@ class ExtractArchive(Addon): except Exception, e: self.log_error(name, _("Unknown error"), e) - if self.pyload.debug: - traceback.print_exc() self.manager.dispatchEvent("archive_extract_failed", pyfile, archive) diff --git a/module/plugins/hooks/FastixRuHook.py b/module/plugins/hooks/FastixRuHook.py deleted file mode 100644 index 3fdb29409..000000000 --- a/module/plugins/hooks/FastixRuHook.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 FastixRuHook(MultiHook): - __name__ = "FastixRuHook" - __type__ = "hook" - __version__ = "0.06" - __status__ = "testing" - - __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__ = """Fastix.ru hook plugin""" - __license__ = "GPLv3" - __authors__ = [("Massimo Rosamilia", "max@spiritix.eu")] - - - def get_hosters(self): - html = self.load("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/FreeWayMeHook.py b/module/plugins/hooks/FreeWayMeHook.py deleted file mode 100644 index 1380433bf..000000000 --- a/module/plugins/hooks/FreeWayMeHook.py +++ /dev/null @@ -1,28 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.internal.MultiHook import MultiHook - - -class FreeWayMeHook(MultiHook): - __name__ = "FreeWayMeHook" - __type__ = "hook" - __version__ = "0.18" - __status__ = "testing" - - __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__ = """FreeWay.me hook plugin""" - __license__ = "GPLv3" - __authors__ = [("Nicolas Giese", "james@free-way.me")] - - - def get_hosters(self): - user, info = self.account.select() - hostis = self.load("http://www.free-way.bz/ajax/jd.php", - get={'id' : 3, - 'user': user, - 'pass': info['login']['password']}).replace("\"", "") #@TODO: Revert to `https` in 0.4.10 - return [x.strip() for x in hostis.split(",") if x.strip()] diff --git a/module/plugins/hooks/HighWayMeHook.py b/module/plugins/hooks/HighWayMeHook.py deleted file mode 100644 index e9e62525d..000000000 --- a/module/plugins/hooks/HighWayMeHook.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.common.json_layer import json_loads -from module.plugins.internal.MultiHook import MultiHook - - -class HighWayMeHook(MultiHook): - __name__ = "HighWayMeHook" - __type__ = "hook" - __version__ = "0.04" - __status__ = "testing" - - __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__ = """High-Way.me hook plugin""" - __license__ = "GPLv3" - __authors__ = [("EvolutionClip", "evolutionclip@live.de")] - - - def get_hosters(self): - json_data = json_loads(self.load("https://high-way.me/api.php", - get={'hoster': 1})) - return [element['name'] for element in json_data['hoster']] diff --git a/module/plugins/hooks/IRCInterface.py b/module/plugins/hooks/IRCInterface.py index 020939805..c84c0439d 100644 --- a/module/plugins/hooks/IRCInterface.py +++ b/module/plugins/hooks/IRCInterface.py @@ -18,7 +18,7 @@ from module.utils import formatSize class IRCInterface(Thread, Addon): __name__ = "IRCInterface" __type__ = "hook" - __version__ = "0.16" + __version__ = "0.17" __status__ = "testing" __config__ = [("host" , "str" , "IRC-Server Address" , "Enter your server here!"), @@ -105,7 +105,8 @@ class IRCInterface(Thread, Addon): except IRCError, ex: self.sock.send("QUIT :byebye\r\n") - traceback.print_exc() + if self.pyload.debug: + traceback.print_exc() self.sock.close() diff --git a/module/plugins/hooks/LinksnappyComHook.py b/module/plugins/hooks/LinksnappyComHook.py deleted file mode 100644 index e46e480d6..000000000 --- a/module/plugins/hooks/LinksnappyComHook.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 LinksnappyComHook(MultiHook): - __name__ = "LinksnappyComHook" - __type__ = "hook" - __version__ = "0.05" - __status__ = "testing" - - __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__ = """Linksnappy.com hook plugin""" - __license__ = "GPLv3" - __authors__ = [("stickell", "l.stickell@yahoo.it")] - - - def get_hosters(self): - json_data = self.load("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/MegaDebridEuHook.py b/module/plugins/hooks/MegaDebridEuHook.py deleted file mode 100644 index 04f0be86f..000000000 --- a/module/plugins/hooks/MegaDebridEuHook.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 MegaDebridEuHook(MultiHook): - __name__ = "MegaDebridEuHook" - __type__ = "hook" - __version__ = "0.06" - __status__ = "testing" - - __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__ = """Mega-debrid.eu hook plugin""" - __license__ = "GPLv3" - __authors__ = [("D.Ducatel", "dducatel@je-geek.fr")] - - - def get_hosters(self): - reponse = self.load("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.log_error(_("Unable to retrieve hoster list")) - host_list = [] - - return host_list diff --git a/module/plugins/hooks/MegaRapidoNetHook.py b/module/plugins/hooks/MegaRapidoNetHook.py deleted file mode 100644 index 4956427ff..000000000 --- a/module/plugins/hooks/MegaRapidoNetHook.py +++ /dev/null @@ -1,82 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from module.plugins.internal.MultiHook import MultiHook - - -class MegaRapidoNetHook(MultiHook): - __name__ = "MegaRapidoNetHook" - __type__ = "hook" - __version__ = "0.03" - __status__ = "testing" - - __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 get_hosters(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.values(): - hoster_list.extend(item) - - return hoster_list diff --git a/module/plugins/hooks/MergeFiles.py b/module/plugins/hooks/MergeFiles.py index a76a578bf..c6405e5a3 100644 --- a/module/plugins/hooks/MergeFiles.py +++ b/module/plugins/hooks/MergeFiles.py @@ -4,7 +4,6 @@ from __future__ import with_statement import os import re -import traceback from module.plugins.internal.Addon import Addon, threaded from module.utils import save_join as fs_join @@ -13,7 +12,7 @@ from module.utils import save_join as fs_join class MergeFiles(Addon): __name__ = "MergeFiles" __type__ = "hook" - __version__ = "0.16" + __version__ = "0.17" __status__ = "testing" __config__ = [("activated", "bool", "Activated", True)] @@ -69,7 +68,7 @@ class MergeFiles(Addon): self.log_debug("Finished merging part", splitted_file) except Exception, e: - traceback.print_exc() + self.log_error(e) finally: pyfile.setProgress(100) diff --git a/module/plugins/hooks/MultihostersComHook.py b/module/plugins/hooks/MultihostersComHook.py deleted file mode 100644 index ec1cf9c85..000000000 --- a/module/plugins/hooks/MultihostersComHook.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.hooks.ZeveraComHook import ZeveraComHook - - -class MultihostersComHook(ZeveraComHook): - __name__ = "MultihostersComHook" - __type__ = "hook" - __version__ = "0.03" - __status__ = "testing" - - __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__ = """Multihosters.com hook plugin""" - __license__ = "GPLv3" - __authors__ = [("tjeh", "tjeh@gmx.net")] diff --git a/module/plugins/hooks/MultishareCzHook.py b/module/plugins/hooks/MultishareCzHook.py deleted file mode 100644 index 30f1e21b5..000000000 --- a/module/plugins/hooks/MultishareCzHook.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from module.plugins.internal.MultiHook import MultiHook - - -class MultishareCzHook(MultiHook): - __name__ = "MultishareCzHook" - __type__ = "hook" - __version__ = "0.08" - __status__ = "testing" - - __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__ = """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 get_hosters(self): - html = self.load("http://www.multishare.cz/monitoring/") - return re.findall(self.HOSTER_PATTERN, html) diff --git a/module/plugins/hooks/MyfastfileComHook.py b/module/plugins/hooks/MyfastfileComHook.py deleted file mode 100644 index 1eedd9238..000000000 --- a/module/plugins/hooks/MyfastfileComHook.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 MyfastfileComHook(MultiHook): - __name__ = "MyfastfileComHook" - __type__ = "hook" - __version__ = "0.06" - __status__ = "testing" - - __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__ = """Myfastfile.com hook plugin""" - __license__ = "GPLv3" - __authors__ = [("stickell", "l.stickell@yahoo.it")] - - - def get_hosters(self): - json_data = self.load("http://myfastfile.com/api.php", get={'hosts': ""}) - self.log_debug("JSON data", json_data) - json_data = json_loads(json_data) - - return json_data['hosts'] diff --git a/module/plugins/hooks/NoPremiumPlHook.py b/module/plugins/hooks/NoPremiumPlHook.py deleted file mode 100644 index 7dbdf6a68..000000000 --- a/module/plugins/hooks/NoPremiumPlHook.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 NoPremiumPlHook(MultiHook): - __name__ = "NoPremiumPlHook" - __type__ = "hook" - __version__ = "0.04" - __status__ = "testing" - - __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__ = """NoPremium.pl hook plugin""" - __license__ = "GPLv3" - __authors__ = [("goddie", "dev@nopremium.pl")] - - - def get_hosters(self): - hostings = json_loads(self.load("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.log_debug(hostings_domains) - - return hostings_domains diff --git a/module/plugins/hooks/OverLoadMeHook.py b/module/plugins/hooks/OverLoadMeHook.py deleted file mode 100644 index 5398fc17d..000000000 --- a/module/plugins/hooks/OverLoadMeHook.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.internal.MultiHook import MultiHook - - -class OverLoadMeHook(MultiHook): - __name__ = "OverLoadMeHook" - __type__ = "hook" - __version__ = "0.05" - __status__ = "testing" - - __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__ = """Over-Load.me hook plugin""" - __license__ = "GPLv3" - __authors__ = [("marley", "marley@over-load.me")] - - - def get_hosters(self): - html = self.load("https://api.over-load.me/hoster.php", - get={'auth': "0001-cb1f24dadb3aa487bda5afd3b76298935329be7700cd7-5329be77-00cf-1ca0135f"}).replace("\"", "").strip() - return [x.strip() for x in html.split(",") if x.strip()] diff --git a/module/plugins/hooks/PremiumToHook.py b/module/plugins/hooks/PremiumToHook.py deleted file mode 100644 index bcd7a7aab..000000000 --- a/module/plugins/hooks/PremiumToHook.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.internal.MultiHook import MultiHook - - -class PremiumToHook(MultiHook): - __name__ = "PremiumToHook" - __type__ = "hook" - __version__ = "0.11" - __status__ = "testing" - - __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__ = """Premium.to hook plugin""" - __license__ = "GPLv3" - __authors__ = [("RaNaN" , "RaNaN@pyload.org" ), - ("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it")] - - - def get_hosters(self): - user, info = self.account.select() - html = self.load("http://premium.to/api/hosters.php", - get={'username': user, - 'password': info['login']['password']}) - return [x.strip() for x in html.replace("\"", "").split(";")] diff --git a/module/plugins/hooks/PremiumizeMeHook.py b/module/plugins/hooks/PremiumizeMeHook.py deleted file mode 100644 index 9a9a380af..000000000 --- a/module/plugins/hooks/PremiumizeMeHook.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- 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.20" - __status__ = "testing" - - __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__ = """Premiumize.me hook plugin""" - __license__ = "GPLv3" - __authors__ = [("Florian Franzen", "FlorianFranzen@gmail.com")] - - - def get_hosters(self): - #: Get account data - user, info = self.account.select() - - #: Get supported hosters list from premiumize.me using the - #: json API v1 (see https://secure.premiumize.me/?show=api) - answer = self.load("http://api.premiumize.me/pm-api/v1.php", #@TODO: Revert to `https` in 0.4.10 - get={'method' : "hosterlist", - 'params[login]': user, - 'params[pass]' : info['login']['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/PutdriveComHook.py b/module/plugins/hooks/PutdriveComHook.py deleted file mode 100644 index d206aaf88..000000000 --- a/module/plugins/hooks/PutdriveComHook.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.hooks.ZeveraComHook import ZeveraComHook - - -class PutdriveComHook(ZeveraComHook): - __name__ = "PutdriveComHook" - __type__ = "hook" - __version__ = "0.02" - __status__ = "testing" - - __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__ = """Putdrive.com hook plugin""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] diff --git a/module/plugins/hooks/RPNetBizHook.py b/module/plugins/hooks/RPNetBizHook.py deleted file mode 100644 index 5d26b7f09..000000000 --- a/module/plugins/hooks/RPNetBizHook.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 RPNetBizHook(MultiHook): - __name__ = "RPNetBizHook" - __type__ = "hook" - __version__ = "0.16" - __status__ = "testing" - - __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__ = """RPNet.biz hook plugin""" - __license__ = "GPLv3" - __authors__ = [("Dman", "dmanugm@gmail.com")] - - - def get_hosters(self): - #: Get account data - user, info = self.account.select() - - res = self.load("https://premium.rpnet.biz/client_api.php", - get={'username': user, - 'password': info['login']['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/RapideoPlHook.py b/module/plugins/hooks/RapideoPlHook.py deleted file mode 100644 index 130f73851..000000000 --- a/module/plugins/hooks/RapideoPlHook.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 RapideoPlHook(MultiHook): - __name__ = "RapideoPlHook" - __type__ = "hook" - __version__ = "0.04" - __status__ = "testing" - - __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__ = """Rapideo.pl hook plugin""" - __license__ = "GPLv3" - __authors__ = [("goddie", "dev@rapideo.pl")] - - - def get_hosters(self): - hostings = json_loads(self.load("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.log_debug(hostings_domains) - - return hostings_domains diff --git a/module/plugins/hooks/RealdebridComHook.py b/module/plugins/hooks/RealdebridComHook.py deleted file mode 100644 index 01b9d165e..000000000 --- a/module/plugins/hooks/RealdebridComHook.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.internal.MultiHook import MultiHook - - -class RealdebridComHook(MultiHook): - __name__ = "RealdebridComHook" - __type__ = "hook" - __version__ = "0.47" - __status__ = "testing" - - __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__ = """Real-Debrid.com hook plugin""" - __license__ = "GPLv3" - __authors__ = [("Devirex Hazzard", "naibaf_11@yahoo.de")] - - - def get_hosters(self): - html = self.load("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/RehostToHook.py b/module/plugins/hooks/RehostToHook.py deleted file mode 100644 index 7bb27e820..000000000 --- a/module/plugins/hooks/RehostToHook.py +++ /dev/null @@ -1,27 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.internal.MultiHook import MultiHook - - -class RehostToHook(MultiHook): - __name__ = "RehostToHook" - __type__ = "hook" - __version__ = "0.51" - __status__ = "testing" - - __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__ = """Rehost.to hook plugin""" - __license__ = "GPLv3" - __authors__ = [("RaNaN", "RaNaN@pyload.org")] - - - def get_hosters(self): - user, info = self.account.select() - html = self.load("http://rehost.to/api.php", - get={'cmd' : "get_supported_och_dl", - 'long_ses': self.account.get_data(user)['session']}) - return [x.strip() for x in html.replace("\"", "").split(",")] diff --git a/module/plugins/hooks/SimplyPremiumComHook.py b/module/plugins/hooks/SimplyPremiumComHook.py deleted file mode 100644 index 6fbd75c8a..000000000 --- a/module/plugins/hooks/SimplyPremiumComHook.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 SimplyPremiumComHook(MultiHook): - __name__ = "SimplyPremiumComHook" - __type__ = "hook" - __version__ = "0.06" - __status__ = "testing" - - __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__ = """Simply-Premium.com hook plugin""" - __license__ = "GPLv3" - __authors__ = [("EvolutionClip", "evolutionclip@live.de")] - - - def get_hosters(self): - json_data = self.load("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/SimplydebridComHook.py b/module/plugins/hooks/SimplydebridComHook.py deleted file mode 100644 index 0da7ec719..000000000 --- a/module/plugins/hooks/SimplydebridComHook.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.internal.MultiHook import MultiHook - - -class SimplydebridComHook(MultiHook): - __name__ = "SimplydebridComHook" - __type__ = "hook" - __version__ = "0.05" - __status__ = "testing" - - __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__ = """Simply-Debrid.com hook plugin""" - __license__ = "GPLv3" - __authors__ = [("Kagenoshin", "kagenoshin@gmx.ch")] - - - def get_hosters(self): - html = self.load("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/SmoozedComHook.py b/module/plugins/hooks/SmoozedComHook.py deleted file mode 100644 index b9825b223..000000000 --- a/module/plugins/hooks/SmoozedComHook.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.internal.MultiHook import MultiHook - - -class SmoozedComHook(MultiHook): - __name__ = "SmoozedComHook" - __type__ = "hook" - __version__ = "0.04" - __status__ = "testing" - - __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__ = """Smoozed.com hook plugin""" - __license__ = "GPLv3" - __authors__ = [("", "")] - - - def get_hosters(self): - user, info = self.account.select() - return self.account.get_data(user)['hosters'] diff --git a/module/plugins/hooks/UpdateManager.py b/module/plugins/hooks/UpdateManager.py index fb9e28b5d..ec262e672 100644 --- a/module/plugins/hooks/UpdateManager.py +++ b/module/plugins/hooks/UpdateManager.py @@ -7,7 +7,6 @@ import os import re import sys import time -import traceback from module.plugins.internal.Addon import Expose, Addon, threaded from module.plugins.internal.Plugin import exists @@ -269,8 +268,6 @@ class UpdateManager(Addon): except Exception, e: self.log_error(_("Error updating plugin: [%s] %s") % (type, name), e) - if self.pyload.debug: - traceback.print_exc() if updated: self.log_info(_("*** Plugins updated ***")) @@ -337,8 +334,6 @@ class UpdateManager(Addon): except OSError, e: self.log_warning(_("Error removing: %s") % filename, e) - if self.pyload.debug: - traceback.print_exc() else: id = (type, name) diff --git a/module/plugins/hooks/XFileSharingPro.py b/module/plugins/hooks/XFileSharingPro.py index 9b9c7f0ad..70bafba67 100644 --- a/module/plugins/hooks/XFileSharingPro.py +++ b/module/plugins/hooks/XFileSharingPro.py @@ -8,7 +8,7 @@ from module.plugins.internal.Hook import Hook class XFileSharingPro(Hook): __name__ = "XFileSharingPro" __type__ = "hook" - __version__ = "0.42" + __version__ = "0.43" __status__ = "testing" __config__ = [("activated" , "bool", "Activated" , True ), @@ -28,22 +28,22 @@ class XFileSharingPro(Hook): 'crypter': (r'https?://(?:www\.)?(?:\w+\.)*?(?P<DOMAIN>(?:[\d.]+|[\w\-^_]{3,}(?:\.[a-zA-Z]{2,}){1,2})(?:\:\d+)?)/(?:user|folder)s?/\w+', r'https?://(?:[^/]+\.)?(?P<DOMAIN>%s)/(?:user|folder)s?/\w+')} - HOSTER_BUILTIN = [#WORKING HOSTERS: - "ani-stream.com", "backin.net", "cloudsix.me", "eyesfile.ca", - "file4safe.com", "fileband.com", "filedwon.com", "fileparadox.in", - "filevice.com", "hostingbulk.com", "junkyvideo.com", "ravishare.com", - "ryushare.com", "salefiles.com", "sendmyway.com", "sharebeast.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", "sharerepo.com", - "shareswift.com", "uploadbaz.com", "uploadc.com", "vidbull.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"] + BUILTIN_HOSTERS = [#WORKING HOSTERS: + "ani-stream.com", "backin.net", "cloudsix.me", "eyesfile.ca", + "file4safe.com", "fileband.com", "filedwon.com", "fileparadox.in", + "filevice.com", "hostingbulk.com", "junkyvideo.com", "ravishare.com", + "ryushare.com", "salefiles.com", "sendmyway.com", "sharebeast.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", "sharerepo.com", + "shareswift.com", "uploadbaz.com", "uploadc.com", "vidbull.com", + "zalaa.com", "zomgupload.com", + #: NOT WORKING: + "amonshare.com", "banicrazy.info", "boosterking.com", "host4desi.com", + "laoupload.com", "rd-fs.com"] + BUILTIN_CRYPTERS = ["junocloud.me", "rapidfileshare.net"] # def plugin_config_changed(self, plugin, name, value): @@ -73,7 +73,7 @@ class XFileSharingPro(Hook): plugin_set = set(plugins.replace(' ', '').replace('\\', '').replace('|', ',').replace(';', ',').lower().split(',')) if use_builtin_list: - plugin_set |= set(x.lower() for x in getattr(self, "%s_BUILTIN" % type.upper())) + plugin_set |= set(x.lower() for x in getattr(self, "BUILTIN_%sS" % type.upper())) plugin_set -= set(('', u'')) diff --git a/module/plugins/hooks/ZeveraComHook.py b/module/plugins/hooks/ZeveraComHook.py deleted file mode 100644 index 395c67802..000000000 --- a/module/plugins/hooks/ZeveraComHook.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.internal.MultiHook import MultiHook - - -class ZeveraComHook(MultiHook): - __name__ = "ZeveraComHook" - __type__ = "hook" - __version__ = "0.06" - __status__ = "testing" - - __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__ = """Zevera.com hook plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg" , "zoidberg@mujmail.cz"), - ("Walter Purcaro", "vuolter@gmail.com" )] - - - def get_hosters(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/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py index d64834a7c..1952309fe 100644 --- a/module/plugins/hoster/BasePlugin.py +++ b/module/plugins/hoster/BasePlugin.py @@ -12,7 +12,7 @@ from module.plugins.internal.Hoster import Hoster class BasePlugin(Hoster): __name__ = "BasePlugin" __type__ = "hoster" - __version__ = "0.45" + __version__ = "0.46" __status__ = "testing" __pattern__ = r'^unmatchable$' @@ -33,48 +33,48 @@ class BasePlugin(Hoster): """ Main function """ + netloc = urlparse.urlparse(pyfile.url).netloc + pyfile.name = self.get_info(pyfile.url)['name'] if not pyfile.url.startswith("http"): self.fail(_("No plugin matched")) - for _i in xrange(5): - try: - link = self.direct_link(urllib.unquote(pyfile.url)) + try: + link = self.direct_link(urllib.unquote(pyfile.url)) - if link: - self.download(link, ref=False, disposition=True) - else: - self.fail(_("File not found")) + if link: + self.download(link, ref=False, disposition=True) + else: + self.fail(_("File not found")) - except BadHeader, e: - if e.code == 404: - self.offline() + except BadHeader, e: + if e.code == 404: + self.offline() - elif e.code in (401, 403): - self.log_debug("Auth required", "Received HTTP status code: %d" % e.code) + elif e.code in (401, 403): + self.log_debug("Auth required", "Received HTTP status code: %d" % e.code) - account = self.pyload.accountManager.getAccountPlugin('Http') - servers = [x['login'] for x in account.getAllAccounts()] #@TODO: Recheck in 0.4.10 - server = urlparse.urlparse(pyfile.url).netloc + #@TODO: Recheck in 0.4.10 + if self.account: + servers = [x['login'] for x in self.account.getAllAccounts()] + else: + servers = [] + + if netloc in servers: + self.log_debug("Logging on to %s" % netloc) + self.req.addAuth(self.account.get_login('password')) - if server in servers: - self.log_debug("Logging on to %s" % server) - self.req.addAuth(account.get_info(server)['login']['password']) - else: - pwd = self.get_password() - if ':' in pwd: - self.req.addAuth(pwd) - else: - self.fail(_("Authorization required")) else: - self.fail(e) + pwd = self.get_password() + if ':' in pwd: + self.req.addAuth(pwd) + else: + self.fail(_("Authorization required")) else: - break - else: - self.fail(_("No file downloaded")) #@TODO: Move to hoster class in 0.4.10 + self.fail(e) - errmsg = self.check_download({'Empty file' : re.compile(r'\A\s*\Z'), + errmsg = self.check_file({'Empty file' : re.compile(r'\A\s*\Z'), 'Html error' : re.compile(r'\A(?:\s*<.+>)?((?:[\w\s]*(?:[Ee]rror|ERROR)\s*\:?)?\s*\d{3})(?:\Z|\s+)'), 'Html file' : re.compile(r'\A\s*<!DOCTYPE html'), 'Request error': re.compile(r'([Aa]n error occured while processing your request)')}) diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index b975a8ab0..cea78088e 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class BitshareCom(SimpleHoster): __name__ = "BitshareCom" __type__ = "hoster" - __version__ = "0.55" + __version__ = "0.56" __status__ = "testing" __pattern__ = r'http://(?:www\.)?bitshare\.com/(files/)?(?(1)|\?f=)(?P<ID>\w+)(?(1)/(?P<NAME>.+?)\.html)' @@ -39,7 +39,7 @@ class BitshareCom(SimpleHoster): def process(self, pyfile): if self.premium: - self.account.relogin(self.user) + self.account.relogin() #: File id m = re.match(self.__pattern__, pyfile.url) @@ -75,7 +75,7 @@ class BitshareCom(SimpleHoster): #: This may either download our file or forward us to an error page self.link = self.get_download_url() - if self.check_download({'error': ">Error occured<"}): + if self.check_file({'error': ">Error occured<"}): self.retry(5, 5 * 60, "Bitshare host : Error occured") diff --git a/module/plugins/hoster/CrockoCom.py b/module/plugins/hoster/CrockoCom.py index 17e3ee93c..2ed140b9c 100644 --- a/module/plugins/hoster/CrockoCom.py +++ b/module/plugins/hoster/CrockoCom.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class CrockoCom(SimpleHoster): __name__ = "CrockoCom" __type__ = "hoster" - __version__ = "0.21" + __version__ = "0.22" __status__ = "testing" __pattern__ = r'http://(?:www\.)?(crocko|easy-share)\.com/\w+' @@ -58,7 +58,7 @@ class CrockoCom(SimpleHoster): inputs['recaptcha_response_field'], inputs['recaptcha_challenge_field'] = recaptcha.challenge() self.download(action, post=inputs) - if self.check_download({'captcha': recaptcha.KEY_AJAX_PATTERN}): + if self.check_file({'captcha': recaptcha.KEY_AJAX_PATTERN}): self.captcha.invalid() else: break diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index 6afd9fa2d..eeba9d86d 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -12,7 +12,7 @@ from module.utils import parseFileSize as parse_size class CzshareCom(SimpleHoster): __name__ = "CzshareCom" __type__ = "hoster" - __version__ = "1.02" + __version__ = "1.03" __status__ = "testing" __pattern__ = r'http://(?:www\.)?(czshare|sdilej)\.(com|cz)/(\d+/|download\.php\?).+' @@ -40,11 +40,11 @@ class CzshareCom(SimpleHoster): USER_CREDIT_PATTERN = r'<div class="credit">\s*kredit: <strong>([\d .,]+)(\w+)</strong>\s*</div><!-- .credit -->' - def check_traffic_left(self): + def check_traffic(self): #: Check if user logged in m = re.search(self.USER_CREDIT_PATTERN, self.html) if m is None: - self.account.relogin(self.user) + self.account.relogin() self.html = self.load(self.pyfile.url) m = re.search(self.USER_CREDIT_PATTERN, self.html) if m is None: @@ -54,7 +54,7 @@ class CzshareCom(SimpleHoster): try: credit = parse_size(m.group(1).replace(' ', ''), m.group(2)) self.log_info(_("Premium download for %i KiB of Credit") % (self.pyfile.size / 1024)) - self.log_info(_("User %s has %i KiB left") % (self.user, credit / 1024)) + self.log_info(_("User %s has %i KiB left") % (self.account.user, credit / 1024)) if credit < self.pyfile.size: self.log_info(_("Not enough credit to download file: %s") % self.pyfile.name) return False @@ -137,9 +137,9 @@ class CzshareCom(SimpleHoster): self.wait() - def check_file(self): + def check_download(self): #: Check download - check = self.check_download({ + check = self.check_file({ "temp offline" : re.compile(r"^Soubor je do.*asn.* nedostupn.*$"), 'credit' : re.compile(r"^Nem.*te dostate.*n.* kredit.$"), "multi-dl" : re.compile(self.MULTIDL_PATTERN), @@ -159,7 +159,7 @@ class CzshareCom(SimpleHoster): self.captcha.invalid() self.retry() - return super(CzshareCom, self).check_file() + return super(CzshareCom, self).check_download() getInfo = create_getInfo(CzshareCom) diff --git a/module/plugins/hoster/DataportCz.py b/module/plugins/hoster/DataportCz.py index 15caae1f7..2b30df059 100644 --- a/module/plugins/hoster/DataportCz.py +++ b/module/plugins/hoster/DataportCz.py @@ -6,7 +6,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DataportCz(SimpleHoster): __name__ = "DataportCz" __type__ = "hoster" - __version__ = "0.42" + __version__ = "0.43" __status__ = "testing" __pattern__ = r'http://(?:www\.)?dataport\.cz/file/(.+)' @@ -41,7 +41,7 @@ class DataportCz(SimpleHoster): self.download("http://www.dataport.cz%s" % action, post=inputs) - check = self.check_download({'captcha': 'alert("\u0160patn\u011b opsan\u00fd k\u00f3d z obr\u00e1zu");', + check = self.check_file({'captcha': 'alert("\u0160patn\u011b opsan\u00fd k\u00f3d z obr\u00e1zu");', 'slot' : 'alert("Je n\u00e1m l\u00edto, ale moment\u00e1ln\u011b nejsou'}) if check == "captcha": self.error(_("invalid captcha")) diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py index 9d42935cb..cb9ab5572 100644 --- a/module/plugins/hoster/DepositfilesCom.py +++ b/module/plugins/hoster/DepositfilesCom.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DepositfilesCom(SimpleHoster): __name__ = "DepositfilesCom" __type__ = "hoster" - __version__ = "0.57" + __version__ = "0.58" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(depositfiles\.com|dfiles\.(eu|ru))(/\w{1,3})?/files/(?P<ID>\w+)' @@ -48,7 +48,7 @@ class DepositfilesCom(SimpleHoster): m = re.search(r"var fid = '(\w+)';", self.html) if m is None: - self.retry(wait_time=5) + self.retry(delay=5) params = {'fid': m.group(1)} self.log_debug("FID: %s" % params['fid']) @@ -76,7 +76,7 @@ class DepositfilesCom(SimpleHoster): self.retry(25, 60 * 60, "Download limit reached") elif 'onClick="show_gold_offer' in self.html: - self.account.relogin(self.user) + self.account.relogin() self.retry() else: diff --git a/module/plugins/hoster/EuroshareEu.py b/module/plugins/hoster/EuroshareEu.py index 70df8e354..3cfa014dd 100644 --- a/module/plugins/hoster/EuroshareEu.py +++ b/module/plugins/hoster/EuroshareEu.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class EuroshareEu(SimpleHoster): __name__ = "EuroshareEu" __type__ = "hoster" - __version__ = "0.31" + __version__ = "0.32" __status__ = "testing" __pattern__ = r'http://(?:www\.)?euroshare\.(eu|sk|cz|hu|pl)/file/.+' @@ -32,16 +32,16 @@ class EuroshareEu(SimpleHoster): def handle_premium(self, pyfile): if self.ERROR_PATTERN in self.html: - self.account.relogin(self.user) + self.account.relogin() self.retry(msg=_("User not logged in")) self.link = pyfile.url.rstrip('/') + "/download/" - check = self.check_download({'login': re.compile(self.ERROR_PATTERN), + check = self.check_file({'login': re.compile(self.ERROR_PATTERN), 'json' : re.compile(r'\{"status":"error".*?"message":"(.*?)"')}) if check == "login" or (check == "json" and self.last_check.group(1) == "Access token expired"): - self.account.relogin(self.user) + self.account.relogin() self.retry(msg=_("Access token expired")) elif check == "json": diff --git a/module/plugins/hoster/ExtabitCom.py b/module/plugins/hoster/ExtabitCom.py index 3442e7d27..0d5533539 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.67" + __version__ = "0.68" __status__ = "testing" __pattern__ = r'http://(?:www\.)?extabit\.com/(file|go|fid)/(?P<ID>\w+)' @@ -39,7 +39,7 @@ class ExtabitCom(SimpleHoster): self.wait(int(m.group(1)) * 60, True) elif "The daily downloads limit from your IP is exceeded" in self.html: self.log_warning(_("You have reached your daily downloads limit for today")) - self.wait(seconds_to_midnight(gmt=2), True) + self.wait(seconds_to_midnight(), True) self.log_debug("URL: " + self.req.http.lastEffectiveURL) m = re.match(self.__pattern__, self.req.http.lastEffectiveURL) diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py index f00dded3f..d932bb22e 100644 --- a/module/plugins/hoster/FastixRu.py +++ b/module/plugins/hoster/FastixRu.py @@ -10,7 +10,7 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class FastixRu(MultiHoster): __name__ = "FastixRu" __type__ = "hoster" - __version__ = "0.14" + __version__ = "0.15" __status__ = "testing" __pattern__ = r'http://(?:www\.)?fastix\.(ru|it)/file/\w{24}' @@ -28,7 +28,7 @@ class FastixRu(MultiHoster): def handle_premium(self, pyfile): self.html = json_loads(self.load("http://fastix.ru/api_v2/", - get={'apikey': self.account.get_data()['apikey'], + get={'apikey': self.account.get_data('apikey'), 'sub' : "getdirectlink", 'link' : pyfile.url}) data = self.html) diff --git a/module/plugins/hoster/FastshareCz.py b/module/plugins/hoster/FastshareCz.py index 62cf3889b..985faaa93 100644 --- a/module/plugins/hoster/FastshareCz.py +++ b/module/plugins/hoster/FastshareCz.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FastshareCz(SimpleHoster): __name__ = "FastshareCz" __type__ = "hoster" - __version__ = "0.33" + __version__ = "0.34" __status__ = "testing" __pattern__ = r'http://(?:www\.)?fastshare\.cz/\d+/.+' @@ -59,8 +59,8 @@ class FastshareCz(SimpleHoster): self.download(urlparse.urljoin(baseurl, action), post={'code': captcha, 'btn.x': 77, 'btn.y': 18}) - def check_file(self): - check = self.check_download({ + def check_download(self): + check = self.check_file({ 'paralell-dl' : re.compile(r"<title>FastShare.cz</title>|<script>alert\('Pres FREE muzete stahovat jen jeden soubor najednou.'\)"), 'wrong captcha': re.compile(r'Download for FREE'), 'credit' : re.compile(self.CREDIT_ERROR) @@ -70,12 +70,12 @@ class FastshareCz(SimpleHoster): self.retry(6, 10 * 60, _("Paralell download")) elif check == "wrong captcha": - self.retry(max_tries=5, msg=_("Wrong captcha")) + self.retry(attemps=5, msg=_("Wrong captcha")) elif check == "credit": self.restart(nopremium=True) - return super(FastshareCz, self).check_file() + return super(FastshareCz, self).check_download() getInfo = create_getInfo(FastshareCz) diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index 21654fee3..aa864271a 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FilecloudIo(SimpleHoster): __name__ = "FilecloudIo" __type__ = "hoster" - __version__ = "0.10" + __version__ = "0.11" __status__ = "testing" __pattern__ = r'http://(?:www\.)?(?:filecloud\.io|ifile\.it|mihd\.net)/(?P<ID>\w+)' @@ -64,7 +64,7 @@ class FilecloudIo(SimpleHoster): response, challenge = recaptcha.challenge(captcha_key) self.account.form_data = {'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response} - self.account.relogin(self.user) + self.account.relogin() self.retry(2) json_url = "http://filecloud.io/download-request.json" @@ -111,7 +111,7 @@ class FilecloudIo(SimpleHoster): def handle_premium(self, pyfile): - akey = self.account.get_data(self.user)['akey'] + akey = self.account.get_data('akey') ukey = self.info['pattern']['ID'] self.log_debug("Akey: %s | Ukey: %s" % (akey, ukey)) rep = self.load("http://api.filecloud.io/api-fetch_download_url.api", diff --git a/module/plugins/hoster/FilefactoryCom.py b/module/plugins/hoster/FilefactoryCom.py index b13a7c793..e8890086b 100644 --- a/module/plugins/hoster/FilefactoryCom.py +++ b/module/plugins/hoster/FilefactoryCom.py @@ -19,7 +19,7 @@ def get_info(urls): class FilefactoryCom(SimpleHoster): __name__ = "FilefactoryCom" __type__ = "hoster" - __version__ = "0.58" + __version__ = "0.59" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?filefactory\.com/(file|trafficshare/\w+)/\w+' @@ -59,18 +59,18 @@ class FilefactoryCom(SimpleHoster): self.wait(m.group(1)) - def check_file(self): - check = self.check_download({'multiple': "You are currently downloading too many files at once.", + def check_download(self): + check = self.check_file({'multiple': "You are currently downloading too many files at once.", 'error' : '<div id="errorMessage">'}) if check == "multiple": self.log_debug("Parallel downloads detected; waiting 15 minutes") - self.retry(wait_time=15 * 60, msg=_("Parallel downloads")) + self.retry(delay=15 * 60, msg=_("Parallel downloads")) elif check == "error": self.error(_("Unknown error")) - return super(FilefactoryCom, self).check_file() + return super(FilefactoryCom, self).check_download() def handle_premium(self, pyfile): diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index d8c626ef2..f2e3fb76d 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FilepostCom(SimpleHoster): __name__ = "FilepostCom" __type__ = "hoster" - __version__ = "0.35" + __version__ = "0.36" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(?:filepost\.com/files|fp\.io)/(?P<ID>[^/]+)' @@ -101,8 +101,8 @@ class FilepostCom(SimpleHoster): if 'error' in res['js']: if res['js']['error'] == "download_delay": - self.retry(wait_time=res['js']['params']['next_download']) - #: ~? self.retry(wait_time=js_answer['params']['next_download']) + self.retry(delay=res['js']['params']['next_download']) + #: ~? self.retry(delay=js_answer['params']['next_download']) elif 'Wrong file password' in res['js']['error'] \ or 'You entered a wrong CAPTCHA code' in res['js']['error'] \ diff --git a/module/plugins/hoster/FilesMailRu.py b/module/plugins/hoster/FilesMailRu.py index a1c30be7b..fcb29b922 100644 --- a/module/plugins/hoster/FilesMailRu.py +++ b/module/plugins/hoster/FilesMailRu.py @@ -33,7 +33,7 @@ def get_info(urls): class FilesMailRu(Hoster): __name__ = "FilesMailRu" __type__ = "hoster" - __version__ = "0.34" + __version__ = "0.35" __status__ = "testing" __pattern__ = r'http://(?:www\.)?files\.mail\.ru/.+' @@ -104,7 +104,7 @@ class FilesMailRu(Hoster): #: so i set it to check every download because sometimes there are downloads #: that contain the HTML-Text and 60MB ZEROs after that in a xyzfile.part1.rar file #: (Loading 100MB in to ram is not an option) - check = self.check_download({'html': "<meta name="}, read_size=50000) + check = self.check_file({'html': "<meta name="}, read_size=50000) if check == "html": self.log_info(_( "There was HTML Code in the Downloaded File (%s)...redirect error? The Download will be restarted." % diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index c35fab3fc..36ccd473f 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -34,7 +34,7 @@ def check_file(plugin, urls): class FileserveCom(Hoster): __name__ = "FileserveCom" __type__ = "hoster" - __version__ = "0.59" + __version__ = "0.60" __status__ = "testing" __pattern__ = r'http://(?:www\.)?fileserve\.com/file/(?P<ID>[^/]+)' @@ -95,7 +95,7 @@ class FileserveCom(Hoster): elif action['fail'] == "parallelDownload": self.log_warning(_("Parallel download error, now waiting 60s")) - self.retry(wait_time=60, msg=_("parallelDownload")) + self.retry(delay=60, msg=_("parallelDownload")) else: self.fail(_("Download check returned: %s") % action['fail']) @@ -120,7 +120,7 @@ class FileserveCom(Hoster): self.download(self.url, post={'download': "normal"}) self.log_debug(self.req.http.lastEffectiveURL) - check = self.check_download({'expired': self.LINK_EXPIRED_PATTERN, + check = self.check_file({'expired': self.LINK_EXPIRED_PATTERN, 'wait' : re.compile(self.LONG_WAIT_PATTERN), 'limit' : self.DL_LIMIT_PATTERN}) @@ -133,7 +133,7 @@ class FileserveCom(Hoster): elif check == "limit": self.log_warning(_("Download limited reached for today")) - self.wait(seconds_to_midnight(gmt=2), True) + self.wait(seconds_to_midnight(), True) self.retry() self.thread.m.reconnecting.wait(3) #: Ease issue with later downloads appearing to be in parallel @@ -187,8 +187,8 @@ class FileserveCom(Hoster): if self.__name__ == "FileserveCom": #: Try api download res = self.load("http://app.fileserve.com/api/download/premium/", - post={'username': self.user, - 'password': self.account.get_info(self.user)['login']['password'], + post={'username': self.account.user, + 'password': self.account.get_login('password'), 'shorten': self.file_id}) if res: res = json_loads(res) @@ -205,8 +205,8 @@ class FileserveCom(Hoster): self.download(premium_url or self.pyfile.url) - if not premium_url and self.check_download({'login': re.compile(self.NOT_LOGGED_IN_PATTERN)}): - self.account.relogin(self.user) + if not premium_url and self.check_file({'login': re.compile(self.NOT_LOGGED_IN_PATTERN)}): + self.account.relogin() self.retry(msg=_("Not logged in")) diff --git a/module/plugins/hoster/FreakshareCom.py b/module/plugins/hoster/FreakshareCom.py index 4564ee03e..72a1c0401 100644 --- a/module/plugins/hoster/FreakshareCom.py +++ b/module/plugins/hoster/FreakshareCom.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import seconds_to_midnight class FreakshareCom(Hoster): __name__ = "FreakshareCom" __type__ = "hoster" - __version__ = "0.43" + __version__ = "0.44" __status__ = "testing" __pattern__ = r'http://(?:www\.)?freakshare\.(net|com)/files/\S*?/' @@ -44,7 +44,7 @@ class FreakshareCom(Hoster): self.download(pyfile.url, post=self.req_opts) - check = self.check_download({'bad' : "bad try", + check = self.check_file({'bad' : "bad try", 'paralell' : "> Sorry, you cant download more then 1 files at time. <", 'empty' : "Warning: Unknown: Filename cannot be empty", 'wrong_captcha' : "Wrong Captcha!", @@ -142,7 +142,7 @@ class FreakshareCom(Hoster): if "Your Traffic is used up for today" in self.html: self.wantReconnect = True - return seconds_to_midnight(gmt=2) + return seconds_to_midnight() timestring = re.search('\s*var\s(?:downloadWait|time)\s=\s(\d*)[\d.]*;', self.html) if timestring: diff --git a/module/plugins/hoster/FreeWayMe.py b/module/plugins/hoster/FreeWayMe.py index ed7c4bf7f..c0053fc76 100644 --- a/module/plugins/hoster/FreeWayMe.py +++ b/module/plugins/hoster/FreeWayMe.py @@ -6,7 +6,7 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class FreeWayMe(MultiHoster): __name__ = "FreeWayMe" __type__ = "hoster" - __version__ = "0.19" + __version__ = "0.20" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?free-way\.(bz|me)/.+' @@ -33,7 +33,7 @@ class FreeWayMe(MultiHoster): get={'multiget': 7, 'url' : pyfile.url, 'user' : user, - 'pw' : self.account.get_info(self.user)['login']['password'], + 'pw' : self.account.get_login('password'), 'json' : ""}, just_header=True) diff --git a/module/plugins/hoster/Ftp.py b/module/plugins/hoster/Ftp.py index c9f5fa6b6..2fa5c1aa8 100644 --- a/module/plugins/hoster/Ftp.py +++ b/module/plugins/hoster/Ftp.py @@ -11,7 +11,7 @@ from module.plugins.internal.Hoster import Hoster class Ftp(Hoster): __name__ = "Ftp" __type__ = "hoster" - __version__ = "0.54" + __version__ = "0.55" __status__ = "testing" __pattern__ = r'(?:ftps?|sftp)://([\w.-]+(:[\w.-]+)?@)?[\w.-]+(:\d+)?/.+' @@ -29,10 +29,10 @@ class Ftp(Hoster): def process(self, pyfile): - parsed_url = urlparse.urlparse(pyfile.url) - netloc = parsed_url.netloc + p_url = urlparse.urlparse(pyfile.url) + netloc = p_url.netloc - pyfile.name = parsed_url.path.rpartition('/')[2] + pyfile.name = p_url.path.rpartition('/')[2] try: pyfile.name = urllib.unquote(str(pyfile.name)).decode('utf8') @@ -40,20 +40,30 @@ class Ftp(Hoster): pass if not "@" in netloc: - servers = [x['login'] for x in self.account.getAllAccounts()] if self.account else [] + self.log_debug("Auth required") + + #@TODO: Recheck in 0.4.10 + if self.account: + servers = [x['login'] for x in self.account.getAllAccounts()] + else: + servers = [] if netloc in servers: self.log_debug("Logging on to %s" % netloc) - self.req.addAuth(self.account.get_info(netloc)['login']['password']) + self.req.addAuth(self.account.get_login('password')) + else: pwd = self.get_password() if ':' in pwd: self.req.addAuth(pwd) + else: + self.fail(_("Authorization required")) self.req.http.c.setopt(pycurl.NOBODY, 1) try: res = self.load(pyfile.url) + except pycurl.error, e: self.fail(_("Error %d: %s") % e.args) diff --git a/module/plugins/hoster/HighWayMe.py b/module/plugins/hoster/HighWayMe.py index f8dc27eec..5d990795f 100644 --- a/module/plugins/hoster/HighWayMe.py +++ b/module/plugins/hoster/HighWayMe.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import seconds_to_midnight class HighWayMe(MultiHoster): __name__ = "HighWayMe" __type__ = "hoster" - __version__ = "0.14" + __version__ = "0.15" __status__ = "testing" __pattern__ = r'https?://.+high-way\.my' @@ -27,7 +27,7 @@ class HighWayMe(MultiHoster): def check_errors(self): if self.html.get('code') == 302: #@NOTE: This is not working. It should by if 302 Moved Temporarily then... But I don't now how to implement it. - self.account.relogin(self.user) + self.account.relogin() self.retry() elif "<code>9</code>" in self.html: @@ -39,7 +39,7 @@ class HighWayMe(MultiHoster): elif "trafficlimit" in self.html: self.log_warning(_("Reached daily limit")) - self.retry(wait_time=seconds_to_midnight(gmt=2), msg="Daily limit for this host reached") + self.retry(delay=seconds_to_midnight(), msg="Daily limit for this host reached") elif "<code>8</code>" in self.html: self.log_warning(_("Hoster temporarily unavailable, waiting 1 minute and retry")) diff --git a/module/plugins/hoster/Keep2ShareCc.py b/module/plugins/hoster/Keep2ShareCc.py index b8275e84b..1b9f69a02 100644 --- a/module/plugins/hoster/Keep2ShareCc.py +++ b/module/plugins/hoster/Keep2ShareCc.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class Keep2ShareCc(SimpleHoster): __name__ = "Keep2ShareCc" __type__ = "hoster" - __version__ = "0.25" + __version__ = "0.26" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(keep2share|k2s|keep2s)\.cc/file/(?P<ID>\w+)' @@ -45,7 +45,7 @@ class Keep2ShareCc(SimpleHoster): if m: self.info['error'] = m.group(1) self.wantReconnect = True - self.retry(wait_time=30 * 60, msg=m.group(0)) + self.retry(delay=30 * 60, msg=m.group(0)) m = re.search(self.ERROR_PATTERN, self.html) if m: @@ -61,7 +61,7 @@ class Keep2ShareCc(SimpleHoster): wait_time = sum(a * b for a, b in zip(ftr, map(int, m.group(1).split(':')))) self.wantReconnect = True - self.retry(wait_time=wait_time, msg="Please wait to download this file") + self.retry(delay=wait_time, msg="Please wait to download this file") self.info.pop('error', None) diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index e93b60460..22d5c654a 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -35,7 +35,7 @@ def get_info(urls): class LetitbitNet(SimpleHoster): __name__ = "LetitbitNet" __type__ = "hoster" - __version__ = "0.32" + __version__ = "0.33" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(letitbit|shareflare)\.net/download/.+' @@ -104,7 +104,7 @@ class LetitbitNet(SimpleHoster): if res == "error_free_download_blocked": self.log_warning(_("Daily limit reached")) - self.wait(seconds_to_midnight(gmt=2), True) + self.wait(seconds_to_midnight(), True) if res == "error_wrong_captcha": self.captcha.invalid() @@ -123,10 +123,9 @@ class LetitbitNet(SimpleHoster): def handle_premium(self, pyfile): - api_key = self.user - premium_key = self.account.get_info(self.user)['login']['password'] + premium_key = self.account.get_login('password') - json_data = [api_key, ["download/direct_links", {'pass': premium_key, 'link': pyfile.url}]] + json_data = [self.account.user, ["download/direct_links", {'pass': premium_key, 'link': pyfile.url}]] api_rep = self.load('http://api.letitbit.net/json', post={'r': json_dumps(json_data)}) self.log_debug("API Data: " + api_rep) api_rep = json_loads(api_rep) diff --git a/module/plugins/hoster/LinksnappyCom.py b/module/plugins/hoster/LinksnappyCom.py index 1c3f86d4a..f92681f60 100644 --- a/module/plugins/hoster/LinksnappyCom.py +++ b/module/plugins/hoster/LinksnappyCom.py @@ -10,7 +10,7 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class LinksnappyCom(MultiHoster): __name__ = "LinksnappyCom" __type__ = "hoster" - __version__ = "0.11" + __version__ = "0.12" __status__ = "testing" __pattern__ = r'https?://(?:[^/]+\.)?linksnappy\.com' @@ -26,8 +26,8 @@ class LinksnappyCom(MultiHoster): host = self._get_host(pyfile.url) json_params = json_dumps({'link' : pyfile.url, 'type' : host, - 'username': self.user, - 'password': self.account.get_info(self.user)['login']['password']}) + 'username': self.account.user, + 'password': self.account.get_login('password')}) r = self.load("http://linksnappy.com/api/linkgen", post={'genLinks': json_params}) diff --git a/module/plugins/hoster/LuckyShareNet.py b/module/plugins/hoster/LuckyShareNet.py index 5d9bf52c0..71cccb71a 100644 --- a/module/plugins/hoster/LuckyShareNet.py +++ b/module/plugins/hoster/LuckyShareNet.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class LuckyShareNet(SimpleHoster): __name__ = "LuckyShareNet" __type__ = "hoster" - __version__ = "0.09" + __version__ = "0.10" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?luckyshare\.net/(?P<ID>\d{10,})' @@ -32,7 +32,7 @@ class LuckyShareNet(SimpleHoster): if m: seconds = int(m.group(1)) self.log_debug("You have to wait %d seconds between free downloads" % seconds) - self.retry(wait_time=seconds) + self.retry(delay=seconds) else: self.error(_("Unable to detect wait time between free downloads")) elif 'Hash expired' in rep: diff --git a/module/plugins/hoster/MegaRapidCz.py b/module/plugins/hoster/MegaRapidCz.py index 4d6d0171a..c3cf8a2b6 100644 --- a/module/plugins/hoster/MegaRapidCz.py +++ b/module/plugins/hoster/MegaRapidCz.py @@ -22,7 +22,7 @@ def get_info(urls): class MegaRapidCz(SimpleHoster): __name__ = "MegaRapidCz" __type__ = "hoster" - __version__ = "0.58" + __version__ = "0.59" __status__ = "testing" __pattern__ = r'http://(?:www\.)?(share|mega)rapid\.cz/soubor/\d+/.+' @@ -58,8 +58,8 @@ class MegaRapidCz(SimpleHoster): self.link = m.group(1) else: if re.search(self.ERR_LOGIN_PATTERN, self.html): - self.relogin(self.user) - self.retry(wait_time=60, msg=_("User login failed")) + self.relogin() + self.retry(delay=60, msg=_("User login failed")) elif re.search(self.ERR_CREDIT_PATTERN, self.html): self.fail(_("Not enough credit left")) diff --git a/module/plugins/hoster/MegaRapidoNet.py b/module/plugins/hoster/MegaRapidoNet.py index 6676a565d..b00daf713 100644 --- a/module/plugins/hoster/MegaRapidoNet.py +++ b/module/plugins/hoster/MegaRapidoNet.py @@ -23,7 +23,7 @@ def random_with_n_digits(n): class MegaRapidoNet(MultiHoster): __name__ = "MegaRapidoNet" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.05" __status__ = "testing" __pattern__ = r'http://(?:www\.)?\w+\.megarapido\.net/\?file=\w+' @@ -47,7 +47,7 @@ class MegaRapidoNet(MultiHoster): 'links' : pyfile.url, 'exibir' : "normal", 'usar' : "premium", - 'user' : self.account.get_data(self.user).get('sid', None), + 'user' : self.account.get_data('sid'), 'autoreset': ""}) if "desloga e loga novamente para gerar seus links" in self.html.lower(): diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index 8b87dbd68..deee700ba 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class MegasharesCom(SimpleHoster): __name__ = "MegasharesCom" __type__ = "hoster" - __version__ = "0.30" + __version__ = "0.31" __status__ = "testing" __pattern__ = r'http://(?:www\.)?(d\d{2}\.)?megashares\.com/((index\.php)?\?d\d{2}=|dl/)\w+' @@ -46,7 +46,7 @@ class MegasharesCom(SimpleHoster): def handle_free(self, pyfile): if self.NO_SLOTS_PATTERN in self.html: - self.retry(wait_time=5 * 60) + self.retry(delay=5 * 60) m = re.search(self.REACTIVATE_PASSPORT_PATTERN, self.html) if m: @@ -82,7 +82,7 @@ class MegasharesCom(SimpleHoster): time = [int(x) for x in m.groups()] renew = time[0] + (time[1] * 60) + (time[2] * 60) self.log_debug("Waiting %d seconds for a new passport" % renew) - self.retry(wait_time=renew, msg=_("Passport renewal")) + self.retry(delay=renew, msg=_("Passport renewal")) #: Check traffic left on passport m = re.search(self.PASSPORT_LEFT_PATTERN, self.html, re.M | re.S) @@ -94,7 +94,7 @@ class MegasharesCom(SimpleHoster): self.log_info(_("Data left: %s %s (%d MB needed)") % (m.group(2), m.group(3), self.pyfile.size / 1048576)) if not data_left: - self.retry(wait_time=600, msg=_("Passport renewal")) + self.retry(delay=600, msg=_("Passport renewal")) self.handle_download(False) diff --git a/module/plugins/hoster/MultishareCz.py b/module/plugins/hoster/MultishareCz.py index 6b69fa9c2..1124dadce 100644 --- a/module/plugins/hoster/MultishareCz.py +++ b/module/plugins/hoster/MultishareCz.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class MultishareCz(SimpleHoster): __name__ = "MultishareCz" __type__ = "hoster" - __version__ = "0.42" + __version__ = "0.43" __status__ = "testing" __pattern__ = r'http://(?:www\.)?multishare\.cz/stahnout/(?P<ID>\d+)' @@ -42,7 +42,7 @@ class MultishareCz(SimpleHoster): self.check_info() - if not self.check_traffic_left(): + if not self.check_traffic(): self.fail(_("Not enough credit left to download file")) self.download("http://dl%d.mms.multishare.cz/html/mms_process.php" % round(random.random() * 10000 * random.random()), diff --git a/module/plugins/hoster/MyfastfileCom.py b/module/plugins/hoster/MyfastfileCom.py index bbd678ba0..ff28d5dfd 100644 --- a/module/plugins/hoster/MyfastfileCom.py +++ b/module/plugins/hoster/MyfastfileCom.py @@ -9,7 +9,7 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class MyfastfileCom(MultiHoster): __name__ = "MyfastfileCom" __type__ = "hoster" - __version__ = "0.10" + __version__ = "0.11" __status__ = "testing" __pattern__ = r'http://\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/dl/' @@ -27,7 +27,8 @@ class MyfastfileCom(MultiHoster): def handle_premium(self, pyfile): self.html = self.load('http://myfastfile.com/api.php', - get={'user': self.user, 'pass': self.account.get_info(self.user)['login']['password'], + get={'user': self.account.user, + 'pass': self.account.get_login('password'), 'link': pyfile.url}) self.log_debug("JSON data: " + self.html) diff --git a/module/plugins/hoster/NoPremiumPl.py b/module/plugins/hoster/NoPremiumPl.py index 9e2a5a93c..0826d5252 100644 --- a/module/plugins/hoster/NoPremiumPl.py +++ b/module/plugins/hoster/NoPremiumPl.py @@ -7,7 +7,7 @@ from module.plugins.internal.MultiHoster import MultiHoster class NoPremiumPl(MultiHoster): __name__ = "NoPremiumPl" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.05" __status__ = "testing" __pattern__ = r'https?://direct\.nopremium\.pl.+' @@ -39,7 +39,7 @@ class NoPremiumPl(MultiHoster): def prepare(self): super(NoPremiumPl, self).prepare() - data = self.account.get_data(self.user) + data = self.account.get_data() self.usr = data['usr'] self.pwd = data['pwd'] @@ -84,10 +84,8 @@ class NoPremiumPl(MultiHoster): 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: %s)") % parsed['errno'] - ) + self.fail(parsed['errstring'] or + _("Unknown error (code: %s)") % parsed['errno']) if "sdownload" in parsed: if parsed['sdownload'] == "1": diff --git a/module/plugins/hoster/NowDownloadSx.py b/module/plugins/hoster/NowDownloadSx.py index e03ec2789..5aadd0b3f 100644 --- a/module/plugins/hoster/NowDownloadSx.py +++ b/module/plugins/hoster/NowDownloadSx.py @@ -3,7 +3,6 @@ import re from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -from module.utils import fixup class NowDownloadSx(SimpleHoster): diff --git a/module/plugins/hoster/OboomCom.py b/module/plugins/hoster/OboomCom.py index 1ee342de5..d294ae3c6 100644 --- a/module/plugins/hoster/OboomCom.py +++ b/module/plugins/hoster/OboomCom.py @@ -13,7 +13,7 @@ from module.plugins.captcha.ReCaptcha import ReCaptcha class OboomCom(Hoster): __name__ = "OboomCom" __type__ = "hoster" - __version__ = "0.37" + __version__ = "0.38" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?oboom\.com/(?:#(?:id=|/)?)?(?P<ID>\w{8})' @@ -58,7 +58,7 @@ class OboomCom(Hoster): def get_session_token(self): if self.premium: - accountInfo = self.account.get_data(self.user, True) + accountInfo = self.account.get_data() if "session" in accountInfo: self.session_token = accountInfo['session'] else: @@ -141,6 +141,6 @@ class OboomCom(Hoster): self.download_domain = result[1] self.download_ticket = result[2] elif result[0] == 421: - self.retry(wait_time=result[2] + 60, msg=_("Connection limit exceeded")) + self.retry(delay=result[2] + 60, msg=_("Connection limit exceeded")) else: self.fail(_("Could not retrieve download ticket. Error code: %s") % result[0]) diff --git a/module/plugins/hoster/OpenloadIo.py b/module/plugins/hoster/OpenloadIo.py index f5d677bb2..1ebc12ad0 100644 --- a/module/plugins/hoster/OpenloadIo.py +++ b/module/plugins/hoster/OpenloadIo.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- + import json import re -from time import sleep -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo from module.network.RequestFactory import getURL +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class OpenloadIo(SimpleHoster): @@ -13,8 +13,7 @@ class OpenloadIo(SimpleHoster): __version__ = "0.06" __status__ = "testing" - _FILE_ID_PATTERN = '/f/([\w\-_]+)/?' - __pattern__ = r'https?://(?:www\.)?openload\.(?:co|io)' + _FILE_ID_PATTERN + __pattern__ = r'https?://(?:www\.)?openload\.(?:co|io)/f/([\w-_]+)' __description__ = """Openload.co hoster plugin""" __license__ = "GPLv3" @@ -22,15 +21,18 @@ class OpenloadIo(SimpleHoster): # The API reference, that this implementation uses is available at https://openload.co/api - _API_BASE_URL = 'https://api.openload.co/1' + API_URL = 'https://api.openload.co/1' - _DOWNLOAD_TICKET_URI_PATTERN = '/file/dlticket?file={0}' - _DOWNLOAD_FILE_URI_PATTERN = '/file/dl?file={0}&ticket={1}' - _FILE_INFO_URI_PATTERN = '/file/info?file={0}' + FILE_ID_PATTERN = '/f/([\w-_]+)' - def setup(self): - self.multiDL = True - self.chunk_limit = 1 + DOWNLOAD_TICKET_URI_PATTERN = '/file/dlticket?file={0}' + DOWNLOAD_FILE_URI_PATTERN = '/file/dl?file={0}&ticket={1}' + FILE_INFO_URI_PATTERN = '/file/info?file={0}' + + + @classmethod + def _load_json(cls, uri): + return json.loads(getURL(cls.API_URL + uri)) @classmethod @@ -42,10 +44,16 @@ class OpenloadIo(SimpleHoster): file_id = file_id[0] info_json = cls._load_json(cls._FILE_INFO_URI_PATTERN.format(file_id)) file_info = info_json['result'][file_id] - return {'name': file_info['name'], - 'size': file_info['size'], + + return {'name' : file_info['name'], + 'size' : file_info['size'], 'status': 3 if url.strip() else 8, - 'url': url} + 'url' : url} + + + def setup(self): + self.multiDL = True + self.chunk_limit = 1 def handle_free(self, pyfile): @@ -55,8 +63,7 @@ class OpenloadIo(SimpleHoster): ticket_json = self._load_json(self._DOWNLOAD_TICKET_URI_PATTERN.format(file_id)) - wait_time = ticket_json['result']['wait_time'] - sleep(wait_time + 0.1) + self.wait(ticket_json['result']['wait_time']) ticket = ticket_json['result']['ticket'] @@ -64,9 +71,4 @@ class OpenloadIo(SimpleHoster): self.link = download_json['result']['url'] - @classmethod - def _load_json(cls, uri): - return json.loads( - getURL(cls._API_BASE_URL + uri)) - getInfo = create_getInfo(OpenloadIo) diff --git a/module/plugins/hoster/OverLoadMe.py b/module/plugins/hoster/OverLoadMe.py index 0b5bab6a5..a2bbfc701 100644 --- a/module/plugins/hoster/OverLoadMe.py +++ b/module/plugins/hoster/OverLoadMe.py @@ -11,7 +11,7 @@ from module.utils import parseFileSize as parse_size class OverLoadMe(MultiHoster): __name__ = "OverLoadMe" __type__ = "hoster" - __version__ = "0.13" + __version__ = "0.14" __status__ = "testing" __pattern__ = r'https?://.*overload\.me/.+' @@ -28,7 +28,7 @@ class OverLoadMe(MultiHoster): def handle_premium(self, pyfile): - data = self.account.get_data(self.user) + data = self.account.get_data() page = self.load("https://api.over-load.me/getdownload.php", get={'auth': data['password'], 'link': pyfile.url}) diff --git a/module/plugins/hoster/PremiumTo.py b/module/plugins/hoster/PremiumTo.py index ec02bb12d..8186c6224 100644 --- a/module/plugins/hoster/PremiumTo.py +++ b/module/plugins/hoster/PremiumTo.py @@ -11,7 +11,7 @@ from module.utils import fs_encode class PremiumTo(MultiHoster): __name__ = "PremiumTo" __type__ = "hoster" - __version__ = "0.25" + __version__ = "0.26" __status__ = "testing" __pattern__ = r'^unmatchable$' @@ -37,8 +37,8 @@ class PremiumTo(MultiHoster): disposition=True) - def check_file(self): - if self.check_download({'nopremium': "No premium account available"}): + def check_download(self): + if self.check_file({'nopremium': "No premium account available"}): self.retry(60, 5 * 60, "No premium account available") err = "" @@ -52,7 +52,7 @@ class PremiumTo(MultiHoster): if err: self.fail(err) - return super(PremiumTo, self).check_file() + return super(PremiumTo, self).check_download() getInfo = create_getInfo(PremiumTo) diff --git a/module/plugins/hoster/QuickshareCz.py b/module/plugins/hoster/QuickshareCz.py index 4311a82aa..2baef4c6d 100644 --- a/module/plugins/hoster/QuickshareCz.py +++ b/module/plugins/hoster/QuickshareCz.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class QuickshareCz(SimpleHoster): __name__ = "QuickshareCz" __type__ = "hoster" - __version__ = "0.57" + __version__ = "0.58" __status__ = "testing" __pattern__ = r'http://(?:[^/]*\.)?quickshare\.cz/stahnout-soubor/.+' @@ -39,7 +39,7 @@ class QuickshareCz(SimpleHoster): if 'UU_prihlasen' in self.jsvars: if self.jsvars['UU_prihlasen'] == "0": self.log_warning(_("User not logged in")) - self.relogin(self.user) + self.relogin() self.retry() elif float(self.jsvars['UU_kredit']) < float(self.jsvars['kredit_odecet']): self.log_warning(_("Not enough credit left")) @@ -50,7 +50,7 @@ class QuickshareCz(SimpleHoster): else: self.handle_free(pyfile) - if self.check_download({'error': re.compile(r"\AChyba!")}, max_size=100): + if self.check_file({'error': re.compile(r"\AChyba!")}, max_size=100): self.fail(_("File not m or plugin defect")) diff --git a/module/plugins/hoster/RPNetBiz.py b/module/plugins/hoster/RPNetBiz.py index 62e6bee4e..5207832ee 100644 --- a/module/plugins/hoster/RPNetBiz.py +++ b/module/plugins/hoster/RPNetBiz.py @@ -44,10 +44,10 @@ class RPNetBiz(MultiHoster): self.wait(30) #: Wait for 30 seconds #: Lets query the server again asking for the status on the link, #: We need to keep doing this until we reach 100 - max_tries = 30 + attemps = 30 my_try = 0 - while (my_try <= max_tries): - self.log_debug("Try: %d ; Max Tries: %d" % (my_try, max_tries)) + while (my_try <= attemps): + self.log_debug("Try: %d ; Max Tries: %d" % (my_try, attemps)) res = self.load("https://premium.rpnet.biz/client_api.php", get={'username': user, 'password': info['login']['password'], @@ -66,7 +66,7 @@ class RPNetBiz(MultiHoster): self.wait(30) my_try += 1 - if my_try > max_tries: #: We went over the limit! + if my_try > attemps: #: We went over the limit! self.fail(_("Waited for about 15 minutes for download to finish but failed")) if 'generated' in link_status: diff --git a/module/plugins/hoster/RapideoPl.py b/module/plugins/hoster/RapideoPl.py index e1a0d278f..a43440e61 100644 --- a/module/plugins/hoster/RapideoPl.py +++ b/module/plugins/hoster/RapideoPl.py @@ -7,7 +7,7 @@ from module.plugins.internal.MultiHoster import MultiHoster class RapideoPl(MultiHoster): __name__ = "RapideoPl" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.05" __status__ = "testing" __pattern__ = r'^unmatchable$' @@ -39,7 +39,7 @@ class RapideoPl(MultiHoster): def prepare(self): super(RapideoPl, self).prepare() - data = self.account.get_data(self.user) + data = self.account.get_data() self.usr = data['usr'] self.pwd = data['pwd'] @@ -84,10 +84,8 @@ class RapideoPl(MultiHoster): 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: %s)") % parsed['errno'] - ) + self.fail(parsed['errstring'] or + _("Unknown error (code: %s)") % parsed['errno']) if "sdownload" in parsed: if parsed['sdownload'] == "1": diff --git a/module/plugins/hoster/RapidgatorNet.py b/module/plugins/hoster/RapidgatorNet.py index 636ea1bcc..3f2003034 100644 --- a/module/plugins/hoster/RapidgatorNet.py +++ b/module/plugins/hoster/RapidgatorNet.py @@ -14,7 +14,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class RapidgatorNet(SimpleHoster): __name__ = "RapidgatorNet" __type__ = "hoster" - __version__ = "0.35" + __version__ = "0.36" __status__ = "testing" __pattern__ = r'http://(?:www\.)?(rapidgator\.net|rg\.to)/file/\w+' @@ -51,7 +51,7 @@ class RapidgatorNet(SimpleHoster): def setup(self): if self.account: - self.sid = self.account.get_data(self.user).get('sid', None) + self.sid = self.account.get_data('sid') else: self.sid = None @@ -81,12 +81,12 @@ class RapidgatorNet(SimpleHoster): return json['response'] elif status == 423: - self.account.empty(self.user) + self.account.empty() self.retry() else: - self.account.relogin(self.user) - self.retry(wait_time=60) + self.account.relogin() + self.retry(delay=60) def handle_premium(self, pyfile): diff --git a/module/plugins/hoster/RehostTo.py b/module/plugins/hoster/RehostTo.py index 6f0645e9f..af8ba3fd9 100644 --- a/module/plugins/hoster/RehostTo.py +++ b/module/plugins/hoster/RehostTo.py @@ -8,7 +8,7 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class RehostTo(MultiHoster): __name__ = "RehostTo" __type__ = "hoster" - __version__ = "0.23" + __version__ = "0.24" __status__ = "testing" __pattern__ = r'https?://.*rehost\.to\..+' @@ -23,7 +23,7 @@ class RehostTo(MultiHoster): def handle_premium(self, pyfile): self.download("http://rehost.to/process_download.php", get={'user': "cookie", - 'pass': self.account.get_data(self.user)['session'], + 'pass': self.account.get_data('session'), 'dl' : pyfile.url}, disposition=True) diff --git a/module/plugins/hoster/Share4WebCom.py b/module/plugins/hoster/Share4WebCom.py index 3f128be5e..898e12927 100644 --- a/module/plugins/hoster/Share4WebCom.py +++ b/module/plugins/hoster/Share4WebCom.py @@ -7,7 +7,7 @@ from module.plugins.internal.SimpleHoster import create_getInfo class Share4WebCom(UnibytesCom): __name__ = "Share4WebCom" __type__ = "hoster" - __version__ = "0.12" + __version__ = "0.13" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?share4web\.com/get/\w+' @@ -17,7 +17,7 @@ class Share4WebCom(UnibytesCom): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - HOSTER_DOMAIN = "share4web.com" + PLUGIN_DOMAIN = "share4web.com" getInfo = create_getInfo(Share4WebCom) diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index bba4bf6ad..56177f97a 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -12,7 +12,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class ShareonlineBiz(SimpleHoster): __name__ = "ShareonlineBiz" __type__ = "hoster" - __version__ = "0.56" + __version__ = "0.57" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(share-online\.biz|egoshare\.com)/(download\.php\?id=|dl/)(?P<ID>\w+)' @@ -105,8 +105,8 @@ class ShareonlineBiz(SimpleHoster): self.wait() - def check_file(self): - check = self.check_download({'cookie': re.compile(r'<div id="dl_failure"'), + def check_download(self): + check = self.check_file({'cookie': re.compile(r'<div id="dl_failure"'), 'fail' : re.compile(r"<title>Share-Online")}) if check == "cookie": @@ -117,13 +117,13 @@ class ShareonlineBiz(SimpleHoster): self.captcha.invalid() self.retry(5, 5 * 60, _("Download failed")) - return super(ShareonlineBiz, self).check_file() + return super(ShareonlineBiz, self).check_download() def handle_premium(self, pyfile): #: Should be working better loading (account) api internally html = self.load("https://api.share-online.biz/account.php", - get={'username': self.user, - 'password': self.account.get_info(self.user)['login']['password'], + get={'username': self.account.user, + 'password': self.account.get_login('password'), 'act' : "download", 'lid' : self.info['fileid']}) @@ -170,7 +170,7 @@ class ShareonlineBiz(SimpleHoster): self.fail(_("Premium account needed")) elif errmsg in ("expired", "server"): - self.retry(wait_time=600, msg=errmsg) + self.retry(delay=600, msg=errmsg) elif errmsg == "full": self.retry(10, 600, _("Server is full")) @@ -181,7 +181,7 @@ class ShareonlineBiz(SimpleHoster): else: self.wantReconnect = True - self.retry(wait_time=60, msg=errmsg) + self.retry(delay=60, msg=errmsg) getInfo = create_getInfo(ShareonlineBiz) diff --git a/module/plugins/hoster/SimplyPremiumCom.py b/module/plugins/hoster/SimplyPremiumCom.py index be9b89f24..01b21079d 100644 --- a/module/plugins/hoster/SimplyPremiumCom.py +++ b/module/plugins/hoster/SimplyPremiumCom.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import seconds_to_midnight class SimplyPremiumCom(MultiHoster): __name__ = "SimplyPremiumCom" __type__ = "hoster" - __version__ = "0.11" + __version__ = "0.12" __status__ = "testing" __pattern__ = r'https?://.+simply-premium\.com' @@ -28,7 +28,7 @@ class SimplyPremiumCom(MultiHoster): def check_errors(self): if '<valid>0</valid>' 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.account.relogin() self.retry() elif "NOTFOUND" in self.html: @@ -40,7 +40,7 @@ class SimplyPremiumCom(MultiHoster): elif "trafficlimit" in self.html: self.log_warning(_("Reached daily limit for this host")) - self.retry(wait_time=seconds_to_midnight(gmt=2), msg="Daily limit for this host reached") + self.retry(delay=seconds_to_midnight(), msg="Daily limit for this host reached") elif "hostererror" in self.html: self.log_warning(_("Hoster temporarily unavailable, waiting 1 minute and retry")) diff --git a/module/plugins/hoster/SimplydebridCom.py b/module/plugins/hoster/SimplydebridCom.py index 829609228..d26439d68 100644 --- a/module/plugins/hoster/SimplydebridCom.py +++ b/module/plugins/hoster/SimplydebridCom.py @@ -8,7 +8,7 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo, rep class SimplydebridCom(MultiHoster): __name__ = "SimplydebridCom" __type__ = "hoster" - __version__ = "0.20" + __version__ = "0.21" __status__ = "testing" __pattern__ = r'http://\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/sd\.php' @@ -41,11 +41,11 @@ class SimplydebridCom(MultiHoster): self.wait(5) - def check_file(self): - if self.check_download({'error': "No address associated with hostname"}): + def check_download(self): + if self.check_file({'error': "No address associated with hostname"}): self.retry(24, 3 * 60, _("Bad file downloaded")) - return super(SimplydebridCom, self).check_file() + return super(SimplydebridCom, self).check_download() getInfo = create_getInfo(SimplydebridCom) diff --git a/module/plugins/hoster/SmoozedCom.py b/module/plugins/hoster/SmoozedCom.py index 33d098a00..67e590cec 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.08" + __version__ = "0.09" __status__ = "testing" __pattern__ = r'^unmatchable$' #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.activate @@ -36,7 +36,7 @@ class SmoozedCom(MultiHoster): pyfile.name = ".".join(temp) #: Check the link - get_data = {'session_key': self.account.get_data(self.user)['session'], + get_data = {'session_key': self.account.get_data('session'), 'url' : pyfile.url} data = json_loads(self.load("http://www2.smoozed.com/api/check", get=get_data)) diff --git a/module/plugins/hoster/UlozTo.py b/module/plugins/hoster/UlozTo.py index ab96f65a1..ba9ac390e 100644 --- a/module/plugins/hoster/UlozTo.py +++ b/module/plugins/hoster/UlozTo.py @@ -15,7 +15,7 @@ def convert_decimal_prefix(m): class UlozTo(SimpleHoster): __name__ = "UlozTo" __type__ = "hoster" - __version__ = "1.15" + __version__ = "1.16" __status__ = "testing" __pattern__ = r'http://(?:www\.)?(uloz\.to|ulozto\.(cz|sk|net)|bagruj\.cz|zachowajto\.pl)/(?:live/)?(?P<ID>\w+/[^/?]*)' @@ -120,8 +120,8 @@ class UlozTo(SimpleHoster): return super(UlozTo, self).check_errors() - def check_file(self): - check = self.check_download({ + def check_download(self): + check = self.check_file({ 'wrong_captcha': ">An error ocurred while verifying the user", 'offline' : re.compile(self.OFFLINE_PATTERN), 'passwd' : self.PASSWD_PATTERN, @@ -148,7 +148,7 @@ class UlozTo(SimpleHoster): elif check == "not_found": self.fail(_("Server error, file not downloadable")) - return super(UlozTo, self).check_file() + return super(UlozTo, self).check_download() getInfo = create_getInfo(UlozTo) diff --git a/module/plugins/hoster/UnibytesCom.py b/module/plugins/hoster/UnibytesCom.py index d4b7d6dd4..b82c04ad1 100644 --- a/module/plugins/hoster/UnibytesCom.py +++ b/module/plugins/hoster/UnibytesCom.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UnibytesCom(SimpleHoster): __name__ = "UnibytesCom" __type__ = "hoster" - __version__ = "0.14" + __version__ = "0.15" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?unibytes\.com/[\w .-]{11}B' @@ -21,7 +21,7 @@ class UnibytesCom(SimpleHoster): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - HOSTER_DOMAIN = "unibytes.com" + PLUGIN_DOMAIN = "unibytes.com" INFO_PATTERN = r'<span[^>]*?id="fileName".*?>(?P<N>[^>]+)</span>\s*\((?P<S>\d.*?)\)' @@ -30,7 +30,7 @@ class UnibytesCom(SimpleHoster): def handle_free(self, pyfile): - domain = "http://www.%s/" % self.HOSTER_DOMAIN + domain = "http://www.%s/" % self.PLUGIN_DOMAIN action, post_data = self.parse_html_form('id="startForm"') self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 0) diff --git a/module/plugins/hoster/UpleaCom.py b/module/plugins/hoster/UpleaCom.py index db9517f42..15d47dec5 100644 --- a/module/plugins/hoster/UpleaCom.py +++ b/module/plugins/hoster/UpleaCom.py @@ -9,7 +9,7 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class UpleaCom(XFSHoster): __name__ = "UpleaCom" __type__ = "hoster" - __version__ = "0.12" + __version__ = "0.13" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?uplea\.com/dl/\w{15}' @@ -20,7 +20,7 @@ class UpleaCom(XFSHoster): ("GammaC0de", None)] - HOSTER_DOMAIN = "uplea.com" + PLUGIN_DOMAIN = "uplea.com" SIZE_REPLACEMENTS = [('ko','KB'), ('mo','MB'), ('go','GB'), ('Ko','KB'), ('Mo','MB'), ('Go','GB')] diff --git a/module/plugins/hoster/UploadableCh.py b/module/plugins/hoster/UploadableCh.py index 88d79e9ba..a3d54e8ef 100644 --- a/module/plugins/hoster/UploadableCh.py +++ b/module/plugins/hoster/UploadableCh.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UploadableCh(SimpleHoster): __name__ = "UploadableCh" __type__ = "hoster" - __version__ = "0.12" + __version__ = "0.13" __status__ = "testing" __pattern__ = r'http://(?:www\.)?uploadable\.ch/file/(?P<ID>\w+)' @@ -65,13 +65,13 @@ class UploadableCh(SimpleHoster): self.download(pyfile.url, post={'download': "normal"}, disposition=True) - def check_file(self): - if self.check_download({'wait': re.compile("Please wait for")}): + def check_download(self): + if self.check_file({'wait': re.compile("Please wait for")}): self.log_info(_("Downloadlimit reached, please wait or reconnect")) self.wait(60 * 60, True) self.retry() - return super(UploadableCh, self).check_file() + return super(UploadableCh, self).check_download() getInfo = create_getInfo(UploadableCh) diff --git a/module/plugins/hoster/WebshareCz.py b/module/plugins/hoster/WebshareCz.py index 0a89363f8..0009cc471 100644 --- a/module/plugins/hoster/WebshareCz.py +++ b/module/plugins/hoster/WebshareCz.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class WebshareCz(SimpleHoster): __name__ = "WebshareCz" __type__ = "hoster" - __version__ = "0.19" + __version__ = "0.20" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(en\.)?webshare\.cz/(?:#/)?file/(?P<ID>\w+)' @@ -41,7 +41,7 @@ class WebshareCz(SimpleHoster): def handle_free(self, pyfile): - wst = self.account.get_data(self.user).get('wst', None) if self.account else None + wst = self.account.get_data('wst') if self.account else None api_data = get_url("https://webshare.cz/api/file_link/", post={'ident': self.info['pattern']['ID'], 'wst': wst}) diff --git a/module/plugins/hoster/XFileSharingPro.py b/module/plugins/hoster/XFileSharingPro.py index 8ede709de..c7d8a7761 100644 --- a/module/plugins/hoster/XFileSharingPro.py +++ b/module/plugins/hoster/XFileSharingPro.py @@ -8,7 +8,7 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class XFileSharingPro(XFSHoster): __name__ = "XFileSharingPro" __type__ = "hoster" - __version__ = "0.53" + __version__ = "0.54" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(?:\w+\.)*?(?P<DOMAIN>(?:[\d.]+|[\w\-^_]{3,}(?:\.[a-zA-Z]{2,}){1,2})(?:\:\d+)?)/(?:embed-)?\w{12}(?:\W|$)' @@ -24,25 +24,25 @@ class XFileSharingPro(XFSHoster): def _log(self, level, plugintype, pluginname, messages): return super(XFileSharingPro, self)._log(level, plugintype, - "%s: %s" % (pluginname, self.HOSTER_NAME), + "%s: %s" % (pluginname, self.PLUGIN_NAME), messages) def init(self): self.__pattern__ = self.pyload.pluginManager.hosterPlugins[self.__name__]['pattern'] - self.HOSTER_DOMAIN = re.match(self.__pattern__, self.pyfile.url).group("DOMAIN").lower() - self.HOSTER_NAME = "".join(part.capitalize() for part in re.split(r'(\.|\d+|\-)', self.HOSTER_DOMAIN) if part != '.') + self.PLUGIN_DOMAIN = re.match(self.__pattern__, self.pyfile.url).group("DOMAIN").lower() + self.PLUGIN_NAME = "".join(part.capitalize() for part in re.split(r'(\.|\d+|\-)', self.PLUGIN_DOMAIN) if part != '.') def _setup(self): - account_name = self.__name__ if self.account.HOSTER_DOMAIN is None else self.HOSTER_NAME + account_name = self.__name__ if self.account.PLUGIN_DOMAIN is None else self.PLUGIN_NAME self.chunk_limit = 1 self.multiDL = True if self.account: - self.req = self.pyload.requestFactory.getRequest(accountname, self.user) - self.premium = self.account.is_premium(self.user) + self.req = self.pyload.requestFactory.getRequest(accountname, self.account.user) + self.premium = self.account.premium self.resume_download = self.premium else: self.req = self.pyload.requestFactory.getRequest(account_name) @@ -55,19 +55,19 @@ class XFileSharingPro(XFSHoster): self.req.close() if not self.account: - self.account = self.pyload.accountManager.getAccountPlugin(self.HOSTER_NAME) + self.account = self.pyload.accountManager.getAccountPlugin(self.PLUGIN_NAME) if not self.account: self.account = self.pyload.accountManager.getAccountPlugin(self.__name__) if self.account: - if not self.account.HOSTER_DOMAIN: - self.account.HOSTER_DOMAIN = self.HOSTER_DOMAIN + if not self.account.PLUGIN_DOMAIN: + self.account.PLUGIN_DOMAIN = self.PLUGIN_DOMAIN - if not self.user: - self.user = self.account.select()[0] + if not self.account.user: #@TODO: Move to `Account` in 0.4.10 + self.account.user = self.account.select()[0] - if not self.user or not self.account.is_logged(self.user, True): + if not self.account.logged: self.account = False diff --git a/module/plugins/hoster/ZeveraCom.py b/module/plugins/hoster/ZeveraCom.py index 47286fca1..9f3fea189 100644 --- a/module/plugins/hoster/ZeveraCom.py +++ b/module/plugins/hoster/ZeveraCom.py @@ -8,7 +8,7 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class ZeveraCom(MultiHoster): __name__ = "ZeveraCom" __type__ = "hoster" - __version__ = "0.32" + __version__ = "0.33" __status__ = "testing" __pattern__ = r'https?://(?:www\.)zevera\.com/(getFiles\.ashx|Members/download\.ashx)\?.*ourl=.+' @@ -25,7 +25,7 @@ class ZeveraCom(MultiHoster): def handle_premium(self, pyfile): - self.link = "https://%s/getFiles.ashx?ourl=%s" % (self.account.HOSTER_DOMAIN, pyfile.url) + self.link = "https://%s/getFiles.ashx?ourl=%s" % (self.account.PLUGIN_DOMAIN, pyfile.url) getInfo = create_getInfo(ZeveraCom) diff --git a/module/plugins/internal/Account.py b/module/plugins/internal/Account.py index de338cd33..196589e85 100644 --- a/module/plugins/internal/Account.py +++ b/module/plugins/internal/Account.py @@ -1,11 +1,10 @@ # -*- coding: utf-8 -*- -import copy import random import time import threading -import traceback +from module.plugins.Plugin import SkipDownload as Skip from module.plugins.internal.Plugin import Plugin from module.utils import compare_time, lock, parseFileSize as parse_size @@ -13,7 +12,7 @@ from module.utils import compare_time, lock, parseFileSize as parse_size class Account(Plugin): __name__ = "Account" __type__ = "account" - __version__ = "0.18" + __version__ = "0.52" __status__ = "testing" __description__ = """Base account plugin""" @@ -21,18 +20,23 @@ class Account(Plugin): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - LOGIN_TIMEOUT = 10 * 60 #: After that time (in minutes) pyload will relogin the account - INFO_THRESHOLD = 30 * 60 #: After that time (in minutes) account data will be reloaded + LOGIN_TIMEOUT = 10 * 60 #: Relogin accounts every 10 minutes + AUTO_TIMEOUT = True #: Automatically adjust relogin interval def __init__(self, manager, accounts): self._init(manager.core) - self.lock = threading.RLock() - self.accounts = accounts #@TODO: Remove in 0.4.10 + self.manager = manager + self.lock = threading.RLock() + + self.accounts = accounts #@TODO: Recheck in 0.4.10 + self.user = None + + self.interval = self.LOGIN_TIMEOUT + self.auto_timeout = self.interval if self.AUTO_TIMEOUT else False self.init() - self.init_accounts(accounts) def init(self): @@ -42,218 +46,172 @@ class Account(Plugin): pass - def login(self, user, password, data, req): + @property + def logged(self): """ - Login into account, the cookies will be saved so user can be recognized + Checks if user is still logged in """ - pass - - - @lock - def _login(self, user): - try: - info = self.info[user] - info['login']['timestamp'] = time.time() #: Set timestamp for login - - self.req = self.get_request(user) - self.login(user, info['login']['password'], info['data'], self.req) - - except Exception, e: - self.log_warning(_("Could not login user `%s`") % user, e) - res = info['login']['valid'] = False - self.accounts[user]['valid'] = False #@TODO: Remove in 0.4.10 + if not self.user: + return False - if self.pyload.debug: - traceback.print_exc() + self.sync() + if self.info['login']['timestamp'] + self.interval < time.time(): + self.log_debug("Reached login timeout for user `%s`" % self.user) + return False else: - res = info['login']['valid'] = True - self.accounts[user]['valid'] = True #@TODO: Remove in 0.4.10 - - finally: - self.clean() - return res + return True - def relogin(self, user): - self.log_info(_("Relogin user `%s`...") % user) + @property + def premium(self): + return bool(self.get_data('premium')) - req = self.get_request(user) - if req: - req.clearCookies() - self.clean() - return self._login(user) + def signin(self, user, password, data): + """ + Login into account, the cookies will be saved so user can be recognized + """ + pass - #@TODO: Rewrite in 0.4.10 - def init_accounts(self, accounts): - for user, data in accounts.items(): - self.add(user, data['password'], data['options']) + def login(self): + if not self.req: + self.log_info(_("Login user `%s`...") % self.user) + else: + self.log_info(_("Relogin user `%s`...") % self.user) + self.clean() + self.req = self.pyload.requestFactory.getRequest(self.__name__, self.user) - @lock - def add(self, user, password=None, options={}): - if user not in self.info: - self.info[user] = {'login': {'valid' : None, - 'password' : password or "", - 'timestamp': 0}, - 'data' : {'options' : options, - 'premium' : None, - 'validuntil' : None, - 'trafficleft': None, - 'maxtraffic' : None}} - - #@TODO: Remove in 0.4.10 - self.accounts[user] = self.info[user]['data'] - self.accounts[user].update({'login' : user, - 'type' : self.__name__, - 'valid' : self.info[user]['login']['valid'], - 'password': self.info[user]['login']['password']}) - - self.log_info(_("Login user `%s`...") % user) - self._login(user) - return True + self.sync() - else: - self.log_error(_("Error adding user `%s`") % user, _("User already exists")) + try: + self.info['login']['timestamp'] = time.time() #: Set timestamp for login + self.signin(self.user, self.info['login']['password'], self.info['data']) + except Skip: + self.info['login']['valid'] = True + if self.auto_timeout: + self.auto_timeout *= 2 + self.interval = self.auto_timeout - @lock - def update(self, user, password=None, options={}): - """ - Updates account and return true if anything changed - """ - if not (password or options): - return - - if user not in self.info: - return self.add(user, password, options) + except Exception, e: + self.log_error(_("Could not login user `%s`") % user, e) + self.info['login']['valid'] = False else: - if password: - self.info[user]['login']['password'] = password - self.accounts[user]['password'] = password #@TODO: Remove in 0.4.10 - self.relogin(user) + self.info['login']['valid'] = True + if self.interval is self.auto_timeout: + self.interval = self.auto_timeout / 2 + self.auto_timeout = False - if options: - before = self.info[user]['data']['options'] - self.info[user]['data']['options'].update(options) - return self.info[user]['data']['options'] != before + finally: + self.syncback() + return bool(self.info['login']['valid']) - return True + #@TODO: Recheck in 0.4.10 + def syncback(self): + return self.sync(reverse=True) - #: Deprecated method, use `update` instead (Remove in 0.4.10) - def updateAccounts(self, *args, **kwargs): - return self.update(*args, **kwargs) + #@TODO: Recheck in 0.4.10 + def sync(self, reverse=False): + if not self.user: + return - def remove(self, user=None): # -> def remove - if not user: - self.info.clear() - self.accounts.clear() #@TODO: Remove in 0.4.10 + u = self.accounts[self.user] - elif user in self.info: - self.info.pop(user, None) - self.accounts.pop(user, None) #@TODO: Remove in 0.4.10 + if reverse: + u.update(self.info['data']) + u.update(self.info['login']) + else: + d = {'login': {'password' : u['password'], + 'timestamp': u['timestamp'], + 'valid' : u['valid']}, + 'data' : {'maxtraffic' : u['maxtraffic'], + 'options' : u['options'], + 'premium' : u['premium'], + 'trafficleft': u['trafficleft'], + 'validuntil' : u['validuntil']}} - #: Deprecated method, use `remove` instead (Remove in 0.4.10) - def removeAccount(self, *args, **kwargs): - return self.remove(*args, **kwargs) + self.info.update(d) - #@NOTE: Remove in 0.4.10? - def get_data(self, user, reload=False): - if not user: - return + def relogin(self): + return self.login() - info = self.get_info(user, reload) - if info and 'data' in info: - return info['data'] + def reset(self): + self.sync() - #: Deprecated method, use `get_data` instead (Remove in 0.4.10) - def getAccountData(self, *args, **kwargs): - if 'force' in kwargs: - kwargs['reload'] = kwargs['force'] - kwargs.pop('force', None) + d = {'maxtraffic' : None, + 'options' : {'limitdl': ['0']}, + 'premium' : None, + 'trafficleft': None, + 'validuntil' : None} - data = self.get_data(*args, **kwargs) or {} - if 'options' not in data: - data['options'] = {'limitdl': ['0']} + self.info['data'].update(d) - return data + self.syncback() - def get_info(self, user, reload=False): + def get_info(self, refresh=True): """ - Retrieve account infos for an user, do **not** overwrite this method!\\ + Retrieve account infos for an user, do **not** overwrite this method! just use it to retrieve infos in hoster plugins. see `grab_info` :param user: username - :param reload: reloads cached account information + :param relogin: reloads cached account information :return: dictionary with information """ - if user not in self.info: - self.log_error(_("User `%s` not found while retrieving account info") % user) - return - - elif reload: - self.log_info(_("Parsing account info for user `%s`...") % user) - info = self._parse_info(user) - - safe_info = copy.deepcopy(info) - safe_info['login']['password'] = "**********" - safe_info['data']['password'] = "**********" #@TODO: Remove in 0.4.10 - self.log_debug("Account info for user `%s`: %s" % (user, safe_info)) + if not self.logged: + if self.relogin(): + refresh = True + else: + refresh = False + self.reset() - elif self.INFO_THRESHOLD > 0 and self.info[user]['login']['timestamp'] + self.INFO_THRESHOLD < time.time(): - self.log_debug("Reached data timeout for %s" % user) - info = self.get_info(user, True) + if refresh: + self.log_info(_("Grabbing account info for user `%s`...") % self.user) + self.info = self._grab_info() - else: - info = self.info[user] + self.syncback() - return info + safe_info = dict(self.info) + safe_info['login']['password'] = "**********" + self.log_debug("Account info for user `%s`: %s" % (self.user, safe_info)) + return self.info - def is_premium(self, user): - if not user: - return False - info = self.get_info(user) - return info['data']['premium'] + def get_login(self, key=None, default=None): + d = self.get_info()['login'] + return d.get(key, default) if key else d - def _parse_info(self, user): - info = self.info[user] + def get_data(self, key=None, default=None): + d = self.get_info()['data'] + return d.get(key, default) if key else d - if not info['login']['valid']: - return info + def _grab_info(self): try: - self.req = self.get_request(user) - extra_info = self.grab_info(user, info['login']['password'], info, self.req) + data = self.grab_info(self.user, self.info['login']['password'], self.info['data']) - if extra_info and isinstance(extra_info, dict): - info['data'].update(extra_info) + if data and isinstance(data, dict): + self.info['data'].update(data) - except (Fail, Exception), e: - self.log_warning(_("Error loading info for user `%s`") % user, e) - - if self.pyload.debug: - traceback.print_exc() + except Exception, e: + self.log_warning(_("Error loading info for user `%s`") % self.user, e) finally: - self.clean() - - self.info[user].update(info) - return info + return self.info - def grab_info(self, user, password, info, req): + def grab_info(self, user, password, data): """ This should be overwritten in account plugin and retrieving account information for user @@ -265,43 +223,104 @@ class Account(Plugin): pass - #: Remove in 0.4.10 - def getAllAccounts(self, *args, **kwargs): - return [self.getAccountData(user, *args, **kwargs) for user, info in self.info.items()] + ########################################################################### + #@TODO: Recheck and move to `AccountManager` in 0.4.10 #################### + ########################################################################### + @lock + def init_accounts(self): + accounts = dict(self.accounts) + self.accounts.clear() - def fail_login(self, msg=_("Login handshake has failed")): - return self.fail(msg) + for user, info in accounts.items(): + self.add(user, info['password'], info['options']) - def get_request(self, user=None): - if not user: - user, info = self.select() + @lock + def getAccountData(self, user, force=False): + self.accounts[user]['plugin'].get_info() + return self.accounts[user] - return self.pyload.requestFactory.getRequest(self.__name__, user) + @lock + def getAllAccounts(self, force=False): + if force: + self.init_accounts() #@TODO: Recheck in 0.4.10 - def get_cookies(self, user=None): - if not user: - user, info = self.select() + return [self.getAccountData(user, force) for user in self.accounts] - return self.pyload.requestFactory.getCookieJar(self.__name__, user) + #@TODO: Remove in 0.4.10 + @lock + def scheduleRefresh(self, user, force=False): + pass - def select(self): + + @lock + def add(self, user, password=None, options={}): + self.log_info(_("Adding user `%s`...") % user) + + if user in self.accounts: + self.log_error(_("Error adding user `%s`") % user, _("User already exists")) + return False + + d = {'login' : user, + 'maxtraffic' : None, + 'options' : options or {'limitdl': ['0']}, + 'password' : password or "", + 'plugin' : self.__class__(self.manager, self.accounts), + 'premium' : None, + 'timestamp' : 0, + 'trafficleft': None, + 'type' : self.__name__, + 'valid' : None, + 'validuntil' : None} + + u = self.accounts[user] = d + return u['plugin'].choose(user) + + + @lock + def updateAccounts(self, user, password=None, options={}): """ - Returns a valid account name and info + Updates account and return true if anything changed """ + if user in self.accounts: + self.log_info(_("Updating account info for user `%s`...") % user) + + u = self.accounts[user] + if password: + u['password'] = password + + if options: + u['options'].update(options) + + u['plugin'].relogin() + + else: + self.add(user, password, options) + + + @lock + def removeAccount(self, user): + self.accounts.pop(user, None) + if user is self.user: + self.choose() + + + @lock + def select(self): free_accounts = {} premium_accounts = {} - for user, info in self.info.items(): + for user in self.accounts: + info = self.accounts[user]['plugin'].get_info() + data = info['data'] + if not info['login']['valid']: continue - data = info['data'] - - if "time" in data['options'] and data['options']['time']: + if data['options'].get('time'): time_data = "" try: time_data = data['options']['time'][0] @@ -311,7 +330,8 @@ class Account(Plugin): continue except Exception: - self.log_warning(_("Wrong time format `%s` for account `%s`, use 1:22-3:44") % (user, time_data)) + self.log_warning(_("Wrong time format `%s` for account `%s`, use 1:22-3:44") + % (user, time_data)) if data['trafficleft'] == 0: continue @@ -330,68 +350,56 @@ class Account(Plugin): if not account_list: return None, None - validuntil_list = [(user, info) for user, info in account_list if info['data']['validuntil']] + validuntil_list = [(user, info) for user, info in account_list \ + if info['data']['validuntil']] if not validuntil_list: - return random.choice(account_list) #@TODO: Random account?! Recheck in 0.4.10 + return random.choice(account_list) #@TODO: Random account?! Rewrite in 0.4.10 return sorted(validuntil_list, key=lambda a: a[1]['data']['validuntil'], reverse=True)[0] - def parse_traffic(self, value, unit=None): #: Return kilobytes - if not unit and not isinstance(value, basestring): - unit = "KB" - - return parse_size(value, unit) - + @lock + def choose(self, user=None): + """ + Choose a valid account + """ + if not user: + user = self.select()[0] - def empty(self, user): - if user not in self.info: - return + elif user not in self.accounts: + self.log_error(_("Error choosing user `%s`") % user, _("User not exists")) + return False - self.log_warning(_("Account `%s` has not enough traffic") % user, _("Checking again in 30 minutes")) + if user is self.user: + return True - self.info[user]['data']['trafficleft'] = 0 - self.schedule_refresh(user, 30 * 60) + self.user = user + self.info.clear() + self.clean() + if self.user is not None: + self.login() + return True - def expired(self, user): - if user not in self.info: - return + else: + return False - self.log_warning(_("Account `%s` is expired") % user, _("Checking again in 60 minutes")) - self.info[user]['data']['validuntil'] = time.time() - 1 - self.schedule_refresh(user, 60 * 60) + ########################################################################### + def parse_traffic(self, value, unit=None): #@NOTE: Returns kilobytes in 0.4.9 + if not isinstance(unit, basestring): + unit = "KB" - def schedule_refresh(self, user, time=0): - """ - Add task to refresh account info to sheduler - """ - self.log_debug("Scheduled refresh for user `%s` in %s seconds" % (user, time)) - self.pyload.scheduler.addJob(time, self.get_info, [user, True]) + return parse_size(value, unit) / 1024 #@TODO: Remove `/ 1024` in 0.4.10 - #: Deprecated method, use `schedule_refresh` instead (Remove in 0.4.10) - def scheduleRefresh(self, *args, **kwargs): - if 'force' in kwargs: - kwargs.pop('force', None) #@TODO: Recheck in 0.4.10 - return self.schedule_refresh(*args, **kwargs) + def fail_login(self, msg=_("Login handshake has failed")): + return self.fail(msg) - @lock - def is_logged(self, user, relogin=False): - """ - Checks if user is still logged in - """ - if user in self.info: - if self.LOGIN_TIMEOUT > 0 and self.info[user]['login']['timestamp'] + self.LOGIN_TIMEOUT < time.time(): - self.log_debug("Reached login timeout for %s" % user) - return self.relogin(user) if relogin else False - else: - return True - else: - return False + def skip_login(self, msg=_("Already signed in")): + return self.skip(msg) diff --git a/module/plugins/internal/Addon.py b/module/plugins/internal/Addon.py index 5150e88f6..3a252fdfb 100644 --- a/module/plugins/internal/Addon.py +++ b/module/plugins/internal/Addon.py @@ -26,7 +26,6 @@ class Addon(Plugin): __version__ = "0.06" __status__ = "testing" - __config__ = [] #: [("name", "type", "desc", "default")] __threaded__ = [] #@TODO: Remove in 0.4.10 __description__ = """Base addon plugin""" diff --git a/module/plugins/internal/Container.py b/module/plugins/internal/Container.py index 430590421..2300c4cab 100644 --- a/module/plugins/internal/Container.py +++ b/module/plugins/internal/Container.py @@ -17,11 +17,11 @@ class Container(Crypter): __status__ = "testing" __pattern__ = r'^unmatchable$' - __config__ = [] #: [("name", "type", "desc", "default")] __description__ = """Base container decrypter plugin""" __license__ = "GPLv3" - __authors__ = [("mkaay", "mkaay@mkaay.de")] + __authors__ = [("mkaay" , "mkaay@mkaay.de" ), + ("Walter Purcaro", "vuolter@gmail.com")] def process(self, pyfile): diff --git a/module/plugins/internal/Crypter.py b/module/plugins/internal/Crypter.py index 2033b67df..ad5bcc74e 100644 --- a/module/plugins/internal/Crypter.py +++ b/module/plugins/internal/Crypter.py @@ -7,7 +7,7 @@ from module.utils import save_path as safe_filename class Crypter(Hoster): __name__ = "Crypter" __type__ = "crypter" - __version__ = "0.08" + __version__ = "0.09" __status__ = "testing" __pattern__ = r'^unmatchable$' @@ -83,7 +83,7 @@ class Crypter(Hoster): self.pyload.api.setPackageData(pid, {'password': package_password}) #: Workaround to do not break API addPackage method - set_folder = lambda x: self.pyload.api.setPackageData(pid, {'folder': safe_filename(x) or ""}) + set_folder = lambda x="": self.pyload.api.setPackageData(pid, {'folder': safe_filename(x)}) if use_subfolder: if not subfolder_per_package: @@ -98,4 +98,4 @@ class Crypter(Hoster): self.log_debug("Set package %(name)s folder to: %(folder)s" % {'name': name, 'folder': folder}) elif folder_per_package: - set_folder(None) + set_folder() diff --git a/module/plugins/internal/Extractor.py b/module/plugins/internal/Extractor.py index f21fe473c..3ab5d6a0d 100644 --- a/module/plugins/internal/Extractor.py +++ b/module/plugins/internal/Extractor.py @@ -5,6 +5,7 @@ import re from module.PyFile import PyFile from module.plugins.internal.Plugin import Plugin +from module.utils import fs_encode class ArchiveError(Exception): @@ -22,7 +23,7 @@ class PasswordError(Exception): class Extractor(Plugin): __name__ = "Extractor" __type__ = "extractor" - __version__ = "0.34" + __version__ = "0.35" __status__ = "testing" __description__ = """Base extractor plugin""" diff --git a/module/plugins/internal/Hook.py b/module/plugins/internal/Hook.py index 1f566f824..8ae731a7f 100644 --- a/module/plugins/internal/Hook.py +++ b/module/plugins/internal/Hook.py @@ -9,8 +9,6 @@ class Hook(Addon): __version__ = "0.13" __status__ = "testing" - __config__ = [] #: [("name", "type", "desc", "default")] - __description__ = """Base hook plugin""" __license__ = "GPLv3" __authors__ = [("mkaay" , "mkaay@mkaay.de" ), diff --git a/module/plugins/internal/Hoster.py b/module/plugins/internal/Hoster.py index 5d0a64f1a..bc340e78f 100644 --- a/module/plugins/internal/Hoster.py +++ b/module/plugins/internal/Hoster.py @@ -11,8 +11,8 @@ import urlparse from module.plugins.internal.Captcha import Captcha from module.plugins.internal.Plugin import (Plugin, Abort, Fail, Reconnect, Retry, Skip, - chunks, decode, encode, exists, parse_html_form, - parse_html_tag_attr_value, parse_name, + chunks, decode, encode, exists, fixurl, + parse_html_form, parse_html_tag_attr_value, parse_name, replace_patterns, seconds_to_midnight, set_cookie, set_cookies, timestamp) from module.utils import fs_decode, fs_encode, save_join as fs_join, save_path as safe_filename @@ -41,21 +41,27 @@ def create_getInfo(klass): return get_info +#@NOTE: `check_abort` decorator +def check_abort(fn): + + def wrapper(self, *args, **kwargs): + self.check_abort() + return fn(self, *args, **kwargs) + + return wrapper + + class Hoster(Plugin): __name__ = "Hoster" __type__ = "hoster" - __version__ = "0.28" + __version__ = "0.31" __status__ = "testing" __pattern__ = r'^unmatchable$' - __config__ = [] #: [("name", "type", "desc", "default")] __description__ = """Base hoster plugin""" __license__ = "GPLv3" - __authors__ = [("RaNaN" , "RaNaN@pyload.org" ), - ("spoob" , "spoob@pyload.org" ), - ("mkaay" , "mkaay@mkaay.de" ), - ("Walter Purcaro", "vuolter@gmail.com")] + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] def __init__(self, pyfile): @@ -74,7 +80,7 @@ class Hoster(Plugin): #: Account handler instance, see :py:class:`Account` self.account = None - self.req = None #: Browser instance, see `network.Browser` + self.user = None #@TODO: Remove in 0.4.10 #: Associated pyfile instance, see `PyFile` self.pyfile = pyfile @@ -98,7 +104,7 @@ class Hoster(Plugin): #: Dict of the amount of retries already made self.retries = {} - self.retry_free = False #@TODO: Recheck in 0.4.10 + self.force_free = False #@TODO: Recheck in 0.4.10 self._setup() self.init() @@ -116,9 +122,10 @@ class Hoster(Plugin): @classmethod def get_info(cls, url="", html=""): + url = fixurl(url, unquote=True) return {'name' : parse_name(url), 'size' : 0, - 'status': 3 if url.strip() else 8, + 'status': 3 if url else 8, 'url' : url} @@ -142,6 +149,11 @@ class Hoster(Plugin): self.last_download = "" self.pyfile.error = "" + try: + self.req.close() + except Exception: + pass + if self.account: self.req = self.pyload.requestFactory.getRequest(self.__name__, self.account.user) self.chunk_limit = -1 #: -1 for unlimited @@ -162,16 +174,16 @@ class Hoster(Plugin): """ self.thread = thread - if self.retry_free: + if self.force_free: self.account = False else: self.load_account() #@TODO: Move to PluginThread in 0.4.10 - self.retry_free = False + self.force_free = False self._setup() + # self.pyload.hookManager.downloadPreparing(self.pyfile) #@TODO: Recheck in 0.4.10 self.pyfile.setStatus("starting") - self.pyload.hookManager.downloadPreparing(self.pyfile) #@TODO: Recheck in 0.4.10 self.check_abort() @@ -185,17 +197,17 @@ class Hoster(Plugin): def load_account(self): - if self.req: - self.req.close() - if not self.account: self.account = self.pyload.accountManager.getAccountPlugin(self.__name__) - if self.account: - if not hasattr(self.account, 'user'): #@TODO: Move to `Account` in 0.4.10 - self.account.user = self.account.select()[0] + if not self.account: + self.account = False + self.user = None #@TODO: Remove in 0.4.10 - if not hasattr(self.account, 'logged'): + else: + self.account.choose() + self.user = self.account.user #@TODO: Remove in 0.4.10 + if self.account.user is None: self.account = False @@ -207,12 +219,8 @@ class Hoster(Plugin): def set_reconnect(self, reconnect): - if reconnect: - self.log_info(_("Requesting line reconnection...")) - else: - self.log_debug("Reconnect: %s" % reconnect) - - self.log_debug("Previous wantReconnect: %s" % self.wantReconnect) + self.log_debug("RECONNECT %s required" % ("" if reconnect else "not"), + "Previous wantReconnect: %s" % self.wantReconnect) self.wantReconnect = bool(reconnect) @@ -226,8 +234,8 @@ class Hoster(Plugin): wait_time = max(int(seconds), 1) wait_until = time.time() + wait_time + 1 - self.log_info(_("Waiting %d seconds...") % wait_time) - self.log_debug("Previous waitUntil: %f" % self.pyfile.waitUntil) + self.log_debug("WAIT set to %d seconds" % wait_time, + "Previous waitUntil: %f" % self.pyfile.waitUntil) self.pyfile.waitUntil = wait_until @@ -249,13 +257,17 @@ class Hoster(Plugin): self.waiting = True - status = pyfile.status #@NOTE: Remove in 0.4.10 + status = pyfile.status #@NOTE: Recheck in 0.4.10 pyfile.setStatus("waiting") - if not self.wantReconnect or self.account: + self.log_info(_("Waiting %d seconds...") % pyfile.waitUntil - time.time()) + + if self.wantReconnect: + self.log_info(_("Requiring reconnection...")) if self.account: self.log_warning("Ignore reconnection due logged account") + if not self.wantReconnect or self.account: while pyfile.waitUntil > time.time(): self.check_abort() time.sleep(2) @@ -263,24 +275,24 @@ class Hoster(Plugin): else: while pyfile.waitUntil > time.time(): self.check_abort() + self.thread.m.reconnecting.wait(1) if self.thread.m.reconnecting.isSet(): self.waiting = False self.wantReconnect = False raise Reconnect - self.thread.m.reconnecting.wait(2) time.sleep(2) self.waiting = False - pyfile.status = status #@NOTE: Remove in 0.4.10 + pyfile.status = status #@NOTE: Recheck in 0.4.10 def skip(self, msg=""): """ Skip and give msg """ - raise Skip(encode(msg or self.pyfile.error)) #@TODO: Remove `encode` in 0.4.10 + raise Skip(encode(msg or self.pyfile.error or self.pyfile.pluginname)) #@TODO: Remove `encode` in 0.4.10 #@TODO: Remove in 0.4.10 @@ -293,7 +305,7 @@ class Hoster(Plugin): if msg: self.pyfile.error = msg else: - msg = self.pyfile.error + msg = self.pyfile.error or (self.info['error'] if 'error' in self.info else self.pyfile.getStatusName()) raise Fail(encode(msg)) #@TODO: Remove `encode` in 0.4.10 @@ -359,30 +371,33 @@ class Hoster(Plugin): if nopremium: if self.premium: - self.retry_free = True + self.force_free = True else: self.fail("%s | %s" % (msg, _("Download was already free"))) raise Retry(encode(msg)) #@TODO: Remove `encode` in 0.4.10 - def fixurl(self, url, baseurl=None): + def fixurl(self, url, baseurl=None, unquote=None): + url = fixurl(url) + if not baseurl: - baseurl = self.pyfile.url + baseurl = fixurl(self.pyfile.url) if not urlparse.urlparse(url).scheme: url_p = urlparse.urlparse(baseurl) baseurl = "%s://%s" % (url_p.scheme, url_p.netloc) url = urlparse.urljoin(baseurl, url) - return url + return fixurl(url, unquote) + @check_abort def load(self, *args, **kwargs): - self.check_abort() return super(Hoster, self).load(*args, **kwargs) + @check_abort def download(self, url, get={}, post={}, ref=True, cookies=True, disposition=True): """ Downloads the content at url to download folder @@ -396,16 +411,18 @@ class Hoster(Plugin): the filename will be changed if needed :return: The location where the file was saved """ - self.check_abort() - if self.pyload.debug: self.log_debug("DOWNLOAD URL " + url, - *["%s=%s" % (key, val) for key, val in locals().items() if key not in ("self", "url")]) + *["%s=%s" % (key, val) for key, val in locals().items() if key not in ("self", "url", "_[1]")]) + + url = self.fixurl(url, unquote=True) self.pyfile.name = parse_name(self.pyfile.name) #: Safe check self.captcha.correct() - self.check_for_same_files() + + if self.pyload.config.get("download", "skip_existing"): + self.check_filedupe() self.pyfile.setStatus("downloading") @@ -441,7 +458,9 @@ class Hoster(Plugin): if finalname != newname: try: - os.rename(fs_join(location, newname), fs_join(location, finalname)) + oldname_enc = fs_join(download_location, newname) + newname_enc = fs_join(download_location, finalname) + os.rename(oldname_enc, newname_enc) except OSError, e: self.log_warning(_("Error renaming `%s` to `%s`") % (newname, finalname), e) @@ -463,16 +482,16 @@ class Hoster(Plugin): if not self.pyfile.abort: return - if self.pyfile.hasStatus("failed"): + if self.pyfile.status is 8: self.fail() - elif self.pyfile.hasStatus("skipped"): + elif self.pyfile.status is 4: self.skip(self.pyfile.statusname) - elif self.pyfile.hasStatus("offline"): + elif self.pyfile.status is 1: self.offline() - elif self.pyfile.hasStatus("temp. offline"): + elif self.pyfile.status is 6: self.temp_offline() else: @@ -489,7 +508,8 @@ class Hoster(Plugin): if not self.last_download: return - download_size = os.stat(fs_encode(self.last_download)).st_size + download_location = fs_encode(self.last_download) + download_size = os.stat(download_location).st_size if download_size < 1: self.fail(_("Empty file")) @@ -505,7 +525,7 @@ class Hoster(Plugin): self.log_warning(_("File size is not equal to expected size")) - def check_download(self, rules, delete=False, read_size=1048576, file_size=0, size_tolerance=1024): + def check_file(self, rules, delete=False, read_size=1048576, file_size=0, size_tolerance=1024): """ Checks the content of the last downloaded file, re match is saved to `last_check` @@ -552,7 +572,66 @@ class Hoster(Plugin): else: self.log_info(_("File deleted: ") + self.last_download) - self.last_download = "" + self.last_download = "" #: Recheck in 0.4.10 + + + def check_traffic(self): + if not self.account: + return True + + traffic = self.account.get_data(refresh=True)['trafficleft'] + + if traffic is None: + return False + + elif traffic is -1: + return True + + else: + size = self.pyfile.size / 1024 #@TODO: Remove in 0.4.10 + self.log_info(_("Filesize: %s KiB, Traffic left for user %s: %s KiB") % (size, self.account.user, traffic)) #@TODO: Rewrite in 0.4.10 + return size <= traffic + + + def check_filedupe(self): + """ + Checks if same file was/is downloaded within same package + + :param starting: indicates that the current download is going to start + :raises Skip: + """ + pack = self.pyfile.package() + + for pyfile in self.pyload.files.cache.values(): + if pyfile is self.pyfile: + continue + + if pyfile.name != self.pyfile.name or pyfile.package().folder != pack.folder: + continue + + if pyfile.status in (0, 5, 7, 12): #: (finished, waiting, starting, downloading) + self.skip(pyfile.pluginname) + + download_folder = self.pyload.config.get("general", "download_folder") + package_folder = pack.folder if self.pyload.config.get("general", "folder_per_package") else "" + download_location = fs_join(download_folder, package_folder, self.pyfile.name) + + if not exists(download_location): + return + + pyfile = self.pyload.db.findDuplicates(self.pyfile.id, package_folder, self.pyfile.name) + if pyfile: + self.skip(pyfile[0]) + + size = os.stat(download_location).st_size + if size >= self.pyfile.size: + self.skip(_("File exists")) + + + #: Deprecated method, use `check_filedupe` instead (Remove in 0.4.10) + def checkForSameFiles(self, *args, **kwargs): + if self.pyload.config.get("download", "skip_existing"): + return self.check_filedupe() def direct_link(self, url, follow_location=None): @@ -598,10 +677,10 @@ class Hoster(Plugin): if 'content-disposition' in header: link = url - elif 'location' in header and header['location']: + elif header.get('location'): location = self.fixurl(header['location'], url) - if 'code' in header and header['code'] == 302: + if header.get('code') == 302: link = location if follow_location: @@ -611,7 +690,7 @@ class Hoster(Plugin): else: extension = os.path.splitext(parse_name(url))[-1] - if 'content-type' in header and header['content-type']: + if header.get('content-type'): mimetype = header['content-type'].split(';')[0].strip() elif extension: @@ -641,63 +720,8 @@ class Hoster(Plugin): return parse_html_form(attr_str, self.html, input_names) - def check_traffic_left(self): - if not self.account: - return True - - traffic = self.account.get_data(self.account.user, True)['trafficleft'] - - if traffic is None: - return False - - elif traffic == -1: - return True - - else: - size = self.pyfile.size / 1024 - self.log_info(_("Filesize: %s KiB, Traffic left for user %s: %s KiB") % (size, self.account.user, traffic)) - return size <= traffic - - def get_password(self): """ Get the password the user provided in the package """ return self.pyfile.package().password or "" - - - #: Deprecated method, use `check_for_same_files` instead (Remove in 0.4.10) - def checkForSameFiles(self, *args, **kwargs): - return self.check_for_same_files(*args, **kwargs) - - - def check_for_same_files(self, starting=False): - """ - Checks if same file was/is downloaded within same package - - :param starting: indicates that the current download is going to start - :raises Skip: - """ - pack = self.pyfile.package() - - for pyfile in self.pyload.files.cache.values(): - if pyfile != self.pyfile and pyfile.name is self.pyfile.name and pyfile.package().folder is pack.folder: - if pyfile.status in (0, 12): #: Finished or downloading - self.skip(pyfile.pluginname) - elif pyfile.status in (5, 7) and starting: #: A download is waiting/starting and was appenrently started before - self.skip(pyfile.pluginname) - - download_folder = self.pyload.config.get("general", "download_folder") - location = fs_join(download_folder, pack.folder, self.pyfile.name) - - if starting and self.pyload.config.get("download", "skip_existing") and exists(location): - size = os.stat(location).st_size - if size >= self.pyfile.size: - self.skip("File exists") - - pyfile = self.pyload.db.findDuplicates(self.pyfile.id, self.pyfile.package().folder, self.pyfile.name) - if pyfile: - if exists(location): - self.skip(pyfile[0]) - - self.log_debug("File %s not skipped, because it does not exists." % self.pyfile.name) diff --git a/module/plugins/internal/MultiHook.py b/module/plugins/internal/MultiAccount.py index 42a1985b5..b38670ce7 100644 --- a/module/plugins/internal/MultiHook.py +++ b/module/plugins/internal/MultiAccount.py @@ -2,30 +2,29 @@ import re import time -import traceback -from module.plugins.internal.Hook import Hook +from module.plugins.internal.Account import Account from module.utils import decode, remove_chars -class MultiHook(Hook): - __name__ = "MultiHook" - __type__ = "hook" - __version__ = "0.54" +class MultiAccount(Account): + __name__ = "MultiAccount" + __type__ = "account" + __version__ = "0.02" __status__ = "testing" - __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 )] + __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__ = """Hook plugin for multi hoster/crypter""" + __description__ = """Multi hoster account plugin""" __license__ = "GPLv3" __authors__ = [("pyLoad Team" , "admin@pyload.org" ), ("Walter Purcaro", "vuolter@gmail.com")] - MIN_RELOAD_INTERVAL = 1 * 60 * 60 #: 1 hour + REFRESH_INTERVAL = 1 * 60 * 60 #: 1 hour DOMAIN_REPLACEMENTS = [(r'180upload\.com' , "hundredeightyupload.com"), (r'bayfiles\.net' , "bayfiles.com" ), @@ -55,6 +54,34 @@ class MultiHook(Hook): (r'^0' , "zero" )] + + + + + + + + + + + + + + + + + + + + + + + + + + + + def init(self): self.plugins = [] self.supported = [] @@ -102,7 +129,7 @@ class MultiHook(Hook): for _i in xrange(5): try: - pluginset = self._plugin_set(self.get_hosters()) + pluginset = self._plugin_set(self.grab_hosters()) break except Exception, e: @@ -110,7 +137,7 @@ class MultiHook(Hook): time.sleep(60) else: self.log_error(_("No hoster list retrieved")) - self.interval = self.MIN_RELOAD_INTERVAL + self.interval = self.REFRESH_INTERVAL return list() try: @@ -144,7 +171,7 @@ class MultiHook(Hook): return set(plugins) - def get_hosters(self): + def grab_hosters(self, user, password, data): """ Load list of supported hoster @@ -160,7 +187,7 @@ class MultiHook(Hook): self.load_account() if self.get_config('reload', True): - self.interval = max(self.get_config('reloadinterval', 12) * 60 * 60, self.MIN_RELOAD_INTERVAL) + self.interval = max(self.get_config('reloadinterval', 12) * 60 * 60, self.REFRESH_INTERVAL) else: self.pyload.scheduler.removeJob(self.cb) self.cb = None diff --git a/module/plugins/internal/MultiCrypter.py b/module/plugins/internal/MultiCrypter.py index ca7b03941..ae8785116 100644 --- a/module/plugins/internal/MultiCrypter.py +++ b/module/plugins/internal/MultiCrypter.py @@ -6,7 +6,7 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter class MultiCrypter(SimpleCrypter): __name__ = "MultiCrypter" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" __status__ = "testing" __pattern__ = r'^unmatchable$' @@ -19,7 +19,7 @@ class MultiCrypter(SimpleCrypter): def init(self): - self.CRYPTER_NAME = self.pyload.pluginManager.crypterPlugins[self.__name__]['name'] + self.PLUGIN_NAME = self.pyload.pluginManager.crypterPlugins[self.__name__]['name'] def _log(self, level, plugintype, pluginname, messages): diff --git a/module/plugins/internal/MultiHoster.py b/module/plugins/internal/MultiHoster.py index c0c928a45..fbfab1ade 100644 --- a/module/plugins/internal/MultiHoster.py +++ b/module/plugins/internal/MultiHoster.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, r class MultiHoster(SimpleHoster): __name__ = "MultiHoster" __type__ = "hoster" - __version__ = "0.50" + __version__ = "0.51" __status__ = "testing" __pattern__ = r'^unmatchable$' @@ -21,21 +21,21 @@ class MultiHoster(SimpleHoster): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_NAME = None + PLUGIN_NAME = None LEECH_HOSTER = False LOGIN_ACCOUNT = True def init(self): - self.HOSTER_NAME = self.pyload.pluginManager.hosterPlugins[self.__name__]['name'] + self.PLUGIN_NAME = self.pyload.pluginManager.hosterPlugins[self.__name__]['name'] def _log(self, level, plugintype, pluginname, messages): return super(MultiHoster, self)._log(level, plugintype, pluginname, - (self.HOSTER_NAME,) + messages) + (self.PLUGIN_NAME,) + messages) def setup(self): @@ -83,11 +83,11 @@ class MultiHoster(SimpleHoster): self.check_errors() self.check_status(getinfo=False) - if self.premium and (not self.CHECK_TRAFFIC or self.check_traffic_left()): + if self.premium and (not self.CHECK_TRAFFIC or self.check_traffic()): self.log_info(_("Processing as premium download...")) self.handle_premium(pyfile) - elif not self.LOGIN_ACCOUNT or (not self.CHECK_TRAFFIC or self.check_traffic_left()): + elif not self.LOGIN_ACCOUNT or (not self.CHECK_TRAFFIC or self.check_traffic()): self.log_info(_("Processing as free download...")) self.handle_free(pyfile) @@ -95,7 +95,7 @@ class MultiHoster(SimpleHoster): self.log_info(_("Downloading file...")) self.download(self.link, disposition=self.DISPOSITION) - self.check_file() + self.check_download() except Fail, e: #@TODO: Move to PluginThread in 0.4.10 if self.premium: diff --git a/module/plugins/internal/Plugin.py b/module/plugins/internal/Plugin.py index 51192d8c9..6f3e52962 100644 --- a/module/plugins/internal/Plugin.py +++ b/module/plugins/internal/Plugin.py @@ -6,7 +6,6 @@ import datetime import inspect import os import re -import sys import traceback import urllib import urlparse @@ -28,6 +27,11 @@ def decode(string, encoding='utf8'): return unicode(string) +#@TODO: Remove in 0.4.10 +def _decode(*args, **kwargs): + return decode(*args, **kwargs) + + #@TODO: Move to utils in 0.4.10 def encode(string, encoding='utf8'): """ Decode string to utf8 """ @@ -49,18 +53,25 @@ def exists(path): return False -#@TODO: Move to utils in 0.4.10 -def parse_name(url): - url = urllib.unquote(url) - url = url.decode('unicode-escape') - url = html_unescape(url) - url = urllib.quote(url) +#@TODO: Recheck in 0.4.10 +def fixurl(url, unquote=None): + newurl = urllib.unquote(url) + + if unquote is None: + unquote = newurl == url + + newurl = html_unescape(newurl.decode('unicode-escape')).strip() - url_p = urlparse.urlparse(url.strip().rstrip('/')) + return newurl if unquote else urllib.quote(newurl) - name = (url_p.path.split('/')[-1] or - url_p.query.split('=', 1)[::-1][0].split('&', 1)[0] or - url_p.netloc.split('.', 1)[0]) + +#@TODO: Recheck in 0.4.10 +def parse_name(string): + path = fixurl(decode(string), unquote=False) + url_p = urlparse.urlparse(path.rstrip('/')) + name = (url_p.path.split('/')[-1] or + url_p.query.split('=', 1)[::-1][0].split('&', 1)[0] or + url_p.netloc.split('.', 1)[0]) return urllib.unquote(name) @@ -96,7 +107,7 @@ def seconds_to_midnight(utc=None): else: now = datetime.datetime.utcnow() + datetime.timedelta(hours=utc) - midnight = now.replace(hour=0, minute=10, second=0, microsecond=0) + datetime.timedelta(days=1) + midnight = now.replace(hour=0, minute=1, second=0, microsecond=0) + datetime.timedelta(days=1) return (midnight - now).seconds @@ -173,7 +184,7 @@ def chunks(iterable, size): class Plugin(object): __name__ = "Plugin" __type__ = "plugin" - __version__ = "0.37" + __version__ = "0.38" __status__ = "testing" __pattern__ = r'^unmatchable$' @@ -181,10 +192,7 @@ class Plugin(object): __description__ = """Base plugin""" __license__ = "GPLv3" - __authors__ = [("RaNaN" , "RaNaN@pyload.org" ), - ("spoob" , "spoob@pyload.org" ), - ("mkaay" , "mkaay@mkaay.de" ), - ("Walter Purcaro", "vuolter@gmail.com")] + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] def __init__(self, core): @@ -199,8 +207,8 @@ class Plugin(object): def _init(self, core): self.pyload = core - self.info = {} #: Provide information in dict here - self.req = None + self.info = {} #: Provide information in dict here + self.req = None #: Browser instance, see `network.Browser` def init(self): @@ -231,8 +239,6 @@ class Plugin(object): def log_warning(self, *args): self._log("warning", self.__type__, self.__name__, args) - if self.pyload.debug: - traceback.print_exc() def log_error(self, *args): @@ -278,7 +284,7 @@ class Plugin(object): return min(self.pyload.config.get("download", "chunks"), self.chunk_limit) - def set_config(self, option, value): + def set_config(self, option, value, plugin=None): """ Set config value for current plugin @@ -286,7 +292,7 @@ class Plugin(object): :param value: :return: """ - self.pyload.config.setPlugin(self.__name__, option, value) + self.pyload.config.setPlugin(plugin or self.__name__, option, value) def get_config(self, option, default="", plugin=None): @@ -347,7 +353,9 @@ class Plugin(object): """ if self.pyload.debug: self.log_debug("LOAD URL " + url, - *["%s=%s" % (key, val) for key, val in locals().items() if key not in ("self", "url")]) + *["%s=%s" % (key, val) for key, val in locals().items() if key not in ("self", "url", "_[1]")]) + + url = fixurl(url, unquote=True) #: Recheck in 0.4.10 if req is None: req = self.req or self.pyload.requestFactory.getRequest(self.__name__) @@ -364,7 +372,7 @@ class Plugin(object): #@TODO: Move to network in 0.4.10 if isinstance(decode, basestring): - res = sys.modules[self.__name__].decode(res, decode) #@TODO: See #1787, use utils.decode() in 0.4.10 + res = _decode(res, decode) #@NOTE: Use `utils.decode()` in 0.4.10 if self.pyload.debug: frame = inspect.currentframe() @@ -409,11 +417,12 @@ class Plugin(object): Clean everything and remove references """ try: + self.req.clearCookies() self.req.close() except Exception: pass - for a in ("pyfile", "thread", "html", "req"): - if hasattr(self, a): - setattr(self, a, None) + for attr in ("account", "html", "pyfile", "req", "thread"): + if hasattr(self, attr): + setattr(self, attr, None) diff --git a/module/plugins/internal/SevenZip.py b/module/plugins/internal/SevenZip.py index b79256536..7ed64ecdf 100644 --- a/module/plugins/internal/SevenZip.py +++ b/module/plugins/internal/SevenZip.py @@ -5,18 +5,18 @@ import re import subprocess from module.plugins.internal.UnRar import ArchiveError, CRCError, PasswordError, UnRar, renice -from module.utils import fs_encode, save_join as fs_join +from module.utils import save_join as fs_join class SevenZip(UnRar): __name__ = "SevenZip" - __version__ = "0.15" + __version__ = "0.16" __status__ = "testing" __description__ = """7-Zip extractor plugin""" __license__ = "GPLv3" - __authors__ = [("Michael Nowak" , "" ), - ("Walter Purcaro", "vuolter@gmail.com")] + __authors__ = [("Walter Purcaro", "vuolter@gmail.com"), + ("Michael Nowak" , None )] CMD = "7z" @@ -128,7 +128,7 @@ class SevenZip(UnRar): args.append("-y") #: Set a password - if "password" in kwargs and kwargs['password']: + if kwargs.get('password'): args.append("-p%s" % kwargs['password']) else: args.append("-p-") diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py index 8c5d3599d..53d69b2a5 100644 --- a/module/plugins/internal/SimpleCrypter.py +++ b/module/plugins/internal/SimpleCrypter.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, r class SimpleCrypter(Crypter, SimpleHoster): __name__ = "SimpleCrypter" __type__ = "crypter" - __version__ = "0.62" + __version__ = "0.63" __status__ = "testing" __pattern__ = r'^unmatchable$' @@ -81,7 +81,7 @@ class SimpleCrypter(Crypter, SimpleHoster): self.log_debug("Redirect #%d to: %s" % (i, redirect)) header = self.load(redirect, just_header=True) - if 'location' in header and header['location']: + if header.get('location'): self.link = header['location'] else: break @@ -137,7 +137,7 @@ class SimpleCrypter(Crypter, SimpleHoster): try: pages = int(re.search(self.PAGES_PATTERN, self.html).group(1)) - except AttributeError: + except (AttributeError, IndexError, ValueError): pages = 1 for p in xrange(2, pages + 1): diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 0f030e000..00b63ac12 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -6,7 +6,6 @@ import os import re import time -from module.PyFile import statusMap as _statusMap from module.network.HTTPRequest import BadHeader from module.network.RequestFactory import getURL as get_url from module.plugins.internal.Hoster import Hoster, create_getInfo, parse_fileInfo @@ -14,14 +13,10 @@ from module.plugins.internal.Plugin import Fail, encode, parse_name, replace_pat from module.utils import fixup, fs_encode, parseFileSize as parse_size -#@TODO: Adapt and move to PyFile in 0.4.10 -statusMap = dict((v, k) for k, v in _statusMap.items()) - - class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "1.86" + __version__ = "1.87" __status__ = "testing" __pattern__ = r'^unmatchable$' @@ -124,7 +119,7 @@ class SimpleHoster(Hoster): try: info['pattern'] = re.match(cls.__pattern__, url).groupdict() #: Pattern groups will be saved here - except AttributeError: + except (AttributeError, IndexError): info['pattern'] = {} if not html and not online: @@ -164,7 +159,7 @@ class SimpleHoster(Hoster): if all(True for k in pdict if k not in info['pattern']): info['pattern'].update(pdict) - except AttributeError: + except (AttributeError, IndexError): continue else: @@ -275,11 +270,11 @@ class SimpleHoster(Hoster): if 'status' not in self.info or self.info['status'] is 3: #@TODO: Recheck in 0.4.10 self.check_info() - if self.premium and (not self.CHECK_TRAFFIC or self.check_traffic_left()): + if self.premium and (not self.CHECK_TRAFFIC or self.check_traffic()): self.log_info(_("Processing as premium download...")) self.handle_premium(pyfile) - elif not self.LOGIN_ACCOUNT or (not self.CHECK_TRAFFIC or self.check_traffic_left()): + elif not self.LOGIN_ACCOUNT or (not self.CHECK_TRAFFIC or self.check_traffic()): self.log_info(_("Processing as free download...")) self.handle_free(pyfile) @@ -287,7 +282,7 @@ class SimpleHoster(Hoster): self.log_info(_("Downloading file...")) self.download(self.link, disposition=self.DISPOSITION) - self.check_file() + self.check_download() except Fail, e: #@TODO: Move to PluginThread in 0.4.10 if self.get_config('premium_fallback', True) and self.premium: @@ -298,26 +293,26 @@ class SimpleHoster(Hoster): raise Fail(encode(e)) #@TODO: Remove `encode` in 0.4.10 - def check_file(self): - self.log_info(_("Checking file...")) + def check_download(self): + self.log_info(_("Checking downloaded file...")) if self.captcha.task and not self.last_download: self.captcha.invalid() self.retry(10, msg=_("Wrong captcha")) - elif self.check_download({'Empty file': re.compile(r'\A((.|)(\2|\s)*)\Z')}, + elif self.check_file({'Empty file': re.compile(r'\A((.|)(\2|\s)*)\Z')}, delete=True): self.error(_("Empty file")) else: - if self.get_config('chk_filesize', False) and 'size' in self.info: + if self.get_config('chk_filesize', False) and self.info.get('size'): # 10485760 is 10MB, tolerance is used when comparing displayed size on the hoster website to real size # For example displayed size can be 1.46GB for example, but real size can be 1.4649853GB self.check_filesize(self.info['size'], size_tolerance=10485760) self.log_debug("Using default check rules...") for r, p in self.FILE_ERRORS: - errmsg = self.check_download({r: re.compile(p)}) + errmsg = self.check_file({r: re.compile(p)}) if errmsg is not None: errmsg = errmsg.strip().capitalize() @@ -338,7 +333,6 @@ class SimpleHoster(Hoster): self.check_errors() self.log_info(_("No errors found")) - self.pyfile.error = "" #@TODO: Recheck in 0.4.10 def check_errors(self): @@ -361,7 +355,7 @@ class SimpleHoster(Hoster): try: errmsg = m.group(1).strip() - except AttributeError: + except (AttributeError, IndexError): errmsg = m.group(0).strip() self.info['error'] = re.sub(r'<.*?>', " ", errmsg) @@ -385,7 +379,7 @@ class SimpleHoster(Hoster): try: errmsg = m.group(1).strip() - except AttributeError: + except (AttributeError, IndexError): errmsg = m.group(0).strip() self.info['error'] = re.sub(r'<.*?>', " ", errmsg) @@ -436,7 +430,7 @@ class SimpleHoster(Hoster): try: waitmsg = m.group(1).strip() - except AttributeError: + except (AttributeError, IndexError): waitmsg = m.group(0).strip() wait_time = sum(int(v) * {'hr': 3600, 'hour': 3600, 'min': 60, 'sec': 1, "": 1}[u.lower()] for v, u in @@ -455,22 +449,19 @@ class SimpleHoster(Hoster): self.log_debug("Previous file info: %s" % old_info) try: - status = self.info['status'] or None + status = self.info['status'] or 14 - if status == 1: + if status is 1: self.offline() - elif status == 6: + elif status is 6: self.temp_offline() - elif status == 8: - if 'error' in self.info: - self.fail(self.info['error']) - else: - self.fail(_("File status: " + statusMap[status])) + elif status is 8: + self.fail() finally: - self.log_info(_("File status: ") + (statusMap[status] if status else _("Unknown"))) + self.log_info(_("File status: ") + self.pyfile.getStatusName(status)) def check_name_size(self, getinfo=True): @@ -492,7 +483,7 @@ class SimpleHoster(Hoster): if name and name is not url: self.pyfile.name = name - if 'size' in self.info and self.info['size'] > 0: + if self.info.get('size') > 0: self.pyfile.size = int(self.info['size']) #@TODO: Fix int conversion in 0.4.10 # self.pyfile.sync() diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index 88c490750..7efecc5ef 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -8,7 +8,7 @@ from glob import glob from string import digits from module.plugins.internal.Extractor import Extractor, ArchiveError, CRCError, PasswordError -from module.utils import fs_decode, fs_encode, save_join as fs_join +from module.utils import fs_decode, save_join as fs_join def renice(pid, value): @@ -22,7 +22,7 @@ def renice(pid, value): class UnRar(Extractor): __name__ = "UnRar" - __version__ = "1.26" + __version__ = "1.27" __status__ = "testing" __description__ = """Rar extractor plugin""" @@ -229,7 +229,7 @@ class UnRar(Extractor): args.append("-y") #: Set a password - if "password" in kwargs and kwargs['password']: + if kwargs.get('password'): args.append("-p%s" % kwargs['password']) else: args.append("-p-") diff --git a/module/plugins/internal/UnZip.py b/module/plugins/internal/UnZip.py index ac197a80d..87cbd568a 100644 --- a/module/plugins/internal/UnZip.py +++ b/module/plugins/internal/UnZip.py @@ -7,7 +7,6 @@ import sys import zipfile from module.plugins.internal.Extractor import Extractor, ArchiveError, CRCError, PasswordError -from module.utils import fs_encode class UnZip(Extractor): diff --git a/module/plugins/internal/XFSAccount.py b/module/plugins/internal/XFSAccount.py index bb5cbcf50..91136a2a0 100644 --- a/module/plugins/internal/XFSAccount.py +++ b/module/plugins/internal/XFSAccount.py @@ -6,13 +6,14 @@ import urlparse from module.common.json_layer import json_loads from module.plugins.internal.Account import Account +# from module.plugins.internal.MultiAccount import MultiAccount from module.plugins.internal.Plugin import parse_html_form, set_cookie class XFSAccount(Account): __name__ = "XFSAccount" __type__ = "account" - __version__ = "0.46" + __version__ = "0.48" __status__ = "testing" __description__ = """XFileSharing account plugin""" @@ -21,8 +22,8 @@ class XFSAccount(Account): ("Walter Purcaro", "vuolter@gmail.com" )] - HOSTER_DOMAIN = None - HOSTER_URL = None + PLUGIN_DOMAIN = None + PLUGIN_URL = None LOGIN_URL = None COOKIES = True @@ -38,21 +39,22 @@ class XFSAccount(Account): LEECH_TRAFFIC_UNIT = "MB" #: Used only if no group <U> was found LOGIN_FAIL_PATTERN = r'Incorrect Login or Password|account was banned|Error<' + LOGIN_SKIP_PATTERN = r'op=logout' - def grab_info(self, user, password, data, req): + def grab_info(self, user, password, data): validuntil = None trafficleft = None leechtraffic = None premium = None - if not self.HOSTER_URL: #@TODO: Remove in 0.4.10 + if not self.PLUGIN_URL: #@TODO: Remove in 0.4.10 return {'validuntil' : validuntil, 'trafficleft' : trafficleft, 'leechtraffic': leechtraffic, 'premium' : premium} - html = self.load(self.HOSTER_URL, + html = self.load(self.PLUGIN_URL, get={'op': "my_account"}, cookies=self.COOKIES) @@ -139,31 +141,34 @@ class XFSAccount(Account): 'premium' : premium} - def login(self, user, password, data, req): - if self.HOSTER_DOMAIN: - if not self.HOSTER_URL: - self.HOSTER_URL = "http://www.%s/" % self.HOSTER_DOMAIN + def signin(self, user, password, data): + if self.PLUGIN_DOMAIN: + if not self.PLUGIN_URL: + self.PLUGIN_URL = "http://www.%s/" % self.PLUGIN_DOMAIN if self.COOKIES: - if isinstance(self.COOKIES, list) and (self.HOSTER_DOMAIN, "lang", "english") not in self.COOKIES: - self.COOKIES.insert((self.HOSTER_DOMAIN, "lang", "english")) + if isinstance(self.COOKIES, list) and (self.PLUGIN_DOMAIN, "lang", "english") not in self.COOKIES: + self.COOKIES.insert((self.PLUGIN_DOMAIN, "lang", "english")) else: - set_cookie(self.req.cj, self.HOSTER_DOMAIN, "lang", "english") + set_cookie(self.req.cj, self.PLUGIN_DOMAIN, "lang", "english") - if not self.HOSTER_URL: - self.fail_login(_("Missing HOSTER_URL")) + if not self.PLUGIN_URL: + self.fail_login(_("Missing PLUGIN_URL")) else: - self.HOSTER_URL = self.HOSTER_URL.rstrip('/') + "/" + self.PLUGIN_URL = self.PLUGIN_URL.rstrip('/') + "/" if not self.LOGIN_URL: - self.LOGIN_URL = urlparse.urljoin(self.HOSTER_URL, "login.html") + self.LOGIN_URL = urlparse.urljoin(self.PLUGIN_URL, "login.html") html = self.load(self.LOGIN_URL, cookies=self.COOKIES) + if re.search(self.LOGIN_SKIP_PATTERN, html): + self.skip_login() + action, inputs = parse_html_form('name="FL"', html) if not inputs: inputs = {'op' : "login", - 'redirect': self.HOSTER_URL} + 'redirect': self.PLUGIN_URL} inputs.update({'login' : user, 'password': password}) @@ -171,7 +176,7 @@ class XFSAccount(Account): if action: url = urlparse.urljoin("http://", action) else: - url = self.HOSTER_URL + url = self.PLUGIN_URL html = self.load(url, post=inputs, cookies=self.COOKIES) diff --git a/module/plugins/internal/XFSCrypter.py b/module/plugins/internal/XFSCrypter.py index 12a48d4a3..8047fd03e 100644 --- a/module/plugins/internal/XFSCrypter.py +++ b/module/plugins/internal/XFSCrypter.py @@ -7,7 +7,7 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo class XFSCrypter(SimpleCrypter): __name__ = "XFSCrypter" __type__ = "crypter" - __version__ = "0.14" + __version__ = "0.15" __status__ = "testing" __pattern__ = r'^unmatchable$' @@ -17,7 +17,7 @@ class XFSCrypter(SimpleCrypter): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_DOMAIN = None + PLUGIN_DOMAIN = None URL_REPLACEMENTS = [(r'&?per_page=\d+', ""), (r'[?/&]+$', ""), (r'(.+/[^?]+)$', r'\1?'), (r'$', r'&per_page=10000')] @@ -29,22 +29,22 @@ class XFSCrypter(SimpleCrypter): def prepare(self): - if not self.HOSTER_DOMAIN: + if not self.PLUGIN_DOMAIN: if self.account: account = self.account else: account_name = (self.__name__ + ".py").replace("Folder.py", "").replace(".py", "") account = self.pyload.accountManager.getAccountPlugin(account_name) - if account and hasattr(account, "HOSTER_DOMAIN") and account.HOSTER_DOMAIN: - self.HOSTER_DOMAIN = account.HOSTER_DOMAIN + if account and hasattr(account, "PLUGIN_DOMAIN") and account.PLUGIN_DOMAIN: + self.PLUGIN_DOMAIN = account.PLUGIN_DOMAIN else: - self.fail(_("Missing HOSTER_DOMAIN")) + self.fail(_("Missing PLUGIN_DOMAIN")) if self.COOKIES: - if isinstance(self.COOKIES, list) and (self.HOSTER_DOMAIN, "lang", "english") not in self.COOKIES: - self.COOKIES.insert((self.HOSTER_DOMAIN, "lang", "english")) + if isinstance(self.COOKIES, list) and (self.PLUGIN_DOMAIN, "lang", "english") not in self.COOKIES: + self.COOKIES.insert((self.PLUGIN_DOMAIN, "lang", "english")) else: - set_cookie(self.req.cj, self.HOSTER_DOMAIN, "lang", "english") + set_cookie(self.req.cj, self.PLUGIN_DOMAIN, "lang", "english") return super(XFSCrypter, self).prepare() diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py index 729c9a0ee..8af6b83ed 100644 --- a/module/plugins/internal/XFSHoster.py +++ b/module/plugins/internal/XFSHoster.py @@ -14,7 +14,7 @@ from module.utils import html_unescape class XFSHoster(SimpleHoster): __name__ = "XFSHoster" __type__ = "hoster" - __version__ = "0.60" + __version__ = "0.61" __status__ = "testing" __pattern__ = r'^unmatchable$' @@ -26,7 +26,7 @@ class XFSHoster(SimpleHoster): ("Walter Purcaro", "vuolter@gmail.com" )] - HOSTER_DOMAIN = None + PLUGIN_DOMAIN = None LEECH_HOSTER = True #@NOTE: Should be default to False for safe, but I'm lazy... @@ -61,26 +61,26 @@ class XFSHoster(SimpleHoster): """ Initialize important variables """ - if not self.HOSTER_DOMAIN: + if not self.PLUGIN_DOMAIN: if self.account: account = self.account else: account = self.pyload.accountManager.getAccountPlugin(self.__name__) - if account and hasattr(account, "HOSTER_DOMAIN") and account.HOSTER_DOMAIN: - self.HOSTER_DOMAIN = account.HOSTER_DOMAIN + if account and hasattr(account, "PLUGIN_DOMAIN") and account.PLUGIN_DOMAIN: + self.PLUGIN_DOMAIN = account.PLUGIN_DOMAIN else: - self.fail(_("Missing HOSTER_DOMAIN")) + self.fail(_("Missing PLUGIN_DOMAIN")) if self.COOKIES: - if isinstance(self.COOKIES, list) and (self.HOSTER_DOMAIN, "lang", "english") not in self.COOKIES: - self.COOKIES.insert((self.HOSTER_DOMAIN, "lang", "english")) + if isinstance(self.COOKIES, list) and (self.PLUGIN_DOMAIN, "lang", "english") not in self.COOKIES: + self.COOKIES.insert((self.PLUGIN_DOMAIN, "lang", "english")) else: - set_cookie(self.req.cj, self.HOSTER_DOMAIN, "lang", "english") + set_cookie(self.req.cj, self.PLUGIN_DOMAIN, "lang", "english") if not self.LINK_PATTERN: pattern = r'(?:file: "(.+?)"|(https?://(?:www\.)?([^/]*?%s|\d+\.\d+\.\d+\.\d+)(\:\d+)?(/d/|(/files)?/\d+/\w+/).+?)["\'<])' - self.LINK_PATTERN = pattern % self.HOSTER_DOMAIN.replace('.', '\.') + self.LINK_PATTERN = pattern % self.PLUGIN_DOMAIN.replace('.', '\.') super(XFSHoster, self).prepare() @@ -129,7 +129,7 @@ class XFSHoster(SimpleHoster): self.fail(_("Only registered or premium users can use url leech feature")) #: Only tested with easybytez.com - self.html = self.load("http://www.%s/" % self.HOSTER_DOMAIN) + self.html = self.load("http://www.%s/" % self.PLUGIN_DOMAIN) action, inputs = self.parse_html_form() @@ -244,7 +244,7 @@ class XFSHoster(SimpleHoster): try: captcha_key = re.search(self.RECAPTCHA_PATTERN, self.html).group(1) - except AttributeError: + except (AttributeError, IndexError): captcha_key = recaptcha.detect_key() else: @@ -258,7 +258,7 @@ class XFSHoster(SimpleHoster): try: captcha_key = re.search(self.SOLVEMEDIA_PATTERN, self.html).group(1) - except AttributeError: + except (AttributeError, IndexError): captcha_key = solvemedia.detect_key() else: |