summaryrefslogtreecommitdiffstats
path: root/module/plugins/accounts/AlldebridCom.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/accounts/AlldebridCom.py')
-rw-r--r--module/plugins/accounts/AlldebridCom.py41
1 files changed, 22 insertions, 19 deletions
diff --git a/module/plugins/accounts/AlldebridCom.py b/module/plugins/accounts/AlldebridCom.py
index 122d23447..8fb841a39 100644
--- a/module/plugins/accounts/AlldebridCom.py
+++ b/module/plugins/accounts/AlldebridCom.py
@@ -1,29 +1,31 @@
# -*- coding: utf-8 -*-
+import re
import xml.dom.minidom as dom
+
from time import time
-import re
-import urllib
+from urllib import urlencode
-from module.plugins.Account import Account
from BeautifulSoup import BeautifulSoup
+from module.plugins.Account import Account
+
class AlldebridCom(Account):
- __name__ = "AlldebridCom"
+ __name__ = "AlldebridCom"
+ __type__ = "account"
__version__ = "0.22"
- __type__ = "account"
__description__ = """AllDebrid.com account plugin"""
- __author_name__ = "Andy Voigt"
- __author_mail__ = "spamsales@online.de"
+ __license__ = "GPLv3"
+ __authors__ = [("Andy Voigt", "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)
+ html = req.load("http://www.alldebrid.com/account/")
+ soup = BeautifulSoup(html)
+ #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.logDebug("Account expires in: %s" % time_text)
@@ -34,23 +36,24 @@ class AlldebridCom(Account):
#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.logDebug(page)
- xml = dom.parseString(page)
+ html = req.load("http://www.alldebrid.com/api.php",
+ get={'action': "info_user", 'login': user, 'pw': data['password']})
+ self.logDebug(html)
+ xml = dom.parseString(html)
exp_time = time() + int(xml.getElementsByTagName("date")[0].childNodes[0].nodeValue) * 24 * 60 * 60
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)
+ urlparams = urlencode({'action': 'login', 'login_login': user, 'login_password': data['password']})
+ html = req.load("http://www.alldebrid.com/register/?%s" % urlparams)
- if "This login doesn't exist" in page:
+ if "This login doesn't exist" in html:
self.wrongPassword()
- if "The password is not valid" in page:
+ if "The password is not valid" in html:
self.wrongPassword()
- if "Invalid captcha" in page:
+ if "Invalid captcha" in html:
self.wrongPassword()