summaryrefslogtreecommitdiffstats
path: root/module/plugins/accounts
diff options
context:
space:
mode:
authorGravatar Stefano <l.stickell@yahoo.it> 2013-07-21 12:58:42 +0200
committerGravatar Stefano <l.stickell@yahoo.it> 2013-07-21 12:58:42 +0200
commit37d898f681e41fe9c9a8719a540eda59bfedd448 (patch)
treefaecf5455aa91155ed7c762701221f171d14bb0d /module/plugins/accounts
parentUsing the same translatable string (diff)
downloadpyload-37d898f681e41fe9c9a8719a540eda59bfedd448.tar.xz
Normalize line endings to avoid line endings merge conflicts
Diffstat (limited to 'module/plugins/accounts')
-rw-r--r--module/plugins/accounts/AlldebridCom.py78
-rw-r--r--module/plugins/accounts/Premium4Me.py44
-rw-r--r--module/plugins/accounts/PremiumizeMe.py88
-rw-r--r--module/plugins/accounts/RealdebridCom.py50
-rw-r--r--module/plugins/accounts/UploadheroCom.py68
-rw-r--r--module/plugins/accounts/X7To.py132
6 files changed, 230 insertions, 230 deletions
diff --git a/module/plugins/accounts/AlldebridCom.py b/module/plugins/accounts/AlldebridCom.py
index beaddeac9..baaa9d264 100644
--- a/module/plugins/accounts/AlldebridCom.py
+++ b/module/plugins/accounts/AlldebridCom.py
@@ -1,46 +1,46 @@
-from module.plugins.Account import Account
-import xml.dom.minidom as dom
-from BeautifulSoup import BeautifulSoup
-from time import time
-import re
+from module.plugins.Account import Account
+import xml.dom.minidom as dom
+from BeautifulSoup import BeautifulSoup
+from time import time
+import re
import urllib
-
-class AlldebridCom(Account):
- __name__ = "AlldebridCom"
- __version__ = "0.21"
- __type__ = "account"
- __description__ = """AllDebrid.com account plugin"""
- __author_name__ = ("Andy, Voigt")
- __author_mail__ = ("spamsales@online.de")
-
- def loadAccountInfo(self, user, req):
- data = self.getAccountData(user)
- page = req.load("http://www.alldebrid.com/account/")
- soup=BeautifulSoup(page)
- #Try to parse expiration date directly from the control panel page (better accuracy)
- try:
- time_text=soup.find('div',attrs={'class':'remaining_time_text'}).strong.string
- self.log.debug("Account expires in: %s" % time_text)
- p = re.compile('\d+')
- exp_data=p.findall(time_text)
- exp_time=time()+int(exp_data[0])*24*60*60+int(exp_data[1])*60*60+(int(exp_data[2])-1)*60
- #Get expiration date from API
- except:
- data = self.getAccountData(user)
- page = req.load("http://www.alldebrid.com/api.php?action=info_user&login=%s&pw=%s" % (user, data["password"]))
- self.log.debug(page)
- xml = dom.parseString(page)
- exp_time=time()+int(xml.getElementsByTagName("date")[0].childNodes[0].nodeValue)*86400
- account_info = {"validuntil": exp_time, "trafficleft": -1}
- return account_info
-
- def login(self, user, data, req):
+
+class AlldebridCom(Account):
+ __name__ = "AlldebridCom"
+ __version__ = "0.21"
+ __type__ = "account"
+ __description__ = """AllDebrid.com account plugin"""
+ __author_name__ = ("Andy, Voigt")
+ __author_mail__ = ("spamsales@online.de")
+
+ def loadAccountInfo(self, user, req):
+ data = self.getAccountData(user)
+ page = req.load("http://www.alldebrid.com/account/")
+ soup=BeautifulSoup(page)
+ #Try to parse expiration date directly from the control panel page (better accuracy)
+ try:
+ time_text=soup.find('div',attrs={'class':'remaining_time_text'}).strong.string
+ self.log.debug("Account expires in: %s" % time_text)
+ p = re.compile('\d+')
+ exp_data=p.findall(time_text)
+ exp_time=time()+int(exp_data[0])*24*60*60+int(exp_data[1])*60*60+(int(exp_data[2])-1)*60
+ #Get expiration date from API
+ except:
+ data = self.getAccountData(user)
+ page = req.load("http://www.alldebrid.com/api.php?action=info_user&login=%s&pw=%s" % (user, data["password"]))
+ self.log.debug(page)
+ xml = dom.parseString(page)
+ exp_time=time()+int(xml.getElementsByTagName("date")[0].childNodes[0].nodeValue)*86400
+ account_info = {"validuntil": exp_time, "trafficleft": -1}
+ return account_info
+
+ def login(self, user, data, req):
urlparams = urllib.urlencode({'action':'login','login_login':user,'login_password':data["password"]})
page = req.load("http://www.alldebrid.com/register/?%s" % (urlparams))
-
- if "This login doesn't exist" in page:
- self.wrongPassword()
+
+ if "This login doesn't exist" in page:
+ self.wrongPassword()
if "The password is not valid" in page:
self.wrongPassword()
diff --git a/module/plugins/accounts/Premium4Me.py b/module/plugins/accounts/Premium4Me.py
index c95b9b129..fbca3ce84 100644
--- a/module/plugins/accounts/Premium4Me.py
+++ b/module/plugins/accounts/Premium4Me.py
@@ -1,23 +1,23 @@
-from module.plugins.Account import Account
-
-class Premium4Me(Account):
- __name__ = "Premium4Me"
- __version__ = "0.03"
- __type__ = "account"
- __description__ = """Premium.to account plugin"""
- __author_name__ = ("RaNaN", "zoidberg", "stickell")
- __author_mail__ = ("RaNaN@pyload.org", "zoidberg@mujmail.cz", "l.stickell@yahoo.it")
-
- def loadAccountInfo(self, user, req):
- traffic = req.load("http://premium.to/api/traffic.php?authcode=%s" % self.authcode)
-
- account_info = {"trafficleft": int(traffic) / 1024,
- "validuntil": -1}
-
- return account_info
-
- def login(self, user, data, req):
- self.authcode = req.load("http://premium.to/api/getauthcode.php?username=%s&password=%s" % (user, data["password"])).strip()
-
- if "wrong username" in self.authcode:
+from module.plugins.Account import Account
+
+class Premium4Me(Account):
+ __name__ = "Premium4Me"
+ __version__ = "0.03"
+ __type__ = "account"
+ __description__ = """Premium.to account plugin"""
+ __author_name__ = ("RaNaN", "zoidberg", "stickell")
+ __author_mail__ = ("RaNaN@pyload.org", "zoidberg@mujmail.cz", "l.stickell@yahoo.it")
+
+ def loadAccountInfo(self, user, req):
+ traffic = req.load("http://premium.to/api/traffic.php?authcode=%s" % self.authcode)
+
+ account_info = {"trafficleft": int(traffic) / 1024,
+ "validuntil": -1}
+
+ return account_info
+
+ def login(self, user, data, req):
+ self.authcode = req.load("http://premium.to/api/getauthcode.php?username=%s&password=%s" % (user, data["password"])).strip()
+
+ if "wrong username" in self.authcode:
self.wrongPassword() \ No newline at end of file
diff --git a/module/plugins/accounts/PremiumizeMe.py b/module/plugins/accounts/PremiumizeMe.py
index 1a446b842..696fdf88f 100644
--- a/module/plugins/accounts/PremiumizeMe.py
+++ b/module/plugins/accounts/PremiumizeMe.py
@@ -1,44 +1,44 @@
-from module.plugins.Account import Account
-
-from module.common.json_layer import json_loads
-
-class PremiumizeMe(Account):
- __name__ = "PremiumizeMe"
- __version__ = "0.11"
- __type__ = "account"
- __description__ = """Premiumize.Me account plugin"""
-
- __author_name__ = ("Florian Franzen")
- __author_mail__ = ("FlorianFranzen@gmail.com")
-
- def loadAccountInfo(self, user, req):
-
- # Get user data from premiumize.me
- status = self.getAccountStatus(user, req)
- self.logDebug(status)
-
- # Parse account info
- account_info = {"validuntil": float(status['result']['expires']),
- "trafficleft": max(0, status['result']['trafficleft_bytes'] / 1024)}
-
- if status['result']['type'] == 'free':
- account_info['premium'] = False
-
- return account_info
-
- def login(self, user, data, req):
-
- # Get user data from premiumize.me
- status = self.getAccountStatus(user, req)
-
- # Check if user and password are valid
- if status['status'] != 200:
- self.wrongPassword()
-
-
- def getAccountStatus(self, user, req):
-
- # Use premiumize.me API v1 (see https://secure.premiumize.me/?show=api) to retrieve account info and return the parsed json answer
- answer = req.load("https://api.premiumize.me/pm-api/v1.php?method=accountstatus&params[login]=%s&params[pass]=%s" % (user, self.accounts[user]['password']))
- return json_loads(answer)
-
+from module.plugins.Account import Account
+
+from module.common.json_layer import json_loads
+
+class PremiumizeMe(Account):
+ __name__ = "PremiumizeMe"
+ __version__ = "0.11"
+ __type__ = "account"
+ __description__ = """Premiumize.Me account plugin"""
+
+ __author_name__ = ("Florian Franzen")
+ __author_mail__ = ("FlorianFranzen@gmail.com")
+
+ def loadAccountInfo(self, user, req):
+
+ # Get user data from premiumize.me
+ status = self.getAccountStatus(user, req)
+ self.logDebug(status)
+
+ # Parse account info
+ account_info = {"validuntil": float(status['result']['expires']),
+ "trafficleft": max(0, status['result']['trafficleft_bytes'] / 1024)}
+
+ if status['result']['type'] == 'free':
+ account_info['premium'] = False
+
+ return account_info
+
+ def login(self, user, data, req):
+
+ # Get user data from premiumize.me
+ status = self.getAccountStatus(user, req)
+
+ # Check if user and password are valid
+ if status['status'] != 200:
+ self.wrongPassword()
+
+
+ def getAccountStatus(self, user, req):
+
+ # Use premiumize.me API v1 (see https://secure.premiumize.me/?show=api) to retrieve account info and return the parsed json answer
+ answer = req.load("https://api.premiumize.me/pm-api/v1.php?method=accountstatus&params[login]=%s&params[pass]=%s" % (user, self.accounts[user]['password']))
+ return json_loads(answer)
+
diff --git a/module/plugins/accounts/RealdebridCom.py b/module/plugins/accounts/RealdebridCom.py
index adbd090db..847a925d4 100644
--- a/module/plugins/accounts/RealdebridCom.py
+++ b/module/plugins/accounts/RealdebridCom.py
@@ -1,25 +1,25 @@
-from module.plugins.Account import Account
-import xml.dom.minidom as dom
-
-class RealdebridCom(Account):
- __name__ = "RealdebridCom"
- __version__ = "0.41"
- __type__ = "account"
- __description__ = """Real-Debrid.com account plugin"""
- __author_name__ = ("Devirex, Hazzard")
- __author_mail__ = ("naibaf_11@yahoo.de")
-
- def loadAccountInfo(self, user, req):
- page = req.load("http://real-debrid.com/api/account.php")
- xml = dom.parseString(page)
- account_info = {"validuntil": int(xml.getElementsByTagName("expiration")[0].childNodes[0].nodeValue),
- "trafficleft": -1}
-
- return account_info
-
- def login(self, user, data, req):
- page = req.load("https://real-debrid.com/ajax/login.php", get = {"user": user, "pass": data["password"]})
- #page = req.load("https://real-debrid.com/login.html", post={"user": user, "pass": data["password"]}, cookies=True)
-
- if "Your login informations are incorrect" in page:
- self.wrongPassword()
+from module.plugins.Account import Account
+import xml.dom.minidom as dom
+
+class RealdebridCom(Account):
+ __name__ = "RealdebridCom"
+ __version__ = "0.41"
+ __type__ = "account"
+ __description__ = """Real-Debrid.com account plugin"""
+ __author_name__ = ("Devirex, Hazzard")
+ __author_mail__ = ("naibaf_11@yahoo.de")
+
+ def loadAccountInfo(self, user, req):
+ page = req.load("http://real-debrid.com/api/account.php")
+ xml = dom.parseString(page)
+ account_info = {"validuntil": int(xml.getElementsByTagName("expiration")[0].childNodes[0].nodeValue),
+ "trafficleft": -1}
+
+ return account_info
+
+ def login(self, user, data, req):
+ page = req.load("https://real-debrid.com/ajax/login.php", get = {"user": user, "pass": data["password"]})
+ #page = req.load("https://real-debrid.com/login.html", post={"user": user, "pass": data["password"]}, cookies=True)
+
+ if "Your login informations are incorrect" in page:
+ self.wrongPassword()
diff --git a/module/plugins/accounts/UploadheroCom.py b/module/plugins/accounts/UploadheroCom.py
index f1e0649e6..18ed69ae6 100644
--- a/module/plugins/accounts/UploadheroCom.py
+++ b/module/plugins/accounts/UploadheroCom.py
@@ -1,35 +1,35 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-from module.plugins.Account import Account
-import re,datetime,time
-
-class UploadheroCom(Account):
- __name__ = "UploadheroCom"
- __version__ = "0.1"
- __type__ = "account"
- __description__ = """Uploadhero.com account plugin"""
- __author_name__ = ("mcmyst")
- __author_mail__ = ("mcmyst@hotmail.fr")
-
-
- def loadAccountInfo(self, user, req):
- premium_pattern = re.compile('Il vous reste <span class="bleu">([0-9]+)</span> jours premium.')
-
- data = self.getAccountData(user)
- page = req.load("http://uploadhero.com/my-account")
-
- if premium_pattern.search(page):
- end_date = datetime.date.today() + datetime.timedelta(days=int(premium_pattern.search(page).group(1)))
- end_date = time.mktime(future.timetuple())
- account_info = {"validuntil": end_date, "trafficleft": -1, "premium": True}
- else:
- account_info = {"validuntil": -1, "trafficleft": -1, "premium": False}
-
- return account_info
-
- def login(self, user, data, req):
- page = req.load("http://uploadhero.com/lib/connexion.php", post={"pseudo_login": user, "password_login": data["password"]})
-
- if "mot de passe invalide" in page:
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from module.plugins.Account import Account
+import re,datetime,time
+
+class UploadheroCom(Account):
+ __name__ = "UploadheroCom"
+ __version__ = "0.1"
+ __type__ = "account"
+ __description__ = """Uploadhero.com account plugin"""
+ __author_name__ = ("mcmyst")
+ __author_mail__ = ("mcmyst@hotmail.fr")
+
+
+ def loadAccountInfo(self, user, req):
+ premium_pattern = re.compile('Il vous reste <span class="bleu">([0-9]+)</span> jours premium.')
+
+ data = self.getAccountData(user)
+ page = req.load("http://uploadhero.com/my-account")
+
+ if premium_pattern.search(page):
+ end_date = datetime.date.today() + datetime.timedelta(days=int(premium_pattern.search(page).group(1)))
+ end_date = time.mktime(future.timetuple())
+ account_info = {"validuntil": end_date, "trafficleft": -1, "premium": True}
+ else:
+ account_info = {"validuntil": -1, "trafficleft": -1, "premium": False}
+
+ return account_info
+
+ def login(self, user, data, req):
+ page = req.load("http://uploadhero.com/lib/connexion.php", post={"pseudo_login": user, "password_login": data["password"]})
+
+ if "mot de passe invalide" in page:
self.wrongPassword() \ No newline at end of file
diff --git a/module/plugins/accounts/X7To.py b/module/plugins/accounts/X7To.py
index 8c2bf245a..90f65d55e 100644
--- a/module/plugins/accounts/X7To.py
+++ b/module/plugins/accounts/X7To.py
@@ -1,66 +1,66 @@
-# -*- coding: utf-8 -*-
-
-"""
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License,
- or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>.
-
- @author: ernieb
-"""
-
-import re
-from time import strptime, mktime
-
-from module.plugins.Account import Account
-
-class X7To(Account):
- __name__ = "X7To"
- __version__ = "0.1"
- __type__ = "account"
- __description__ = """X7.To account plugin"""
- __author_name__ = ("ernieb")
- __author_mail__ = ("ernieb")
-
- def loadAccountInfo(self, user, req):
- page = req.load("http://www.x7.to/my")
-
- validCheck = re.search("Premium-Mitglied bis ([0-9]*-[0-9]*-[0-9]*)", page, re.IGNORECASE)
- if validCheck:
- valid = validCheck.group(1)
- valid = int(mktime(strptime(valid, "%Y-%m-%d")))
- else:
- validCheck = re.search("Premium member until ([0-9]*-[0-9]*-[0-9]*)", page, re.IGNORECASE)
- if validCheck:
- valid = validCheck.group(1)
- valid = int(mktime(strptime(valid, "%Y-%m-%d")))
- else:
- valid = 0
-
- trafficleft = re.search(r'<em style="white-space:nowrap">([\d]*[,]?[\d]?[\d]?) (KB|MB|GB)</em>', page, re.IGNORECASE)
- if trafficleft:
- units = float(trafficleft.group(1).replace(",", "."))
- pow = {'KB': 0, 'MB': 1, 'GB': 2}[trafficleft.group(2)]
- trafficleft = int(units * 1024 ** pow)
- else:
- trafficleft = -1
-
- return {"trafficleft": trafficleft, "validuntil": valid}
-
-
- def login(self, user, data, req):
- #req.cj.setCookie("share.cx", "lang", "english")
- page = req.load("http://x7.to/lang/en", None, {})
- page = req.load("http://x7.to/james/login", None,
- {"redirect": "http://www.x7.to/", "id": user, "pw": data['password'], "submit": "submit"})
-
- if "Username and password are not matching." in page:
- self.wrongPassword()
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: ernieb
+"""
+
+import re
+from time import strptime, mktime
+
+from module.plugins.Account import Account
+
+class X7To(Account):
+ __name__ = "X7To"
+ __version__ = "0.1"
+ __type__ = "account"
+ __description__ = """X7.To account plugin"""
+ __author_name__ = ("ernieb")
+ __author_mail__ = ("ernieb")
+
+ def loadAccountInfo(self, user, req):
+ page = req.load("http://www.x7.to/my")
+
+ validCheck = re.search("Premium-Mitglied bis ([0-9]*-[0-9]*-[0-9]*)", page, re.IGNORECASE)
+ if validCheck:
+ valid = validCheck.group(1)
+ valid = int(mktime(strptime(valid, "%Y-%m-%d")))
+ else:
+ validCheck = re.search("Premium member until ([0-9]*-[0-9]*-[0-9]*)", page, re.IGNORECASE)
+ if validCheck:
+ valid = validCheck.group(1)
+ valid = int(mktime(strptime(valid, "%Y-%m-%d")))
+ else:
+ valid = 0
+
+ trafficleft = re.search(r'<em style="white-space:nowrap">([\d]*[,]?[\d]?[\d]?) (KB|MB|GB)</em>', page, re.IGNORECASE)
+ if trafficleft:
+ units = float(trafficleft.group(1).replace(",", "."))
+ pow = {'KB': 0, 'MB': 1, 'GB': 2}[trafficleft.group(2)]
+ trafficleft = int(units * 1024 ** pow)
+ else:
+ trafficleft = -1
+
+ return {"trafficleft": trafficleft, "validuntil": valid}
+
+
+ def login(self, user, data, req):
+ #req.cj.setCookie("share.cx", "lang", "english")
+ page = req.load("http://x7.to/lang/en", None, {})
+ page = req.load("http://x7.to/james/login", None,
+ {"redirect": "http://www.x7.to/", "id": user, "pw": data['password'], "submit": "submit"})
+
+ if "Username and password are not matching." in page:
+ self.wrongPassword()