summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
Diffstat (limited to 'module')
-rw-r--r--module/plugins/accounts/MegaRapidCz.py10
-rw-r--r--module/plugins/accounts/QuickshareCz.py5
2 files changed, 11 insertions, 4 deletions
diff --git a/module/plugins/accounts/MegaRapidCz.py b/module/plugins/accounts/MegaRapidCz.py
index 3ef98560a..04abf8c8a 100644
--- a/module/plugins/accounts/MegaRapidCz.py
+++ b/module/plugins/accounts/MegaRapidCz.py
@@ -18,22 +18,26 @@ class MegaRapidCz(Account):
login_timeout = 60
+
+ LIMITDL_PATTERN = ur'<td>Max. počet paralelních stahování: </td><td>(\d+)'
+ VALID_UNTIL_PATTERN = ur'<td>Paušální stahování aktivní. Vyprší </td><td><strong>(.*?)</strong>'
+ TRAFFIC_LEFT_PATTERN = r'<tr><td>Kredit</td><td>(.*?) GiB'
def loadAccountInfo(self, user, req):
src = req.load("http://megarapid.cz/mujucet/", decode=True)
- m = re.search(ur'<td>Max. počet paralelních stahování: </td><td>(\d+)', src)
+ m = re.search(self.LIMITDL_PATTERN, src)
if m:
data = self.getAccountData(user)
data['options']['limitDL'] = [int(m.group(1))]
- m = re.search(ur'<td>Paušální stahování aktivní. Vyprší </td><td><strong>(.*?)</strong>', src)
+ m = re.search(self.VALID_UNTIL_PATTERN, src)
if m:
validuntil = mktime(strptime(m.group(1), "%d.%m.%Y - %H:%M"))
return {"premium": True, "trafficleft": -1, "validuntil": validuntil}
- m = re.search(r'<tr><td>Kredit</td><td>(.*?) GiB', src)
+ m = re.search(self.TRAFFIC_LEFT_PATTERN, src)
if m:
trafficleft = float(m.group(1)) * (1 << 20)
return {"premium": True, "trafficleft": trafficleft, "validuntil": -1}
diff --git a/module/plugins/accounts/QuickshareCz.py b/module/plugins/accounts/QuickshareCz.py
index adb54c7d0..f8ba3e7ff 100644
--- a/module/plugins/accounts/QuickshareCz.py
+++ b/module/plugins/accounts/QuickshareCz.py
@@ -15,10 +15,13 @@ class QuickshareCz(Account):
__authors__ = [("zoidberg", "zoidberg@mujmail.cz")]
+ TRAFFIC_LEFT_PATTERN = r'Stav kreditu: <strong>(.+?)</strong>'
+
+
def loadAccountInfo(self, user, req):
html = req.load("http://www.quickshare.cz/premium", decode=True)
- m = re.search(r'Stav kreditu: <strong>(.+?)</strong>', html)
+ m = re.search(self.TRAFFIC_LEFT_PATTERN, html)
if m:
trafficleft = self.parseTraffic(m.group(1))
premium = True if trafficleft else False