summaryrefslogtreecommitdiffstats
path: root/pyload/plugin/account
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-03-26 18:15:41 +0100
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-03-26 18:15:41 +0100
commit181ab47c5f775b8b48569361da6b88a801784a30 (patch)
treef5f6d1d6b75b7f21b89b33733c3536e5ca80e087 /pyload/plugin/account
parentMerge branch 'stable' into 0.4.10 (diff)
downloadpyload-181ab47c5f775b8b48569361da6b88a801784a30.tar.xz
Cleanup
Diffstat (limited to 'pyload/plugin/account')
-rw-r--r--pyload/plugin/account/Keep2ShareCc.py58
-rw-r--r--pyload/plugin/account/MegaRapidoNet.py57
2 files changed, 88 insertions, 27 deletions
diff --git a/pyload/plugin/account/Keep2ShareCc.py b/pyload/plugin/account/Keep2ShareCc.py
index 7ed15dc62..a3cc2c40d 100644
--- a/pyload/plugin/account/Keep2ShareCc.py
+++ b/pyload/plugin/account/Keep2ShareCc.py
@@ -1,32 +1,32 @@
# -*- coding: utf-8 -*-
import re
-
-from time import gmtime, mktime, strptime
+import time
from pyload.plugin.Account import Account
-class Keep2shareCc(Account):
- __name__ = "Keep2shareCc"
+class Keep2ShareCc(Account):
+ __name__ = "Keep2ShareCc"
__type__ = "account"
- __version__ = "0.02"
+ __version__ = "0.05"
- __description__ = """Keep2share.cc account plugin"""
+ __description__ = """Keep2Share.cc account plugin"""
__license__ = "GPLv3"
- __authors__ = [("aeronaut", "aeronaut@pianoguy.de")]
+ __authors__ = [("aeronaut", "aeronaut@pianoguy.de"),
+ ("Walter Purcaro", "vuolter@gmail.com")]
- VALID_UNTIL_PATTERN = r'Premium expires: <b>(.+?)</b>'
- TRAFFIC_LEFT_PATTERN = r'Available traffic \(today\):<b><a href="/user/statistic.html">(.+?)</a>'
+ VALID_UNTIL_PATTERN = r'Premium expires:\s*<b>(.+?)<'
+ TRAFFIC_LEFT_PATTERN = r'Available traffic \(today\):\s*<b><a href="/user/statistic.html">(.+?)<'
LOGIN_FAIL_PATTERN = r'Please fix the following input errors'
def loadAccountInfo(self, user, req):
validuntil = None
- trafficleft = None
- premium = None
+ trafficleft = -1
+ premium = False
html = req.load("http://keep2share.cc/site/profile.html", decode=True)
@@ -35,26 +35,26 @@ class Keep2shareCc(Account):
expiredate = m.group(1).strip()
self.logDebug("Expire date: " + expiredate)
- try:
- validuntil = mktime(strptime(expiredate, "%Y.%m.%d"))
+ if expiredate == "LifeTime":
+ premium = True
+ validuntil = -1
+ else:
+ try:
+ validuntil = time.mktime(time.strptime(expiredate, "%Y.%m.%d"))
- except Exception, e:
- self.logError(e)
+ except Exception, e:
+ self.logError(e)
- else:
- if validuntil > mktime(gmtime()):
- premium = True
else:
- premium = False
- validuntil = None
+ premium = True if validuntil > time.mktime(time.gmtime()) else False
- m = re.search(self.TRAFFIC_LEFT_PATTERN, html)
- if m:
- try:
- trafficleft = self.parseTraffic(m.group(1))
+ m = re.search(self.TRAFFIC_LEFT_PATTERN, html)
+ if m:
+ try:
+ trafficleft = self.parseTraffic(m.group(1))
- except Exception, e:
- self.logError(e)
+ except Exception, e:
+ self.logError(e)
return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium}
@@ -63,7 +63,11 @@ class Keep2shareCc(Account):
req.cj.setCookie("keep2share.cc", "lang", "en")
html = req.load("http://keep2share.cc/login.html",
- post={'LoginForm[username]': user, 'LoginForm[password]': data['password']})
+ post={'LoginForm[username]' : user,
+ 'LoginForm[password]' : data['password'],
+ 'LoginForm[rememberMe]': 1,
+ 'yt0' : ""},
+ decode=True)
if re.search(self.LOGIN_FAIL_PATTERN, html):
self.wrongPassword()
diff --git a/pyload/plugin/account/MegaRapidoNet.py b/pyload/plugin/account/MegaRapidoNet.py
new file mode 100644
index 000000000..22979a09a
--- /dev/null
+++ b/pyload/plugin/account/MegaRapidoNet.py
@@ -0,0 +1,57 @@
+# -*- coding: utf-8 -*-
+
+import re
+import time
+
+from pyload.plugin.Account import Account
+
+
+class MegaRapidoNet(Account):
+ __name__ = "MegaRapidoNet"
+ __type__ = "account"
+ __version__ = "0.02"
+
+ __description__ = """MegaRapido.net account plugin"""
+ __license__ = "GPLv3"
+ __authors__ = [("Kagenoshin", "kagenoshin@gmx.ch")]
+
+
+ VALID_UNTIL_PATTERN = r'<\s*?div[^>]*?class\s*?=\s*?[\'"]premium_index[\'"][^>]*>[^<]*?<[^>]*?b[^>]*>\s*?TEMPO\s*?PREMIUM[^<]*<[^>]*?/b[^>]*>\s*?(\d*)[^\d]*?DIAS[^\d]*?(\d*)[^\d]*?HORAS[^\d]*?(\d*)[^\d]*?MINUTOS[^\d]*?(\d*)[^\d]*?SEGUNDOS'
+ USER_ID_PATTERN = r'<\s*?div[^>]*?class\s*?=\s*?["\']checkbox_compartilhar["\'][^>]*>[^<]*<\s*?input[^>]*?name\s*?=\s*?["\']usar["\'][^>]*>[^<]*<\s*?input[^>]*?name\s*?=\s*?["\']user["\'][^>]*?value\s*?=\s*?["\'](.*?)\s*?["\']'
+
+
+ def loadAccountInfo(self, user, req):
+ validuntil = None
+ trafficleft = None
+ premium = False
+
+ html = req.load("http://megarapido.net/gerador", decode=True)
+
+ validuntil = re.search(self.VALID_UNTIL_PATTERN, html)
+ if validuntil:
+ #hier weitermachen!!! (müssen umbedingt die zeit richtig machen damit! (sollte aber möglich))
+ validuntil = time.time() + int(validuntil.group(1)) * 24 * 3600 + int(validuntil.group(2)) * 3600 + int(validuntil.group(3)) * 60 + int(validuntil.group(4))
+ trafficleft = -1
+ premium = True
+
+ return {'validuntil' : validuntil,
+ 'trafficleft': trafficleft,
+ 'premium' : premium}
+
+
+ def login(self, user, data, req):
+ req.load("http://megarapido.net/login")
+ req.load("http://megarapido.net/painel_user/ajax/logar.php",
+ post={'login': user, 'senha': data['password']},
+ decode=True)
+
+ html = req.load("http://megarapido.net/gerador")
+
+ if "sair" not in html.lower():
+ self.wrongPassword()
+ else:
+ m = re.search(self.USER_ID_PATTERN, html)
+ if m:
+ data['uid'] = m.group(1)
+ else:
+ self.fail("Couldn't find the user ID")