diff options
author | marley2013 <marley@over-load.me> | 2014-03-25 12:12:34 +0100 |
---|---|---|
committer | Stefano <l.stickell@yahoo.it> | 2014-04-21 17:10:01 +0200 |
commit | e71ff160126ef396395a39f93e76dacd216e7fff (patch) | |
tree | a1d7babadf559ac2c7b883635bbee2c750230beb | |
parent | Merge pull request #560 from vuolter/s/hoster/RapidgatorNet (diff) | |
download | pyload-e71ff160126ef396395a39f93e76dacd216e7fff.tar.xz |
New multihoster: OverLoadMe
-rw-r--r-- | module/plugins/accounts/OverLoadMe.py | 31 | ||||
-rw-r--r-- | module/plugins/hooks/OverLoadMe.py | 28 | ||||
-rw-r--r-- | module/plugins/hoster/OverLoadMe.py | 78 |
3 files changed, 137 insertions, 0 deletions
diff --git a/module/plugins/accounts/OverLoadMe.py b/module/plugins/accounts/OverLoadMe.py new file mode 100644 index 000000000..e288181eb --- /dev/null +++ b/module/plugins/accounts/OverLoadMe.py @@ -0,0 +1,31 @@ +from module.plugins.Account import Account +from module.common.json_layer import json_loads + + +class OverLoadMe(Account): + __name__ = "OverLoadMe" + __version__ = "0.01" + __type__ = "account" + __description__ = """Over-Load.me account plugin""" + __author_name__ = ("marley") + __author_mail__ = ("marley@over-load.me") + + def loadAccountInfo(self, user, req): + data = self.getAccountData(user) + page = req.load("https://api.over-load.me/account.php", get={"user": user, "auth": data["password"]}).strip() + data = json_loads(page) + + # Check for premium + if data["membership"] == "Free": + return {"premium": False} + + account_info = {"validuntil": data["expirationunix"], "trafficleft": -1} + return account_info + + def login(self, user, data, req): + jsondata = req.load("https://api.over-load.me/account.php", + get={"user": user, "auth": data["password"]}).strip() + data = json_loads(jsondata) + + if data["err"] == 1: + self.wrongPassword() diff --git a/module/plugins/hooks/OverLoadMe.py b/module/plugins/hooks/OverLoadMe.py new file mode 100644 index 000000000..bc8f9f5cb --- /dev/null +++ b/module/plugins/hooks/OverLoadMe.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- + +from module.network.RequestFactory import getURL +from module.plugins.internal.MultiHoster import MultiHoster + + +class OverLoadMe(MultiHoster): + __name__ = "OverLoadMe" + __version__ = "0.01" + __type__ = "hook" + __config__ = [("activated", "bool", "Activated", "False"), + ("https", "bool", "Enable HTTPS", "True"), + ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), + ("hosterList", "str", "Hoster list (comma separated)", ""), + ("unloadFailing", "bool", "Revert to standard download if download fails", "False"), + ("interval", "int", "Reload interval in hours (0 to disable)", "12")] + __description__ = """Over-Load.me hook plugin""" + __author_name__ = ("marley") + __author_email__ = ("marley@over-load.me") + + def getHoster(self): + https = "https" if self.getConfig("https") else "http" + page = getURL(https + "://api.over-load.me/hoster.php", + get={"auth": "0001-cb1f24dadb3aa487bda5afd3b76298935329be7700cd7-5329be77-00cf-1ca0135f"} + ).replace("\"", "").strip() + self.logDebug("Hosterlist: %s" % page) + + return [x.strip() for x in page.split(",") if x.strip()] diff --git a/module/plugins/hoster/OverLoadMe.py b/module/plugins/hoster/OverLoadMe.py new file mode 100644 index 000000000..658b3940f --- /dev/null +++ b/module/plugins/hoster/OverLoadMe.py @@ -0,0 +1,78 @@ +# -*- coding: utf-8 -*- + +import re +from urllib import unquote +from random import randrange + +from module.plugins.Hoster import Hoster +from module.common.json_layer import json_loads +from module.utils import parseFileSize + + +class OverLoadMe(Hoster): + __name__ = "OverLoadMe" + __version__ = "0.01" + __type__ = "hoster" + __pattern__ = r"https?://.*overload\.me.*" + __description__ = """Over-Load.me hoster plugin""" + __author_name__ = ("marley") + __author_mail__ = ("marley@over-load.me") + + def getFilename(self, url): + try: + name = unquote(url.rsplit("/", 1)[1]) + except IndexError: + name = "Unknown_Filename..." + if name.endswith("..."): # incomplete filename, append random stuff + name += "%s.tmp" % randrange(100, 999) + return name + + def setup(self): + self.chunkLimit = 5 + self.resumeDownload = True + + def process(self, pyfile): + if re.match(self.__pattern__, pyfile.url): + new_url = pyfile.url + elif not self.account: + self.logError(_("Please enter your %s account or deactivate this plugin") % "Over-Load") + self.fail("No Over-Load account provided") + else: + self.logDebug("Old URL: %s" % pyfile.url) + data = self.account.getAccountData(self.user) + + page = self.load("https://api.over-load.me/getdownload.php", + get={"auth": data["password"], "link": pyfile.url}) + data = json_loads(page) + + self.logDebug("Returned Data: %s" % data) + + if data["err"] == 1: + self.logWarning(data["msg"]) + self.tempOffline() + else: + if self.pyfile.name is not None and self.pyfile.name.endswith('.tmp') and data["filename"]: + self.pyfile.name = data["filename"] + self.pyfile.size = parseFileSize(data["filesize"]) + new_url = data["downloadlink"] + + if self.getConfig("https"): + new_url = new_url.replace("http://", "https://") + else: + new_url = new_url.replace("https://", "http://") + + if new_url != pyfile.url: + self.logDebug("New URL: %s" % new_url) + + if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown") or pyfile.name.endswith('..'): + # only use when name wasn't already set + pyfile.name = self.getFilename(new_url) + + self.download(new_url, disposition=True) + + check = self.checkDownload( + {"error": "<title>An error occured while processing your request</title>"}) + + if check == "error": + # usual this download can safely be retried + self.retry(reason="An error occured while generating link.", wait_time=60) |