diff options
Diffstat (limited to 'module/plugins/hoster/OneFichierCom.py')
| -rw-r--r-- | module/plugins/hoster/OneFichierCom.py | 54 | 
1 files changed, 23 insertions, 31 deletions
| diff --git a/module/plugins/hoster/OneFichierCom.py b/module/plugins/hoster/OneFichierCom.py index 923a19c86..39a5450fe 100644 --- a/module/plugins/hoster/OneFichierCom.py +++ b/module/plugins/hoster/OneFichierCom.py @@ -4,52 +4,47 @@  # http://5pnm24ltcw.1fichier.com/  import re +  from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo  class OneFichierCom(SimpleHoster):      __name__ = "OneFichierCom"      __type__ = "hoster" -    __pattern__ = r'(http://(\w+)\.((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.50" +    __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"      __description__ = """1fichier.com hoster plugin""" -    __author_name__ = ("fragonib", "the-razer", "zoidberg", "imclem") -    __author_mail__ = ("fragonib[AT]yahoo[DOT]es", "daniel_ AT gmx DOT net", "zoidberg@mujmail.cz", "imclem on github") +    __author_name__ = ("fragonib", "the-razer", "zoidberg", "imclem", "stickell") +    __author_mail__ = ("fragonib[AT]yahoo[DOT]es", "daniel_ AT gmx DOT net", "zoidberg@mujmail.cz", +                       "imclem on github", "l.stickell@yahoo.it")      FILE_NAME_PATTERN = r'">Filename :</th>\s*<td>(?P<N>[^<]+)</td>'      FILE_SIZE_PATTERN = r'<th>Size :</th>\s*<td>(?P<S>[^<]+)</td>'      FILE_OFFLINE_PATTERN = r'The (requested)? file (could not be found|has been deleted)' -    FILE_URL_REPLACEMENTS = [(r'(http://[^/]*).*', r'\1/en/')] -    DOWNLOAD_LINK_PATTERN = r"""location\s*.\s*'(?P<N>http://.*?)'""" -    PASSWORD_PROTECTED_TOKEN = "protected by password" -    WAITING_PATTERN = "Warning ! Without premium status, you must wait up to (\d+) minutes between each downloads" -    LAST_DOWNLOAD_DELAY = "Your last download finished (\d+) minutes ago" +    FILE_URL_REPLACEMENTS = [(__pattern__, r'http://\g<id>.\g<host>/en/')] + +    WAITING_PATTERN = "Warning ! Without premium status, you must wait between each downloads"      NOT_PARALLEL = r"Warning ! Without premium status, you can download only one file at a time" -    RETRY_TIME = 15*60  # Default retry time in seconds (if detected parallel download) - -    def process(self, pyfile): -        found = re.match(self.__pattern__, pyfile.url) -        file_id = found.group(2) -        url = "http://%s.%s/en/" % (found.group(2), found.group(3)) -        self.html = self.load(url, decode=True) - -        self.getFileInfo() - -        found = re.search(self.WAITING_PATTERN, self.html) -        if found: -            last_delay = 0 -            # retrieve the delay from the last download to substract from required delay -            found_delay = re.search(self.LAST_DOWNLOAD_DELAY, self.html) -            if found_delay: -                last_delay = int(found_delay.group(1)) -            self.waitAndRetry((int(found.group(1)) - last_delay) * 60) +    WAIT_TIME = 10 * 60  # Retry time between each free download +    RETRY_TIME = 15 * 60  # Default retry time in seconds (if detected parallel download) + +    def setup(self): +        self.multiDL = self.premium +        self.resumeDownload = True + +    def handleFree(self): +        self.html = self.load(self.pyfile.url, decode=True) + +        if self.WAITING_PATTERN in self.html: +            self.logInfo('You have to wait been each free download! Retrying in %d seconds.' % self.WAIT_TIME) +            self.waitAndRetry(self.WAIT_TIME)          else:  # detect parallel download              found = re.search(self.NOT_PARALLEL, self.html)              if found:                  self.waitAndRetry(self.RETRY_TIME) -        url, inputs = self.parseHtmlForm('action="http://%s' % file_id) +        url, inputs = self.parseHtmlForm('action="http://%s' % self.file_info['id'])          if not url:              self.parseError("Download link not found") @@ -72,8 +67,5 @@ class OneFichierCom(SimpleHoster):          self.wait(wait_time, True)          self.retry() -    def setup(self): -        self.multiDL = self.premium -        self.resumeDownload = True  getInfo = create_getInfo(OneFichierCom) | 
