summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--module/plugins/hoster/AlldebridCom.py74
-rw-r--r--module/plugins/hoster/DebridItaliaCom.py37
-rw-r--r--module/plugins/hoster/FastixRu.py48
-rw-r--r--module/plugins/hoster/FreeWayMe.py20
-rw-r--r--module/plugins/hoster/Keep2shareCc.py2
-rw-r--r--module/plugins/hoster/LinksnappyCom.py63
-rw-r--r--module/plugins/hoster/MegaDebridEu.py28
-rw-r--r--module/plugins/hoster/MultishareCz.py33
-rw-r--r--module/plugins/hoster/MyfastfileCom.py44
-rw-r--r--module/plugins/hoster/OverLoadMe.py58
-rw-r--r--module/plugins/hoster/PremiumTo.py24
-rw-r--r--module/plugins/hoster/PremiumizeMe.py32
-rw-r--r--module/plugins/hoster/RPNetBiz.py109
-rw-r--r--module/plugins/hoster/RealdebridCom.py78
-rw-r--r--module/plugins/hoster/RehostTo.py20
-rw-r--r--module/plugins/hoster/SimplyPremiumCom.py109
-rw-r--r--module/plugins/hoster/SimplydebridCom.py53
-rw-r--r--module/plugins/hoster/UnrestrictLi.py85
-rw-r--r--module/plugins/hoster/ZeveraCom.py26
19 files changed, 442 insertions, 501 deletions
diff --git a/module/plugins/hoster/AlldebridCom.py b/module/plugins/hoster/AlldebridCom.py
index bdd8ccdff..8a4e31986 100644
--- a/module/plugins/hoster/AlldebridCom.py
+++ b/module/plugins/hoster/AlldebridCom.py
@@ -6,14 +6,14 @@ from random import randrange
from urllib import unquote
from module.common.json_layer import json_loads
-from module.plugins.Hoster import Hoster
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
from module.utils import parseFileSize
-class AlldebridCom(Hoster):
+class AlldebridCom(SimpleHoster):
__name__ = "AlldebridCom"
__type__ = "hoster"
- __version__ = "0.34"
+ __version__ = "0.35"
__pattern__ = r'https?://(?:[^/]*\.)?alldebrid\..*'
@@ -33,55 +33,51 @@ class AlldebridCom(Hoster):
def setup(self):
- self.chunkLimit = 16
+ self.chunkLimit = 16
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") % "AllDebrid")
- self.fail(_("No AllDebrid account provided"))
- else:
- self.logDebug("Old URL: %s" % pyfile.url)
- password = self.getPassword().splitlines()[0] or ""
+ def handleMulti(self):
+ password = self.getPassword().splitlines()[0] or ""
- data = json_loads(self.load("http://www.alldebrid.com/service.php",
- get={'link': pyfile.url, 'json': "true", 'pw': password}))
+ data = json_loads(self.load("http://www.alldebrid.com/service.php",
+ get={'link': self.pyfile.url, 'json': "true", 'pw': password}))
- self.logDebug("Json data", data)
+ self.logDebug("Json data", data)
- if data['error']:
- if data['error'] == "This link isn't available on the hoster website.":
- self.offline()
- else:
- self.logWarning(data['error'])
- self.tempOffline()
+ if data['error']:
+ if data['error'] == "This link isn't available on the hoster website.":
+ self.offline()
else:
- if pyfile.name and not pyfile.name.endswith('.tmp'):
- pyfile.name = data['filename']
- pyfile.size = parseFileSize(data['filesize'])
- new_url = data['link']
+ self.logWarning(data['error'])
+ self.tempOffline()
+ else:
+ if self.pyfile.name and not self.pyfile.name.endswith('.tmp'):
+ self.pyfile.name = data['filename']
+ self.pyfile.size = parseFileSize(data['filesize'])
+ self.link = data['link']
if self.getConfig("https"):
- new_url = new_url.replace("http://", "https://")
+ self.link = self.link.replace("http://", "https://")
else:
- new_url = new_url.replace("https://", "http://")
+ self.link = self.link.replace("https://", "http://")
- if new_url != pyfile.url:
- self.logDebug("New URL: %s" % new_url)
+ if self.link != self.pyfile.url:
+ self.logDebug("New URL: %s" % self.link)
- if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown"):
+ if self.pyfile.name.startswith("http") or self.pyfile.name.startswith("Unknown"):
#only use when name wasnt already set
- pyfile.name = self.getFilename(new_url)
+ self.pyfile.name = self.getFilename(self.link)
+
+
+ def checkFile(self):
+ check = self.checkDownload({'error': "<title>An error occured while processing your request</title>",
+ 'empty': re.compile(r"^$")})
- self.download(new_url, disposition=True)
+ if check == "error":
+ self.retry(wait_time=60, reason=_("An error occured while generating link"))
+ elif check == "empty":
+ self.retry(wait_time=60, reason=_("Downloaded File was empty"))
- check = self.checkDownload({'error': "<title>An error occured while processing your request</title>",
- 'empty': re.compile(r"^$")})
- if check == "error":
- self.retry(wait_time=60, reason=_("An error occured while generating link"))
- elif check == "empty":
- self.retry(wait_time=60, reason=_("Downloaded File was empty"))
+getInfo = create_getInfo(AlldebridCom)
diff --git a/module/plugins/hoster/DebridItaliaCom.py b/module/plugins/hoster/DebridItaliaCom.py
index 17342b8cd..da52c080b 100644
--- a/module/plugins/hoster/DebridItaliaCom.py
+++ b/module/plugins/hoster/DebridItaliaCom.py
@@ -2,14 +2,13 @@
import re
-from module.plugins.Hoster import Hoster
-from module.plugins.internal.SimpleHoster import replace_patterns
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
-class DebridItaliaCom(Hoster):
+class DebridItaliaCom(SimpleHoster):
__name__ = "DebridItaliaCom"
__type__ = "hoster"
- __version__ = "0.07"
+ __version__ = "0.09"
__pattern__ = r'http://s\d+\.debriditalia\.com/dl/\d+'
@@ -19,35 +18,25 @@ class DebridItaliaCom(Hoster):
("Walter Purcaro", "vuolter@gmail.com")]
- URL_REPLACEMENTS = [(r'(/dl/\d+)$', '\1/')]
-
-
def setup(self):
self.chunkLimit = -1
self.resumeDownload = True
- def process(self, pyfile):
- pyfile.url = replace_patterns(pyfile.url, cls.URL_REPLACEMENTS)
-
- if re.match(self.__pattern__, pyfile.url):
- link = pyfile.url
-
- elif not self.account:
- self.logError(_("Please enter your %s account or deactivate this plugin") % "DebridItalia")
- self.fail(_("No DebridItalia account provided"))
+ def handleMulti(self):
+ html = self.load("http://www.debriditalia.com/api.php",
+ get={'generate': "on", 'link': self.pyfile.url, 'p': self.getPassword()})
- else:
- html = self.load("http://www.debriditalia.com/api.php", get={'generate': "", 'link': pyfile.url})
+ if "ERROR" in html:
+ self.fail(re.search(r'ERROR:(.*)', html).strip())
- if "ERROR" in html:
- self.fail(re.search(r'ERROR:(.*)', html).strip())
+ self.link = html.strip()
- link = html.strip()
-
- self.download(link, disposition=True)
+ def checkFile(self):
check = self.checkDownload({'empty': re.compile(r'^$')})
-
if check == "empty":
self.retry(5, 2 * 60, "Empty file downloaded")
+
+
+getInfo = create_getInfo(DebridItaliaCom)
diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py
index 1e47638ea..a4e7338fe 100644
--- a/module/plugins/hoster/FastixRu.py
+++ b/module/plugins/hoster/FastixRu.py
@@ -6,10 +6,10 @@ from random import randrange
from urllib import unquote
from module.common.json_layer import json_loads
-from module.plugins.Hoster import Hoster
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
-class FastixRu(Hoster):
+class FastixRu(SimpleHoster):
__name__ = "FastixRu"
__type__ = "hoster"
__version__ = "0.04"
@@ -32,41 +32,34 @@ class FastixRu(Hoster):
def setup(self):
- self.chunkLimit = 3
+ self.chunkLimit = 3
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") % "Fastix")
- self.fail(_("No Fastix account provided"))
- else:
- self.logDebug("Old URL: %s" % pyfile.url)
- api_key = self.account.getAccountData(self.user)
- api_key = api_key['api']
+ def handleMulti(self):
+ api_key = self.account.getAccountData(self.user)
+ api_key = api_key['api']
- page = self.load("http://fastix.ru/api_v2/",
- get={'apikey': api_key, 'sub': "getdirectlink", 'link': pyfile.url})
- data = json_loads(page)
+ page = self.load("http://fastix.ru/api_v2/",
+ get={'apikey': api_key, 'sub': "getdirectlink", 'link': self.pyfile.url})
+ data = json_loads(page)
- self.logDebug("Json data", data)
+ self.logDebug("Json data", data)
- if "error\":true" in page:
- self.offline()
- else:
- new_url = data['downloadlink']
+ if "error\":true" in page:
+ self.offline()
+ else:
+ self.link = data['downloadlink']
- if new_url != pyfile.url:
- self.logDebug("New URL: %s" % new_url)
+ if self.link != self.pyfile.url:
+ self.logDebug("New URL: %s" % self.link)
- if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown"):
+ if self.pyfile.name.startswith("http") or self.pyfile.name.startswith("Unknown"):
#only use when name wasnt already set
- pyfile.name = self.getFilename(new_url)
+ self.pyfile.name = self.getFilename(self.link)
- self.download(new_url, disposition=True)
+ def checkFile(self):
check = self.checkDownload({"error": "<title>An error occurred while processing your request</title>",
"empty": re.compile(r"^$")})
@@ -74,3 +67,6 @@ class FastixRu(Hoster):
self.retry(wait_time=60, reason=_("An error occurred while generating link"))
elif check == "empty":
self.retry(wait_time=60, reason=_("Downloaded File was empty"))
+
+
+getInfo = create_getInfo(FastixRu)
diff --git a/module/plugins/hoster/FreeWayMe.py b/module/plugins/hoster/FreeWayMe.py
index a27dc04b8..531b49726 100644
--- a/module/plugins/hoster/FreeWayMe.py
+++ b/module/plugins/hoster/FreeWayMe.py
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
-from module.plugins.Hoster import Hoster
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
-class FreeWayMe(Hoster):
+class FreeWayMe(SimpleHoster):
__name__ = "FreeWayMe"
__type__ = "hoster"
__version__ = "0.11"
@@ -21,16 +21,14 @@ class FreeWayMe(Hoster):
self.chunkLimit = 1
- def process(self, pyfile):
- if not self.account:
- self.logError(_("Please enter your %s account or deactivate this plugin") % "FreeWayMe")
- self.fail(_("No FreeWay account provided"))
-
- self.logDebug("Old URL: %s" % pyfile.url)
-
- (user, data) = self.account.selectAccount()
+ def handleMulti(self):
+ user, data = self.account.selectAccount()
+ self.link = True
self.download(
"https://www.free-way.me/load.php",
- get={"multiget": 7, "url": pyfile.url, "user": user, "pw": self.account.getpw(user), "json": ""},
+ get={"multiget": 7, "url": self.pyfile.url, "user": user, "pw": self.account.getpw(user), "json": ""},
disposition=True)
+
+
+getInfo = create_getInfo(FreeWayMe)
diff --git a/module/plugins/hoster/Keep2shareCc.py b/module/plugins/hoster/Keep2shareCc.py
index 0d06a74c7..86c28e93b 100644
--- a/module/plugins/hoster/Keep2shareCc.py
+++ b/module/plugins/hoster/Keep2shareCc.py
@@ -118,7 +118,7 @@ class Keep2shareCc(SimpleHoster):
def downloadLink(self, link):
- if not link:
+ if not link or not isinstance(link, basestring):
return
link = _isDirectLink(self, link, self.premium)
diff --git a/module/plugins/hoster/LinksnappyCom.py b/module/plugins/hoster/LinksnappyCom.py
index b8694e141..1f97fab31 100644
--- a/module/plugins/hoster/LinksnappyCom.py
+++ b/module/plugins/hoster/LinksnappyCom.py
@@ -5,10 +5,10 @@ import re
from urlparse import urlsplit
from module.common.json_layer import json_loads, json_dumps
-from module.plugins.Hoster import Hoster
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
-class LinksnappyCom(Hoster):
+class LinksnappyCom(SimpleHoster):
__name__ = "LinksnappyCom"
__type__ = "hoster"
__version__ = "0.02"
@@ -24,48 +24,42 @@ class LinksnappyCom(Hoster):
def setup(self):
- self.chunkLimit = -1
+ self.chunkLimit = -1
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") % "Linksnappy.com")
- self.fail(_("No Linksnappy.com account provided"))
- else:
- self.logDebug("Old URL: %s" % pyfile.url)
- host = self._get_host(pyfile.url)
- json_params = json_dumps({'link': pyfile.url,
- 'type': host,
- 'username': self.user,
- 'password': self.account.getAccountData(self.user)['password']})
- r = self.load('http://gen.linksnappy.com/genAPI.php',
- post={'genLinks': json_params})
- self.logDebug("JSON data: " + r)
+ def handleMulti(self):
+ host = self._get_host(self.pyfile.url)
+ json_params = json_dumps({'link': self.pyfile.url,
+ 'type': host,
+ 'username': self.user,
+ 'password': self.account.getAccountData(self.user)['password']})
+ r = self.load('http://gen.linksnappy.com/genAPI.php',
+ post={'genLinks': json_params})
+ self.logDebug("JSON data: " + r)
- j = json_loads(r)['links'][0]
+ j = json_loads(r)['links'][0]
- if j['error']:
- msg = _("Error converting the link")
- self.logError(msg, j['error'])
- self.fail(msg)
+ if j['error']:
+ msg = _("Error converting the link")
+ self.logError(msg, j['error'])
+ self.fail(msg)
- pyfile.name = j['filename']
- new_url = j['generated']
+ self.pyfile.name = j['filename']
+ self.link = j['generated']
- if host in self.SINGLE_CHUNK_HOSTERS:
- self.chunkLimit = 1
- else:
- self.setup()
+ if host in self.SINGLE_CHUNK_HOSTERS:
+ self.chunkLimit = 1
+ else:
+ self.setup()
- if new_url != pyfile.url:
- self.logDebug("New URL: " + new_url)
+ if self.link != self.pyfile.url:
+ self.logDebug("New URL: " + self.link)
- self.download(new_url, disposition=True)
+ def checkFile(self):
check = self.checkDownload({"html302": "<title>302 Found</title>"})
+
if check == "html302":
self.retry(wait_time=5, reason=_("Linksnappy returns only HTML data"))
@@ -74,3 +68,6 @@ class LinksnappyCom(Hoster):
def _get_host(url):
host = urlsplit(url).netloc
return re.search(r'[\w-]+\.\w+$', host).group(0)
+
+
+getInfo = create_getInfo(LinksnappyCom)
diff --git a/module/plugins/hoster/MegaDebridEu.py b/module/plugins/hoster/MegaDebridEu.py
index f63a7b3c6..f6696a1ed 100644
--- a/module/plugins/hoster/MegaDebridEu.py
+++ b/module/plugins/hoster/MegaDebridEu.py
@@ -5,10 +5,10 @@ import re
from urllib import unquote_plus
from module.common.json_layer import json_loads
-from module.plugins.Hoster import Hoster
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
-class MegaDebridEu(Hoster):
+class MegaDebridEu(SimpleHoster):
__name__ = "MegaDebridEu"
__type__ = "hoster"
__version__ = "0.40"
@@ -30,23 +30,16 @@ class MegaDebridEu(Hoster):
return ""
- def process(self, pyfile):
- if re.match(self.__pattern__, pyfile.url):
- new_url = pyfile.url
- elif not self.account:
- self.exitOnFail("Please enter your %s account or deactivate this plugin" % "Mega-debrid.eu")
- else:
- if not self.connectToApi():
- self.exitOnFail("Unable to connect to Mega-debrid.eu")
+ def handleMulti(self):
+ if not self.connectToApi():
+ self.exitOnFail("Unable to connect to Mega-debrid.eu")
- self.logDebug("Old URL: %s" % pyfile.url)
- new_url = self.debridLink(pyfile.url)
- self.logDebug("New URL: " + new_url)
+ self.link = self.debridLink(self.pyfile.url)
+ self.logDebug("New URL: " + self.link)
- filename = self.getFilename(new_url)
+ filename = self.getFilename(self.link)
if filename != "":
- pyfile.name = filename
- self.download(new_url, disposition=True)
+ self.pyfile.name = filename
def connectToApi(self):
@@ -92,3 +85,6 @@ class MegaDebridEu(Hoster):
self.resetAccount()
else:
self.fail(_(msg))
+
+
+getInfo = create_getInfo(MegaDebridEu)
diff --git a/module/plugins/hoster/MultishareCz.py b/module/plugins/hoster/MultishareCz.py
index fc866e2b1..d7ddb753c 100644
--- a/module/plugins/hoster/MultishareCz.py
+++ b/module/plugins/hoster/MultishareCz.py
@@ -27,23 +27,8 @@ class MultishareCz(SimpleHoster):
OFFLINE_PATTERN = ur'<h1>Stáhnout soubor</h1><p><strong>Požadovaný soubor neexistuje.</strong></p>'
- def process(self, pyfile):
- msurl = re.match(self.__pattern__, pyfile.url)
- if msurl:
- self.fileID = msurl.group('ID')
- self.html = self.load(pyfile.url, decode=True)
- self.getFileInfo()
-
- if self.premium:
- self.handlePremium()
- else:
- self.handleFree()
- else:
- self.handleOverriden()
-
-
def handleFree(self):
- self.download("http://www.multishare.cz/html/download_free.php?ID=%s" % self.fileID)
+ self.download("http://www.multishare.cz/html/download_free.php?ID=%s" % self.info['pattern']['ID'])
def handlePremium(self):
@@ -51,27 +36,29 @@ class MultishareCz(SimpleHoster):
self.logWarning(_("Not enough credit left to download file"))
self.resetAccount()
- self.download("http://www.multishare.cz/html/download_premium.php?ID=%s" % self.fileID)
-
+ self.download("http://www.multishare.cz/html/download_premium.php?ID=%s" % self.info['pattern']['ID'])
- def handleOverriden(self):
- if not self.premium:
- self.fail(_("Only premium users can download from other hosters"))
+ def handleMulti(self):
self.html = self.load('http://www.multishare.cz/html/mms_ajax.php', post={"link": self.pyfile.url}, decode=True)
- self.getFileInfo()
+
+ self.checkInfo()
if not self.checkCredit():
self.fail(_("Not enough credit left to download file"))
- url = "http://dl%d.mms.multishare.cz/html/mms_process.php" % round(random() * 10000 * random())
+ url = "http://dl%d.mms.multishare.cz/html/mms_process.php" % round(random() * 10000 * random())
params = {"u_ID": self.acc_info['u_ID'], "u_hash": self.acc_info['u_hash'], "link": self.pyfile.url}
+
self.logDebug(url, params)
+
+ self.link = True
self.download(url, get=params)
def checkCredit(self):
self.acc_info = self.account.getAccountInfo(self.user, True)
+
self.logInfo(_("User %s has %i MB left") % (self.user, self.acc_info['trafficleft'] / 1024))
return self.pyfile.size / 1024 <= self.acc_info['trafficleft']
diff --git a/module/plugins/hoster/MyfastfileCom.py b/module/plugins/hoster/MyfastfileCom.py
index a2e582bd0..947d302b5 100644
--- a/module/plugins/hoster/MyfastfileCom.py
+++ b/module/plugins/hoster/MyfastfileCom.py
@@ -3,10 +3,10 @@
import re
from module.common.json_layer import json_loads
-from module.plugins.Hoster import Hoster
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
-class MyfastfileCom(Hoster):
+class MyfastfileCom(SimpleHoster):
__name__ = "MyfastfileCom"
__type__ = "hoster"
__version__ = "0.04"
@@ -19,28 +19,24 @@ class MyfastfileCom(Hoster):
def setup(self):
- self.chunkLimit = -1
+ self.chunkLimit = -1
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") % "Myfastfile.com")
- self.fail(_("No Myfastfile.com account provided"))
- else:
- self.logDebug("Original URL: %s" % pyfile.url)
- page = self.load('http://myfastfile.com/api.php',
- get={'user': self.user, 'pass': self.account.getAccountData(self.user)['password'],
- 'link': pyfile.url})
- self.logDebug("JSON data: " + page)
- page = json_loads(page)
- if page['status'] != 'ok':
- self.fail(_("Unable to unrestrict link"))
- new_url = page['link']
-
- if new_url != pyfile.url:
- self.logDebug("Unrestricted URL: " + new_url)
-
- self.download(new_url, disposition=True)
+ def handleMulti(self):
+ self.logDebug("Original URL: %s" % self.pyfile.url)
+
+ page = self.load('http://myfastfile.com/api.php',
+ get={'user': self.user, 'pass': self.account.getAccountData(self.user)['password'],
+ 'link': self.pyfile.url})
+ self.logDebug("JSON data: " + page)
+ page = json_loads(page)
+ if page['status'] != 'ok':
+ self.fail(_("Unable to unrestrict link"))
+ self.link = page['link']
+
+ if self.link != self.pyfile.url:
+ self.logDebug("Unrestricted URL: " + self.link)
+
+
+getInfo = create_getInfo(MyfastfileCom)
diff --git a/module/plugins/hoster/OverLoadMe.py b/module/plugins/hoster/OverLoadMe.py
index bb8d84742..7f3152dfa 100644
--- a/module/plugins/hoster/OverLoadMe.py
+++ b/module/plugins/hoster/OverLoadMe.py
@@ -6,11 +6,11 @@ from random import randrange
from urllib import unquote
from module.common.json_layer import json_loads
-from module.plugins.Hoster import Hoster
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
from module.utils import parseFileSize
-class OverLoadMe(Hoster):
+class OverLoadMe(SimpleHoster):
__name__ = "OverLoadMe"
__type__ = "hoster"
__version__ = "0.02"
@@ -33,52 +33,48 @@ class OverLoadMe(Hoster):
def setup(self):
- self.chunkLimit = 5
+ 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)
+ def handleMulti(self):
+ 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)
+ page = self.load("https://api.over-load.me/getdownload.php",
+ get={"auth": data['password'], "link": self.pyfile.url})
+ data = json_loads(page)
- self.logDebug("Returned Data: %s" % data)
+ self.logDebug("Returned Data: %s" % data)
- if data['error'] == 1:
- self.logWarning(data['msg'])
- self.tempOffline()
- else:
- if pyfile.name is not None and pyfile.name.endswith('.tmp') and data['filename']:
- pyfile.name = data['filename']
- pyfile.size = parseFileSize(data['filesize'])
- new_url = data['downloadlink']
+ if data['error'] == 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'])
+ self.link = data['downloadlink']
if self.getConfig("https"):
- new_url = new_url.replace("http://", "https://")
+ self.link = self.link.replace("http://", "https://")
else:
- new_url = new_url.replace("https://", "http://")
+ self.link = self.link.replace("https://", "http://")
- if new_url != pyfile.url:
- self.logDebug("New URL: %s" % new_url)
+ if self.link != self.pyfile.url:
+ self.logDebug("New URL: %s" % self.link)
- if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown") or pyfile.name.endswith('..'):
+ if self.pyfile.name.startswith("http") or self.pyfile.name.startswith("Unknown") or self.pyfile.name.endswith('..'):
# only use when name wasn't already set
- pyfile.name = self.getFilename(new_url)
+ self.pyfile.name = self.getFilename(self.link)
- self.download(new_url, disposition=True)
+ def checkFile(self):
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(wait_time=60, reason=_("An error occured while generating link."))
+
+
+getInfo = create_getInfo(OverLoadMe)
diff --git a/module/plugins/hoster/PremiumTo.py b/module/plugins/hoster/PremiumTo.py
index 9f8037d41..35f21e7ec 100644
--- a/module/plugins/hoster/PremiumTo.py
+++ b/module/plugins/hoster/PremiumTo.py
@@ -6,11 +6,11 @@ from os import remove
from os.path import exists
from urllib import quote
-from module.plugins.Hoster import Hoster
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
from module.utils import fs_encode
-class PremiumTo(Hoster):
+class PremiumTo(SimpleHoster):
__name__ = "PremiumTo"
__type__ = "hoster"
__version__ = "0.11"
@@ -26,27 +26,24 @@ class PremiumTo(Hoster):
def setup(self):
self.resumeDownload = True
- self.chunkLimit = 1
+ self.chunkLimit = 1
- def process(self, pyfile):
- if not self.account:
- self.logError(_("Please enter your %s account or deactivate this plugin") % "premium.to")
- self.fail(_("No premium.to account provided"))
-
- self.logDebug("Old URL: %s" % pyfile.url)
-
+ def handleMulti(self):
tra = self.getTraffic()
#raise timeout to 2min
self.req.setOption("timeout", 120)
+ self.link = True
self.download("http://premium.to/api/getfile.php",
get={'username': self.account.username,
'password': self.account.password,
- 'link' : quote(pyfile.url, "")},
+ 'link' : quote(self.pyfile.url, "")},
disposition=True)
+
+ def checkFile(self):
check = self.checkDownload({"nopremium": "No premium account available"})
if check == "nopremium":
@@ -65,7 +62,7 @@ class PremiumTo(Hoster):
err = _('File does not exist')
trb = self.getTraffic()
- self.logInfo(_("Filesize: %d, Traffic used %d, traffic left %d") % (pyfile.size, tra - trb, trb))
+ self.logInfo(_("Filesize: %d, Traffic used %d, traffic left %d") % (self.pyfile.size, tra - trb, trb))
if err:
self.fail(err)
@@ -79,3 +76,6 @@ class PremiumTo(Hoster):
except:
traffic = 0
return traffic
+
+
+getInfo = create_getInfo(PremiumTo)
diff --git a/module/plugins/hoster/PremiumizeMe.py b/module/plugins/hoster/PremiumizeMe.py
index bf00325d9..f4a778897 100644
--- a/module/plugins/hoster/PremiumizeMe.py
+++ b/module/plugins/hoster/PremiumizeMe.py
@@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
from module.common.json_layer import json_loads
-from module.plugins.Hoster import Hoster
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
-class PremiumizeMe(Hoster):
+class PremiumizeMe(SimpleHoster):
__name__ = "PremiumizeMe"
__type__ = "hoster"
__version__ = "0.12"
@@ -16,41 +16,45 @@ class PremiumizeMe(Hoster):
__authors__ = [("Florian Franzen", "FlorianFranzen@gmail.com")]
- def process(self, pyfile):
- # Check account
- if not self.account or not self.account.canUse():
- self.logError(_("Please enter your %s account or deactivate this plugin") % "premiumize.me")
- self.fail(_("No valid premiumize.me account provided"))
-
+ def handleMulti(self):
# In some cases hostsers do not supply us with a filename at download, so we
# are going to set a fall back filename (e.g. for freakshare or xfileshare)
- pyfile.name = pyfile.name.split('/').pop() # Remove everthing before last slash
+ self.pyfile.name = self.pyfile.name.split('/').pop() # Remove everthing before last slash
# Correction for automatic assigned filename: Removing html at end if needed
suffix_to_remove = ["html", "htm", "php", "php3", "asp", "shtm", "shtml", "cfml", "cfm"]
- temp = pyfile.name.split('.')
+ temp = self.pyfile.name.split('.')
if temp.pop() in suffix_to_remove:
- pyfile.name = ".".join(temp)
+ self.pyfile.name = ".".join(temp)
# Get account data
- (user, data) = self.account.selectAccount()
+ user, data = self.account.selectAccount()
# Get rewritten link using the premiumize.me api v1 (see https://secure.premiumize.me/?show=api)
data = json_loads(self.load("https://api.premiumize.me/pm-api/v1.php",
get={'method' : "directdownloadlink",
'params[login]': user,
'params[pass]' : data['password'],
- 'params[link]' : pyfile.url}))
+ 'params[link]' : self.pyfile.url}))
# Check status and decide what to do
status = data['status']
+
if status == 200:
- self.download(data['result']['location'], disposition=True)
+ self.link = data['result']['location']
+ return
+
elif status == 400:
self.fail(_("Invalid link"))
+
elif status == 404:
self.offline()
+
elif status >= 500:
self.tempOffline()
+
else:
self.fail(data['statusmessage'])
+
+
+getInfo = create_getInfo(PremiumizeMe)
diff --git a/module/plugins/hoster/RPNetBiz.py b/module/plugins/hoster/RPNetBiz.py
index c4c16cf3c..3ef0d7585 100644
--- a/module/plugins/hoster/RPNetBiz.py
+++ b/module/plugins/hoster/RPNetBiz.py
@@ -2,11 +2,11 @@
import re
-from module.plugins.Hoster import Hoster
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
from module.common.json_layer import json_loads
-class RPNetBiz(Hoster):
+class RPNetBiz(SimpleHoster):
__name__ = "RPNetBiz"
__type__ = "hoster"
__version__ = "0.10"
@@ -19,67 +19,64 @@ class RPNetBiz(Hoster):
def setup(self):
- self.chunkLimit = -1
+ self.chunkLimit = -1
self.resumeDownload = True
- def process(self, pyfile):
- if re.match(self.__pattern__, pyfile.url):
- link_status = {'generated': pyfile.url}
- elif not self.account:
- # Check account
- self.logError(_("Please enter your %s account or deactivate this plugin") % "rpnet")
- self.fail(_("No rpnet account provided"))
- else:
- (user, data) = self.account.selectAccount()
-
- self.logDebug("Original URL: %s" % pyfile.url)
- # Get the download link
- res = self.load("https://premium.rpnet.biz/client_api.php",
- get={"username": user,
- "password": data['password'],
- "action": "generate",
- "links": pyfile.url})
-
- self.logDebug("JSON data: %s" % res)
- link_status = json_loads(res)['links'][0] # get the first link... since we only queried one
-
- # Check if we only have an id as a HDD link
- if 'id' in link_status:
- self.logDebug("Need to wait at least 30 seconds before requery")
- self.setWait(30) # wait for 30 seconds
+ def handleMulti(self):
+ user, data = self.account.selectAccount()
+
+ self.logDebug("Original URL: %s" % self.pyfile.url)
+ # Get the download link
+ res = self.load("https://premium.rpnet.biz/client_api.php",
+ get={"username": user,
+ "password": data['password'],
+ "action": "generate",
+ "links": self.pyfile.url})
+
+ self.logDebug("JSON data: %s" % res)
+ link_status = json_loads(res)['links'][0] # get the first link... since we only queried one
+
+ # Check if we only have an id as a HDD link
+ if 'id' in link_status:
+ self.logDebug("Need to wait at least 30 seconds before requery")
+ self.setWait(30) # wait for 30 seconds
+ self.wait()
+ # 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
+ my_try = 0
+ while (my_try <= max_tries):
+ self.logDebug("Try: %d ; Max Tries: %d" % (my_try, max_tries))
+ res = self.load("https://premium.rpnet.biz/client_api.php",
+ get={"username": user,
+ "password": data['password'],
+ "action": "downloadInformation",
+ "id": link_status['id']})
+ self.logDebug("JSON data hdd query: %s" % res)
+ download_status = json_loads(res)['download']
+
+ if download_status['status'] == '100':
+ link_status['generated'] = download_status['rpnet_link']
+ self.logDebug("Successfully downloaded to rpnet HDD: %s" % link_status['generated'])
+ break
+ else:
+ self.logDebug("At %s%% for the file download" % download_status['status'])
+
+ self.setWait(30)
self.wait()
- # 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
- my_try = 0
- while (my_try <= max_tries):
- self.logDebug("Try: %d ; Max Tries: %d" % (my_try, max_tries))
- res = self.load("https://premium.rpnet.biz/client_api.php",
- get={"username": user,
- "password": data['password'],
- "action": "downloadInformation",
- "id": link_status['id']})
- self.logDebug("JSON data hdd query: %s" % res)
- download_status = json_loads(res)['download']
-
- if download_status['status'] == '100':
- link_status['generated'] = download_status['rpnet_link']
- self.logDebug("Successfully downloaded to rpnet HDD: %s" % link_status['generated'])
- break
- else:
- self.logDebug("At %s%% for the file download" % download_status['status'])
-
- self.setWait(30)
- self.wait()
- my_try += 1
-
- if my_try > max_tries: # We went over the limit!
- self.fail(_("Waited for about 15 minutes for download to finish but failed"))
+ my_try += 1
+
+ if my_try > max_tries: # We went over the limit!
+ self.fail(_("Waited for about 15 minutes for download to finish but failed"))
if 'generated' in link_status:
- self.download(link_status['generated'], disposition=True)
+ self.link = link_status['generated']
+ return
elif 'error' in link_status:
self.fail(link_status['error'])
else:
self.fail(_("Something went wrong, not supposed to enter here"))
+
+
+getInfo = create_getInfo(RPNetBiz)
diff --git a/module/plugins/hoster/RealdebridCom.py b/module/plugins/hoster/RealdebridCom.py
index cc6dd49c3..7feacee28 100644
--- a/module/plugins/hoster/RealdebridCom.py
+++ b/module/plugins/hoster/RealdebridCom.py
@@ -7,11 +7,11 @@ from urllib import quote, unquote
from time import time
from module.common.json_layer import json_loads
-from module.plugins.Hoster import Hoster
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
from module.utils import parseFileSize
-class RealdebridCom(Hoster):
+class RealdebridCom(SimpleHoster):
__name__ = "RealdebridCom"
__type__ = "hoster"
__version__ = "0.53"
@@ -34,61 +34,57 @@ class RealdebridCom(Hoster):
def setup(self):
- self.chunkLimit = 3
+ self.chunkLimit = 3
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") % "Real-debrid")
- self.fail(_("No Real-debrid account provided"))
+ def handleMulti(self):
+ password = self.getPassword().splitlines()
+ if not password:
+ password = ""
else:
- self.logDebug("Old URL: %s" % pyfile.url)
- password = self.getPassword().splitlines()
- if not password:
- password = ""
- else:
- password = password[0]
-
- data = json_loads(self.load("https://real-debrid.com/ajax/unrestrict.php",
- get={'lang' : "en",
- 'link' : quote(pyfile.url, ""),
- 'password': password,
- 'time' : int(time() * 1000)}))
-
- self.logDebug("Returned Data: %s" % data)
-
- if data['error'] != 0:
- if data['message'] == "Your file is unavailable on the hoster.":
- self.offline()
- else:
- self.logWarning(data['message'])
- self.tempOffline()
+ password = password[0]
+
+ data = json_loads(self.load("https://real-debrid.com/ajax/unrestrict.php",
+ get={'lang' : "en",
+ 'link' : quote(self.pyfile.url, ""),
+ 'password': password,
+ 'time' : int(time() * 1000)}))
+
+ self.logDebug("Returned Data: %s" % data)
+
+ if data['error'] != 0:
+ if data['message'] == "Your file is unavailable on the hoster.":
+ self.offline()
else:
- if pyfile.name is not None and pyfile.name.endswith('.tmp') and data['file_name']:
- pyfile.name = data['file_name']
- pyfile.size = parseFileSize(data['file_size'])
- new_url = data['generated_links'][0][-1]
+ self.logWarning(data['message'])
+ self.tempOffline()
+ else:
+ if self.pyfile.name is not None and self.pyfile.name.endswith('.tmp') and data['file_name']:
+ self.pyfile.name = data['file_name']
+ self.pyfile.size = parseFileSize(data['file_size'])
+ self.link = data['generated_links'][0][-1]
if self.getConfig("https"):
- new_url = new_url.replace("http://", "https://")
+ self.link = self.link.replace("http://", "https://")
else:
- new_url = new_url.replace("https://", "http://")
+ self.link = self.link.replace("https://", "http://")
- if new_url != pyfile.url:
- self.logDebug("New URL: %s" % new_url)
+ if self.link != self.pyfile.url:
+ self.logDebug("New URL: %s" % self.link)
- if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown") or pyfile.name.endswith('..'):
+ if self.pyfile.name.startswith("http") or self.pyfile.name.startswith("Unknown") or self.pyfile.name.endswith('..'):
#only use when name wasnt already set
- pyfile.name = self.getFilename(new_url)
+ self.pyfile.name = self.getFilename(self.link)
- self.download(new_url, disposition=True)
+ def checkFile(self):
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(wait_time=60, reason=_("An error occured while generating link"))
+
+
+getInfo = create_getInfo(RealdebridCom)
diff --git a/module/plugins/hoster/RehostTo.py b/module/plugins/hoster/RehostTo.py
index 7cde01025..067dd8dbe 100644
--- a/module/plugins/hoster/RehostTo.py
+++ b/module/plugins/hoster/RehostTo.py
@@ -2,10 +2,10 @@
from urllib import quote, unquote
-from module.plugins.Hoster import Hoster
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
-class RehostTo(Hoster):
+class RehostTo(SimpleHoster):
__name__ = "RehostTo"
__type__ = "hoster"
__version__ = "0.13"
@@ -22,23 +22,21 @@ class RehostTo(Hoster):
def setup(self):
- self.chunkLimit = 1
+ self.chunkLimit = 1
self.resumeDownload = True
- def process(self, pyfile):
- if not self.account:
- self.logError(_("Please enter your %s account or deactivate this plugin") % "rehost.to")
- self.fail(_("No rehost.to account provided"))
-
+ def handleMulti(self):
data = self.account.getAccountInfo(self.user)
long_ses = data['long_ses']
- self.logDebug("Rehost.to: Old URL: %s" % pyfile.url)
-
#raise timeout to 2min
self.req.setOption("timeout", 120)
+ self.link = True
self.download("http://rehost.to/process_download.php",
- get={'user': "cookie", 'pass': long_ses, 'dl': quote(pyfile.url, "")},
+ get={'user': "cookie", 'pass': long_ses, 'dl': quote(self.pyfile.url, "")},
disposition=True)
+
+
+getInfo = create_getInfo(RehostTo)
diff --git a/module/plugins/hoster/SimplyPremiumCom.py b/module/plugins/hoster/SimplyPremiumCom.py
index bc37f45c8..c7eed0680 100644
--- a/module/plugins/hoster/SimplyPremiumCom.py
+++ b/module/plugins/hoster/SimplyPremiumCom.py
@@ -4,11 +4,11 @@ import re
from datetime import datetime, timedelta
-from module.plugins.Hoster import Hoster
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
from module.plugins.hoster.UnrestrictLi import secondsToMidnight
-class SimplyPremiumCom(Hoster):
+class SimplyPremiumCom(SimpleHoster):
__name__ = "SimplyPremiumCom"
__type__ = "hoster"
__version__ = "0.03"
@@ -21,62 +21,57 @@ class SimplyPremiumCom(Hoster):
def setup(self):
- self.chunkLimit = 16
+ self.chunkLimit = 16
self.resumeDownload = False
- 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") % "Simply-Premium.com")
- self.fail(_("No Simply-Premium.com account provided"))
+ def handleMulti(self):
+ for i in xrange(5):
+ page = self.load("http://www.simply-premium.com/premium.php", get={'info': "", 'link': self.pyfile.url})
+ self.logDebug("JSON data: " + page)
+ if page != '':
+ break
else:
- self.logDebug("Old URL: %s" % pyfile.url)
- for i in xrange(5):
- page = self.load("http://www.simply-premium.com/premium.php", get={'info': "", 'link': pyfile.url})
- self.logDebug("JSON data: " + page)
- if page != '':
- break
- else:
- self.logInfo(_("Unable to get API data, waiting 1 minute and retry"))
- self.retry(5, 60, "Unable to get API data")
-
- if '<valid>0</valid>' in page or (
- "You are not allowed to download from this host" in page and self.premium):
- self.account.relogin(self.user)
- self.retry()
- elif "NOTFOUND" in page:
- self.offline()
- elif "downloadlimit" in page:
- self.logWarning(_("Reached maximum connctions"))
- self.retry(5, 60, "Reached maximum connctions")
- elif "trafficlimit" in page:
- self.logWarning(_("Reached daily limit for this host"))
- self.retry(wait_time=secondsToMidnight(gmt=2), "Daily limit for this host reached")
- elif "hostererror" in page:
- self.logWarning(_("Hoster temporarily unavailable, waiting 1 minute and retry"))
- self.retry(5, 60, "Hoster is temporarily unavailable")
- #page = json_loads(page)
- #new_url = page.keys()[0]
- #self.api_data = page[new_url]
-
- try:
- self.pyfile.name = re.search(r'<name>([^<]+)</name>', page).group(1)
- except AttributeError:
- self.pyfile.name = ""
-
- try:
- self.pyfile.size = re.search(r'<size>(\d+)</size>', page).group(1)
- except AttributeError:
- self.pyfile.size = 0
-
- try:
- new_url = re.search(r'<download>([^<]+)</download>', page).group(1)
- except AttributeError:
- new_url = 'http://www.simply-premium.com/premium.php?link=' + pyfile.url
-
- if new_url != pyfile.url:
- self.logDebug("New URL: " + new_url)
-
- self.download(new_url, disposition=True)
+ self.logInfo(_("Unable to get API data, waiting 1 minute and retry"))
+ self.retry(5, 60, "Unable to get API data")
+
+ if '<valid>0</valid>' in page or (
+ "You are not allowed to download from this host" in page and self.premium):
+ self.account.relogin(self.user)
+ self.retry()
+
+ elif "NOTFOUND" in page:
+ self.offline()
+
+ elif "downloadlimit" in page:
+ self.logWarning(_("Reached maximum connctions"))
+ self.retry(5, 60, "Reached maximum connctions")
+
+ elif "trafficlimit" in page:
+ self.logWarning(_("Reached daily limit for this host"))
+ self.retry(wait_time=secondsToMidnight(gmt=2), "Daily limit for this host reached")
+
+ elif "hostererror" in page:
+ self.logWarning(_("Hoster temporarily unavailable, waiting 1 minute and retry"))
+ self.retry(5, 60, "Hoster is temporarily unavailable")
+
+ try:
+ self.pyfile.name = re.search(r'<name>([^<]+)</name>', page).group(1)
+ except AttributeError:
+ self.pyfile.name = ""
+
+ try:
+ self.pyfile.size = re.search(r'<size>(\d+)</size>', page).group(1)
+ except AttributeError:
+ self.pyfile.size = 0
+
+ try:
+ self.link = re.search(r'<download>([^<]+)</download>', page).group(1)
+ except AttributeError:
+ self.link = 'http://www.simply-premium.com/premium.php?link=' + self.pyfile.url
+
+ if self.link != self.pyfile.url:
+ self.logDebug("New URL: " + self.link)
+
+
+getInfo = create_getInfo(SimplyPremiumCom)
diff --git a/module/plugins/hoster/SimplydebridCom.py b/module/plugins/hoster/SimplydebridCom.py
index 0fe4ae0f8..6f3ecfc42 100644
--- a/module/plugins/hoster/SimplydebridCom.py
+++ b/module/plugins/hoster/SimplydebridCom.py
@@ -2,10 +2,10 @@
import re
-from module.plugins.Hoster import Hoster
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
-class SimplydebridCom(Hoster):
+class SimplydebridCom(SimpleHoster):
__name__ = "SimplydebridCom"
__type__ = "hoster"
__version__ = "0.10"
@@ -23,42 +23,39 @@ class SimplydebridCom(Hoster):
self.chunkLimit = 1
- def process(self, pyfile):
- if not self.account:
- self.logError(_("Please enter your %s account or deactivate this plugin") % "simply-debrid.com")
- self.fail(_("No simply-debrid.com account provided"))
+ def handleMulti(self):
+ #fix the links for simply-debrid.com!
+ self.link = self.pyfile.url
+ self.link = self.link.replace("clz.to", "cloudzer.net/file")
+ self.link = self.link.replace("http://share-online", "http://www.share-online")
+ self.link = self.link.replace("ul.to", "uploaded.net/file")
+ self.link = self.link.replace("uploaded.com", "uploaded.net")
+ self.link = self.link.replace("filerio.com", "filerio.in")
+ self.link = self.link.replace("lumfile.com", "lumfile.se")
- self.logDebug("Old URL: %s" % pyfile.url)
+ if('fileparadox' in self.link):
+ self.link = self.link.replace("http://", "https://")
- #fix the links for simply-debrid.com!
- new_url = pyfile.url
- new_url = new_url.replace("clz.to", "cloudzer.net/file")
- new_url = new_url.replace("http://share-online", "http://www.share-online")
- new_url = new_url.replace("ul.to", "uploaded.net/file")
- new_url = new_url.replace("uploaded.com", "uploaded.net")
- new_url = new_url.replace("filerio.com", "filerio.in")
- new_url = new_url.replace("lumfile.com", "lumfile.se")
- if('fileparadox' in new_url):
- new_url = new_url.replace("http://", "https://")
-
- if re.match(self.__pattern__, new_url):
- new_url = new_url
-
- self.logDebug("New URL: %s" % new_url)
-
- if not re.match(self.__pattern__, new_url):
- page = self.load("http://simply-debrid.com/api.php", get={'dl': new_url}) # +'&u='+self.user+'&p='+self.account.getAccountData(self.user)['password'])
+ if re.match(self.__pattern__, self.link):
+ self.link = self.link
+
+ self.logDebug("New URL: %s" % self.link)
+
+ if not re.match(self.__pattern__, self.link):
+ page = self.load("http://simply-debrid.com/api.php", get={'dl': self.link}) # +'&u='+self.user+'&p='+self.account.getAccountData(self.user)['password'])
if 'tiger Link' in page or 'Invalid Link' in page or ('API' in page and 'ERROR' in page):
self.fail(_("Unable to unrestrict link"))
- new_url = page
+ self.link = page
self.setWait(5)
self.wait()
- self.logDebug("Unrestricted URL: " + new_url)
- self.download(new_url, disposition=True)
+ def checkFile(self):
check = self.checkDownload({"bad1": "No address associated with hostname", "bad2": "<html"})
if check == "bad1" or check == "bad2":
self.retry(24, 3 * 60, "Bad file downloaded")
+
+
+getInfo = create_getInfo(SimplydebridCom)
diff --git a/module/plugins/hoster/UnrestrictLi.py b/module/plugins/hoster/UnrestrictLi.py
index 786e25a9a..d0a03d7ec 100644
--- a/module/plugins/hoster/UnrestrictLi.py
+++ b/module/plugins/hoster/UnrestrictLi.py
@@ -5,7 +5,7 @@ import re
from datetime import datetime, timedelta
from module.common.json_layer import json_loads
-from module.plugins.Hoster import Hoster
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
def secondsToMidnight(gmt=0):
@@ -26,7 +26,7 @@ def secondsToMidnight(gmt=0):
return int(res)
-class UnrestrictLi(Hoster):
+class UnrestrictLi(SimpleHoster):
__name__ = "UnrestrictLi"
__type__ = "hoster"
__version__ = "0.14"
@@ -39,53 +39,53 @@ class UnrestrictLi(Hoster):
def setup(self):
- self.chunkLimit = 16
+ self.chunkLimit = 16
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") % "Unrestrict.li")
- self.fail(_("No Unrestrict.li account provided"))
+ def handleMulti(self):
+ for _i in xrange(5):
+ page = self.load('https://unrestrict.li/unrestrict.php',
+ post={'link': self.pyfile.url, 'domain': 'long'})
+ self.logDebug("JSON data: " + page)
+ if page != '':
+ break
else:
- self.logDebug("Old URL: %s" % pyfile.url)
- for _i in xrange(5):
- page = self.load('https://unrestrict.li/unrestrict.php',
- post={'link': pyfile.url, 'domain': 'long'})
- self.logDebug("JSON data: " + page)
- if page != '':
- break
- else:
- self.logInfo(_("Unable to get API data, waiting 1 minute and retry"))
- self.retry(5, 60, "Unable to get API data")
-
- if 'Expired session' in page or ("You are not allowed to "
- "download from this host" in page and self.premium):
- self.account.relogin(self.user)
- self.retry()
- elif "File offline" in page:
- self.offline()
- elif "You are not allowed to download from this host" in page:
- self.fail(_("You are not allowed to download from this host"))
- elif "You have reached your daily limit for this host" in page:
- self.logWarning(_("Reached daily limit for this host"))
- self.retry(5, secondsToMidnight(gmt=2), "Daily limit for this host reached")
- elif "ERROR_HOSTER_TEMPORARILY_UNAVAILABLE" in page:
- self.logInfo(_("Hoster temporarily unavailable, waiting 1 minute and retry"))
- self.retry(5, 60, "Hoster is temporarily unavailable")
- page = json_loads(page)
- new_url = page.keys()[0]
- self.api_data = page[new_url]
-
- if new_url != pyfile.url:
- self.logDebug("New URL: " + new_url)
+ self.logInfo(_("Unable to get API data, waiting 1 minute and retry"))
+ self.retry(5, 60, "Unable to get API data")
+
+ if 'Expired session' in page or ("You are not allowed to "
+ "download from this host" in page and self.premium):
+ self.account.relogin(self.user)
+ self.retry()
+
+ elif "File offline" in page:
+ self.offline()
+
+ elif "You are not allowed to download from this host" in page:
+ self.fail(_("You are not allowed to download from this host"))
+
+ elif "You have reached your daily limit for this host" in page:
+ self.logWarning(_("Reached daily limit for this host"))
+ self.retry(5, secondsToMidnight(gmt=2), "Daily limit for this host reached")
+
+ elif "ERROR_HOSTER_TEMPORARILY_UNAVAILABLE" in page:
+ self.logInfo(_("Hoster temporarily unavailable, waiting 1 minute and retry"))
+ self.retry(5, 60, "Hoster is temporarily unavailable")
+
+ page = json_loads(page)
+ self.link = page.keys()[0]
+ self.api_data = page[self.link]
+
+ if self.link != self.pyfile.url:
+ self.logDebug("New URL: " + self.link)
if hasattr(self, 'api_data'):
self.setNameSize()
- self.download(new_url, disposition=True)
+
+ def checkFile(self):
+ super(UnrestrictLi, self).checkFile()
if self.getConfig("history"):
self.load("https://unrestrict.li/history/", get={'delete': "all"})
@@ -97,3 +97,6 @@ class UnrestrictLi(Hoster):
self.pyfile.name = self.api_data['name']
if 'size' in self.api_data:
self.pyfile.size = self.api_data['size']
+
+
+getInfo = create_getInfo(UnrestrictLi)
diff --git a/module/plugins/hoster/ZeveraCom.py b/module/plugins/hoster/ZeveraCom.py
index fa2f6edb3..cc55c6955 100644
--- a/module/plugins/hoster/ZeveraCom.py
+++ b/module/plugins/hoster/ZeveraCom.py
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
-from module.plugins.Hoster import Hoster
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
-class ZeveraCom(Hoster):
+class ZeveraCom(SimpleHoster):
__name__ = "ZeveraCom"
__type__ = "hoster"
__version__ = "0.21"
@@ -21,22 +21,22 @@ class ZeveraCom(Hoster):
self.chunkLimit = 1
- def process(self, pyfile):
- if not self.account:
- self.logError(_("Please enter your %s account or deactivate this plugin") % "zevera.com")
- self.fail(_("No zevera.com account provided"))
+ def handleMulti(self):
+ if self.account.getAPIData(self.req, cmd="checklink", olink=self.pyfile.url) != "Alive":
+ self.fail(_("Offline or not downloadable"))
- self.logDebug("Old URL: %s" % pyfile.url)
-
- if self.account.getAPIData(self.req, cmd="checklink", olink=pyfile.url) != "Alive":
- self.fail(_("Offline or not downloadable - contact Zevera support"))
-
- header = self.account.getAPIData(self.req, just_header=True, cmd="generatedownloaddirect", olink=pyfile.url)
+ header = self.account.getAPIData(self.req, just_header=True, cmd="generatedownloaddirect", olink=self.pyfile.url)
if not "location" in header:
self.fail(_("Unable to initialize download"))
- self.download(header['location'], disposition=True)
+ self.link = header['location']
+
+ def checkFile(self):
check = self.checkDownload({"error": 'action="ErrorDownload.aspx'})
+
if check == "error":
self.fail(_("Error response received - contact Zevera support"))
+
+
+getInfo = create_getInfo(ZeveraCom)