summaryrefslogtreecommitdiffstats
path: root/module/plugins
diff options
context:
space:
mode:
authorGravatar Ivo Buff <kagenoshin@gmx.ch> 2013-07-12 00:45:36 +0200
committerGravatar Ivo Buff <kagenoshin@gmx.ch> 2013-07-12 00:45:36 +0200
commit834a315649a0090812118f34618e48aff160c162 (patch)
treedecb07cad8093a050af0b9bdd1b896a981ab56ec /module/plugins
parentNew crypter requested in #186 (diff)
downloadpyload-834a315649a0090812118f34618e48aff160c162.tar.xz
SimplydebridCOM plugin added
SimplydebridCOM plugin added
Diffstat (limited to 'module/plugins')
-rw-r--r--module/plugins/accounts/SimplydebridCOM.py39
-rw-r--r--module/plugins/hooks/SimplydebridCOM.py19
-rw-r--r--module/plugins/hoster/SimplydebridCOM.py50
3 files changed, 108 insertions, 0 deletions
diff --git a/module/plugins/accounts/SimplydebridCOM.py b/module/plugins/accounts/SimplydebridCOM.py
new file mode 100644
index 000000000..1679187f6
--- /dev/null
+++ b/module/plugins/accounts/SimplydebridCOM.py
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+from module.plugins.Account import Account
+
+import re
+from time import mktime, strptime
+
+class SimplydebridCOM(Account):
+ __name__ = "SimplydebridCOM"
+ __version__ = "0.1"
+ __type__ = "account"
+ __description__ = """Simply-Debrid.com account plugin"""
+ __author_name__ = ("Kagenoshin")
+ __author_mail__ = ("kagenoshin@gmx.ch")
+
+ def loadAccountInfo(self, user, req):
+ get_data = {
+ }
+ response = req.load("http://simply-debrid.com/api.php?login=2&u="+self.loginname+"&p="+self.password, get = get_data, decode = True, just_header = False)
+ if(response[len(response)-1] == ";"): #remove ; if the v entry ends with ;
+ response = response[0:len(response)-1]
+ data = [x.strip() for x in response.split(";")]
+ if str(data[0]) != "1":
+ account_info = {"trafficleft": 0, "validuntil": 0, "premium": False}
+ else:
+ account_info = {
+ "trafficleft": -1,
+ "validuntil": mktime(strptime(str(data[2]),"%d/%m/%Y")),
+ "premium": True
+ }
+ return account_info
+
+ def login(self, user, data, req):
+ self.loginname = user
+ self.password = data["password"]
+ get_data = {
+ }
+ response = req.load("http://simply-debrid.com/api.php?login=1&u="+self.loginname+"&p="+self.password, get = get_data, decode = True, just_header = False)
+ if response != "02: loggin success":
+ self.wrongPassword() \ No newline at end of file
diff --git a/module/plugins/hooks/SimplydebridCOM.py b/module/plugins/hooks/SimplydebridCOM.py
new file mode 100644
index 000000000..af415db23
--- /dev/null
+++ b/module/plugins/hooks/SimplydebridCOM.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+
+from module.network.RequestFactory import getURL
+from module.plugins.internal.MultiHoster import MultiHoster
+
+class SimplydebridCOM(MultiHoster):
+ __name__ = "SimplydebridCOM"
+ __version__ = "0.01"
+ __type__ = "hook"
+ __config__ = [("activated", "bool", "Activated", "False"),("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"),("hosterList", "str", "Hoster list (comma separated)", "")]
+ __description__ = """Simply-Debrid.com hook plugin"""
+ __author_name__ = ("Kagenoshin")
+ __author_mail__ = ("kagenoshin@gmx.ch")
+
+ def getHoster(self):
+ page = getURL("http://simply-debrid.com/api.php?list=1")
+ if(page[len(page)-1] == ";"): #remove ; if the page entry ends with ;
+ page = page[0:len(page)-1]
+ return [x.strip() for x in page.replace("\"","").split(";")] \ No newline at end of file
diff --git a/module/plugins/hoster/SimplydebridCOM.py b/module/plugins/hoster/SimplydebridCOM.py
new file mode 100644
index 000000000..262b0b607
--- /dev/null
+++ b/module/plugins/hoster/SimplydebridCOM.py
@@ -0,0 +1,50 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from module.plugins.Hoster import Hoster
+from module.utils import html_unescape
+from urllib import quote, unquote
+from time import sleep
+import re
+
+class SimplydebridCOM(Hoster):
+ __name__ = "SimplydebridCOM"
+ __version__ = "0.1"
+ __type__ = "hoster"
+ __pattern__ = r"http://\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/sd.php/*"
+ __description__ = """simply-debrid.com hoster plugin"""
+ __author_name__ = ("Kagenoshin")
+ __author_mail__ = ("kagenoshin@gmx.ch")
+
+ def setup(self):
+ self.resumeDownload = self.multiDL = True
+ self.chunkLimit = 1
+
+ def process(self, pyfile):
+ #print pyfile.url
+ if not self.account:
+ self.logError(_("Please enter your simply-debrid.com account or deactivate this plugin"))
+ self.fail("No simply-debrid.com account provided")
+
+ self.logDebug("simply-debrid.com: Old URL: %s" % pyfile.url)
+
+ #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")
+
+ if re.match(self.__pattern__, new_url):
+ new_url = new_url
+ else:
+ page = self.req.load('http://simply-debrid.com/api.php?dl='+new_url)#+'&u='+self.user+'&p='+self.account.getAccountData(self.user)['password'])
+ if(re.search(r'tiger\sLink',page,re.I) or re.search(r'Invalid\sLink',page,re.I) or (re.search(r'api',page,re.I) and re.search(r'error',page,re.I))):
+ self.fail('Unable to unrestrict link')
+ #print page
+ new_url = page
+
+ #print new_url
+ self.setWait(5)
+ self.wait()
+ self.logDebug("Unrestricted URL: " + new_url)
+
+ self.download(new_url, disposition=True) \ No newline at end of file