diff options
Diffstat (limited to 'module/plugins')
-rw-r--r-- | module/plugins/accounts/OneFichierCom.py | 46 | ||||
-rw-r--r-- | module/plugins/hoster/OneFichierCom.py | 21 |
2 files changed, 64 insertions, 3 deletions
diff --git a/module/plugins/accounts/OneFichierCom.py b/module/plugins/accounts/OneFichierCom.py new file mode 100644 index 000000000..b10e34314 --- /dev/null +++ b/module/plugins/accounts/OneFichierCom.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- + +import re +from time import strptime, mktime +from pycurl import REFERER + +from module.plugins.Account import Account + + +class OneFichierCom(Account): + __name__ = "OneFichierCom" + __version__ = "0.1" + __type__ = "account" + __description__ = """1fichier.com account plugin""" + __author_name__ = ("Elrick69") + __author_mail__ = ("elrick69[AT]rocketmail[DOT]com") + + VALID_UNTIL_PATTERN = r'You are a premium user until (?P<d>\d{2})/(?P<m>\d{2})/(?P<y>\d{4})' + + def loadAccountInfo(self, user, req): + + html = req.load("http://1fichier.com/console/abo.pl") + + m = re.search(self.VALID_UNTIL_PATTERN, html) + + if m: + premium = True + validuntil = re.sub(self.VALID_UNTIL_PATTERN, '\g<d>/\g<m>/\g<y>', m.group(0)) + validuntil = int(mktime(strptime(validuntil, "%d/%m/%Y"))) + else: + premium = False + validuntil = -1 + + return {"premium": premium, "trafficleft": -1, "validuntil": validuntil} + + def login(self, user, data, req): + + req.http.c.setopt(REFERER, "http://1fichier.com/login.pl?lg=en") + + html = req.load("http://1fichier.com/login.pl?lg=en", post={ + "mail": user, + "pass": data["password"], + "Login": "Login"}) + + if r'<div class="error_message">Invalid username or password.</div>' in html: + self.wrongPassword() diff --git a/module/plugins/hoster/OneFichierCom.py b/module/plugins/hoster/OneFichierCom.py index 39a5450fe..41f3e4b11 100644 --- a/module/plugins/hoster/OneFichierCom.py +++ b/module/plugins/hoster/OneFichierCom.py @@ -12,11 +12,11 @@ class OneFichierCom(SimpleHoster): __name__ = "OneFichierCom" __type__ = "hoster" __pattern__ = r'(http://(?P<id>\w+)\.(?P<host>(1fichier|d(es)?fichiers|pjointe)\.(com|fr|net|org)|(cjoint|mesfichiers|piecejointe|oi)\.(org|net)|tenvoi\.(com|org|net)|dl4free\.com|alterupload\.com|megadl.fr))/?' - __version__ = "0.60" + __version__ = "0.61" __description__ = """1fichier.com hoster plugin""" - __author_name__ = ("fragonib", "the-razer", "zoidberg", "imclem", "stickell") + __author_name__ = ("fragonib", "the-razer", "zoidberg", "imclem", "stickell", "Elrick69") __author_mail__ = ("fragonib[AT]yahoo[DOT]es", "daniel_ AT gmx DOT net", "zoidberg@mujmail.cz", - "imclem on github", "l.stickell@yahoo.it") + "imclem on github", "l.stickell@yahoo.it", "elrick69[AT]rocketmail[DOT]com") FILE_NAME_PATTERN = r'">Filename :</th>\s*<td>(?P<N>[^<]+)</td>' FILE_SIZE_PATTERN = r'<th>Size :</th>\s*<td>(?P<S>[^<]+)</td>' @@ -58,6 +58,21 @@ class OneFichierCom(SimpleHoster): # Check download self.checkDownloadedFile() + def handlePremium(self): + url, inputs = self.parseHtmlForm('action="http://%s' % self.file_info['id']) + if not url: + self.parseError("Download link not found") + + # Check for protection + if "pass" in inputs: + inputs['pass'] = self.getPassword() + inputs['submit'] = "Download" + + self.download(url, post=inputs) + + # Check download + self.checkDownloadedFile() + def checkDownloadedFile(self): check = self.checkDownload({"wait": self.WAITING_PATTERN}) if check == "wait": |