summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-03-18 13:39:07 +0100
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-03-18 13:39:07 +0100
commit2bc144adb6bc2759b635e09687b27bf96074827f (patch)
tree7f33ba4952b37c6c81425786f103524084975bd7 /module/plugins/hoster
parent[UpdateManager] Dispatch Event on plugins update (diff)
downloadpyload-2bc144adb6bc2759b635e09687b27bf96074827f.tar.xz
Spare code cosmetics
Diffstat (limited to 'module/plugins/hoster')
-rw-r--r--module/plugins/hoster/AlldebridCom.py25
-rw-r--r--module/plugins/hoster/FastixRu.py23
-rw-r--r--module/plugins/hoster/MegaDebridEu.py49
-rw-r--r--module/plugins/hoster/NitroflareCom.py9
-rw-r--r--module/plugins/hoster/OverLoadMe.py26
5 files changed, 14 insertions, 118 deletions
diff --git a/module/plugins/hoster/AlldebridCom.py b/module/plugins/hoster/AlldebridCom.py
index 0a35ae2be..163e4e0d2 100644
--- a/module/plugins/hoster/AlldebridCom.py
+++ b/module/plugins/hoster/AlldebridCom.py
@@ -13,7 +13,7 @@ from module.utils import parseFileSize
class AlldebridCom(MultiHoster):
__name__ = "AlldebridCom"
__type__ = "hoster"
- __version__ = "0.45"
+ __version__ = "0.46"
__pattern__ = r'https?://(?:www\.|s\d+\.)?alldebrid\.com/dl/[\w^_]+'
@@ -22,18 +22,6 @@ class AlldebridCom(MultiHoster):
__authors__ = [("Andy Voigt", "spamsales@online.de")]
- 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 = 16
@@ -63,16 +51,5 @@ class AlldebridCom(MultiHoster):
else:
self.link = self.link.replace("https://", "http://")
- if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown"):
- #only use when name wasnt already set
- pyfile.name = self.getFilename(self.link)
-
-
- def checkFile(self, rules={}):
- if self.checkDownload({'error': "<title>An error occured while processing your request</title>"}) == "error":
- self.retry(wait_time=60, reason=_("An error occured while generating link"))
-
- return super(AlldebridCom, self).checkFile(rules)
-
getInfo = create_getInfo(AlldebridCom)
diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py
index 759b9bfec..2d36ad4a4 100644
--- a/module/plugins/hoster/FastixRu.py
+++ b/module/plugins/hoster/FastixRu.py
@@ -12,7 +12,7 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo
class FastixRu(MultiHoster):
__name__ = "FastixRu"
__type__ = "hoster"
- __version__ = "0.10"
+ __version__ = "0.11"
__pattern__ = r'http://(?:www\.)?fastix\.(ru|it)/file/\w{24}'
@@ -21,16 +21,6 @@ class FastixRu(MultiHoster):
__authors__ = [("Massimo Rosamilia", "max@spiritix.eu")]
- 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 = 3
@@ -51,16 +41,5 @@ class FastixRu(MultiHoster):
else:
self.link = data['downloadlink']
- if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown"):
- #only use when name wasnt already set
- pyfile.name = self.getFilename(self.link)
-
-
- def checkFile(self, rules={}):
- if self.checkDownload({"error": "<title>An error occurred while processing your request</title>"}):
- self.retry(wait_time=60, reason=_("An error occurred while generating link"))
-
- return super(FastixRu, self).checkFile(rules)
-
getInfo = create_getInfo(FastixRu)
diff --git a/module/plugins/hoster/MegaDebridEu.py b/module/plugins/hoster/MegaDebridEu.py
index fa66e74e6..05102d60f 100644
--- a/module/plugins/hoster/MegaDebridEu.py
+++ b/module/plugins/hoster/MegaDebridEu.py
@@ -11,7 +11,7 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo
class MegaDebridEu(MultiHoster):
__name__ = "MegaDebridEu"
__type__ = "hoster"
- __version__ = "0.46"
+ __version__ = "0.47"
__pattern__ = r'http://((?:www\d+\.|s\d+\.)?mega-debrid\.eu|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/download/file/[\w^_]+'
@@ -23,24 +23,6 @@ class MegaDebridEu(MultiHoster):
API_URL = "https://www.mega-debrid.eu/api.php"
- def getFilename(self, url):
- try:
- return unquote_plus(url.rsplit("/", 1)[1])
- except IndexError:
- return ""
-
-
- def handlePremium(self, pyfile):
- if not self.api_load():
- self.exitOnFail("Unable to connect to Mega-debrid.eu")
-
- self.link = self.debridLink(pyfile.url)
-
- filename = self.getFilename(self.link)
- if filename:
- pyfile.name = filename
-
-
def api_load(self):
"""
Connexion to the mega-debrid API
@@ -58,32 +40,21 @@ class MegaDebridEu(MultiHoster):
return False
- def debridLink(self, linkToDebrid):
+ def handlePremium(self, pyfile):
"""
Debrid a link
Return The debrided link if succeed or original link if fail
"""
- jsonResponse = self.load(self.API_URL, get={'action': 'getLink', 'token': self.token},
- post={"link": linkToDebrid})
- res = json_loads(jsonResponse)
-
- if res['response_code'] == "ok":
- debridedLink = res['debridLink'][1:-1]
- return debridedLink
- else:
- self.exitOnFail("Unable to debrid %s" % linkToDebrid)
+ if not self.api_load():
+ self.error("Unable to connect to remote API")
+ jsonResponse = self.load(self.API_URL,
+ get={'action': 'getLink', 'token': self.token},
+ post={'link': pyfile.url})
- def exitOnFail(self, msg):
- """
- exit the plugin on fail case
- And display the reason of this failure
- """
- if self.getConfig('unloadFailing'):
- self.logError(_(msg))
- self.resetAccount()
- else:
- self.fail(_(msg))
+ res = json_loads(jsonResponse)
+ if res['response_code'] == "ok":
+ self.link = res['debridLink'][1:-1]
getInfo = create_getInfo(MegaDebridEu)
diff --git a/module/plugins/hoster/NitroflareCom.py b/module/plugins/hoster/NitroflareCom.py
index 6196e0862..cffa0e9a5 100644
--- a/module/plugins/hoster/NitroflareCom.py
+++ b/module/plugins/hoster/NitroflareCom.py
@@ -1,14 +1,7 @@
# -*- coding: utf-8 -*-
-#
-# Note:
-# Right now premium support is not added
-# Thus, any file that require premium support
-# cannot be downloaded. Only the file that is free to
-# download can be downloaded.
import re
-from module.common.json_layer import json_loads
from module.plugins.internal.CaptchaService import ReCaptcha
from module.plugins.internal.SimpleHoster import SimpleHoster
@@ -36,7 +29,7 @@ class NitroflareCom(SimpleHoster):
RECAPTCHA_KEY = "6Lenx_USAAAAAF5L1pmTWvWcH73dipAEzNnmNLgy"
PREMIUM_ONLY_PATTERN = r'This file is available with Premium only'
- WAIT_PATTERN = r'You have to wait .+'
+ WAIT_PATTERN = r'You have to wait .+?<'
ERROR_PATTERN = r'downloading is not possible'
diff --git a/module/plugins/hoster/OverLoadMe.py b/module/plugins/hoster/OverLoadMe.py
index 7b444c3ca..4e88710b8 100644
--- a/module/plugins/hoster/OverLoadMe.py
+++ b/module/plugins/hoster/OverLoadMe.py
@@ -13,7 +13,7 @@ from module.utils import parseFileSize
class OverLoadMe(MultiHoster):
__name__ = "OverLoadMe"
__type__ = "hoster"
- __version__ = "0.10"
+ __version__ = "0.11"
__pattern__ = r'https?://.*overload\.me/.+'
@@ -22,18 +22,6 @@ class OverLoadMe(MultiHoster):
__authors__ = [("marley", "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
@@ -60,17 +48,5 @@ class OverLoadMe(MultiHoster):
http_repl = ["http://", "https://"]
self.link = data['downloadlink'].replace(*http_repl if self.getConfig('ssl') else *http_repl[::-1])
- 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(self.link)
-
-
- def checkFile(self, rules={}):
- if self.checkDownload({"error": "<title>An error occured while processing your request</title>"})
- # usual this download can safely be retried
- self.retry(wait_time=60, reason=_("An error occured while generating link."))
-
- return super(OverLoadMe, self).checkFile(rules)
-
getInfo = create_getInfo(OverLoadMe)