summaryrefslogtreecommitdiffstats
path: root/pyload/plugin/account/FilejungleCom.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2015-02-16 21:59:10 +0100
committerGravatar Walter Purcaro <vuolter@gmail.com> 2015-02-16 21:59:10 +0100
commit8e7d14bae4d3c836f029a1235eb227380acc3f75 (patch)
treeebd0679642cccb994e70a89a106b394189cb28bc /pyload/plugin/account/FilejungleCom.py
parentMerge branch 'stable' into 0.4.10 (diff)
downloadpyload-8e7d14bae4d3c836f029a1235eb227380acc3f75.tar.xz
Fix plugins to work on 0.4.10
Diffstat (limited to 'pyload/plugin/account/FilejungleCom.py')
-rw-r--r--pyload/plugin/account/FilejungleCom.py50
1 files changed, 50 insertions, 0 deletions
diff --git a/pyload/plugin/account/FilejungleCom.py b/pyload/plugin/account/FilejungleCom.py
new file mode 100644
index 000000000..2c476bffb
--- /dev/null
+++ b/pyload/plugin/account/FilejungleCom.py
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+
+import re
+from time import mktime, strptime
+
+from pyload.plugin.Account import Account
+
+
+class FilejungleCom(Account):
+ __name__ = "FilejungleCom"
+ __type__ = "account"
+ __version__ = "0.12"
+
+ __description__ = """Filejungle.com account plugin"""
+ __license__ = "GPLv3"
+ __authors__ = [("zoidberg", "zoidberg@mujmail.cz")]
+
+
+ login_timeout = 60
+
+ URL = "http://filejungle.com/"
+ TRAFFIC_LEFT_PATTERN = r'"/extend_premium\.php">Until (\d+ \w+ \d+)<br'
+ LOGIN_FAILED_PATTERN = r'<span htmlfor="loginUser(Name|Password)" generated="true" class="fail_info">'
+
+
+ def loadAccountInfo(self, user, req):
+ html = req.load(self.URL + "dashboard.php")
+ m = re.search(self.TRAFFIC_LEFT_PATTERN, html)
+ if m:
+ premium = True
+ validuntil = mktime(strptime(m.group(1), "%d %b %Y"))
+ else:
+ premium = False
+ validuntil = -1
+
+ return {"premium": premium, "trafficleft": -1, "validuntil": validuntil}
+
+
+ def login(self, user, data, req):
+ html = req.load(self.URL + "login.php",
+ post={"loginUserName": user,
+ "loginUserPassword": data['password'],
+ "loginFormSubmit": "Login",
+ "recaptcha_challenge_field": "",
+ "recaptcha_response_field": "",
+ "recaptcha_shortencode_field": ""},
+ decode=True)
+
+ if re.search(self.LOGIN_FAILED_PATTERN, html):
+ self.wrongPassword()