# -*- coding: utf-8 -*- import re from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class OneFichierCom(SimpleHoster): __name__ = "OneFichierCom" __type__ = "hoster" __version__ = "0.65" __pattern__ = r'https?://(?P\w+)\.(?P(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)' __description__ = """1fichier.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("fragonib", "fragonib[AT]yahoo[DOT]es"), ("the-razer", "daniel_ AT gmx DOT net"), ("zoidberg", "zoidberg@mujmail.cz"), ("imclem", None), ("stickell", "l.stickell@yahoo.it"), ("Elrick69", "elrick69[AT]rocketmail[DOT]com")] FILE_NAME_PATTERN = r'>Filename :\s*(?P.+?)<' FILE_SIZE_PATTERN = r'>Size :\s*(?P[\d.,]+) (?P[\w^_]+)' OFFLINE_PATTERN = r'>The (requested)? file (could not be found|has been deleted)' FILE_URL_REPLACEMENTS = [(__pattern__, r'http://\g.\g/en/')] WAIT_PATTERN = r'>You must wait (\d+)' def setup(self): self.multiDL = self.premium self.resumeDownload = True def handleFree(self): m = re.search(self.WAIT_PATTERN, self.html) if m: wait_time = int(m.group(1)) + 1 #: One minute more than what the page displays to be safe self.logInfo("You have to wait been each free download", "Retrying in %d minutes." % wait_time) self.wait(wait_time * 60, True) self.retry() url, inputs = self.parseHtmlForm('action="http://%s' % self.file_info['ID']) if not url: self.error("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 handlePremium(self): url, inputs = self.parseHtmlForm('action="http://%s' % self.file_info['ID']) if not url: self.error("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.WAIT_PATTERN}) if check == "wait": wait_time = int(self.lastcheck.group(1)) * 60 self.wait(wait_time, True) self.retry() getInfo = create_getInfo(OneFichierCom)