diff options
| author | 2012-05-22 00:20:08 +0200 | |
|---|---|---|
| committer | 2012-05-22 00:20:08 +0200 | |
| commit | 56d409331faeb3c4535d11b265e901797bb9e337 (patch) | |
| tree | 88e83d646848aa6cb0d0be24ccb823812a1ce9c6 /module/plugins/accounts | |
| parent | update filefactory, add datei.to, jumbofiles.com (diff) | |
| download | pyload-56d409331faeb3c4535d11b265e901797bb9e337.tar.xz | |
add uploadhero (thx mcmyst), wrzuc.to, gigapeta.com
Diffstat (limited to 'module/plugins/accounts')
| -rw-r--r-- | module/plugins/accounts/FilefactoryCom.py | 28 | ||||
| -rw-r--r-- | module/plugins/accounts/UploadheroCom.py | 35 | 
2 files changed, 49 insertions, 14 deletions
| diff --git a/module/plugins/accounts/FilefactoryCom.py b/module/plugins/accounts/FilefactoryCom.py index 8c04cf49b..73431b546 100644 --- a/module/plugins/accounts/FilefactoryCom.py +++ b/module/plugins/accounts/FilefactoryCom.py @@ -23,32 +23,32 @@ from time import mktime, strptime  class FilefactoryCom(Account):      __name__ = "FilefactoryCom" -    __version__ = "0.1" +    __version__ = "0.11"      __type__ = "account"      __description__ = """filefactory.com account plugin"""      __author_name__ = ("zoidberg")      __author_mail__ = ("zoidberg@mujmail.cz") -    ACCOUNT_INFO_PATTERN = r'Your account is valid until the <strong>(.*?)</strong>'  - -    def loadAccountInfo(self, user, req): -        premium = False -        validuntil = -1 -         -        html = req.load("http://filefactory.com/member/") -        if "You are a FileFactory Premium Member" in html: +    ACCOUNT_INFO_PATTERN = r'"greenText">Premium member until<.*?datetime="(.*?)"' + +    def loadAccountInfo(self, user, req):       +        html = req.load("http://www.filefactory.com/member/") +             +        found = re.search(self.ACCOUNT_INFO_PATTERN, html) +        if found:              premium = True -            found = re.search(self.ACCOUNT_INFO_PATTERN, html) -            if found: -                validuntil = mktime(strptime(re.sub(r"(\d)[a-z]{2} ", r"\1 ", found.group(1)),"%d %B, %Y"))  +            validuntil = mktime(strptime(re.sub(r"(\d)[a-z]{2} ", r"\1 ", found.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("http://filefactory.com/member/login.php", post={ +        html = req.load("http://www.filefactory.com/member/login.php", post={              "email": user,               "password": data["password"],              "redirect": "/"}) -        if not re.search(r'location:.*?\?login=1', req.http.header, re.I): +        if '/member/login.php?err=1' in req.http.header:              self.wrongPassword()
\ No newline at end of file diff --git a/module/plugins/accounts/UploadheroCom.py b/module/plugins/accounts/UploadheroCom.py new file mode 100644 index 000000000..f1e0649e6 --- /dev/null +++ b/module/plugins/accounts/UploadheroCom.py @@ -0,0 +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:
 +            self.wrongPassword()
\ No newline at end of file | 
