diff options
author | zoidberg10 <zoidberg@mujmail.cz> | 2012-01-20 01:58:41 +0100 |
---|---|---|
committer | zoidberg10 <zoidberg@mujmail.cz> | 2012-01-20 01:58:41 +0100 |
commit | 567c1d512e2e7452969d42d272d600d694e40058 (patch) | |
tree | 1debc1a4ca81f09d4c2fb7c77791c345d5eb0577 /module/plugins/hoster/DlFreeFr.py | |
parent | fix cnl for localhost domain (diff) | |
download | pyload-567c1d512e2e7452969d42d272d600d694e40058.tar.xz |
fix threadmanager limitdl, add zevera.com
Diffstat (limited to 'module/plugins/hoster/DlFreeFr.py')
-rw-r--r-- | module/plugins/hoster/DlFreeFr.py | 82 |
1 files changed, 23 insertions, 59 deletions
diff --git a/module/plugins/hoster/DlFreeFr.py b/module/plugins/hoster/DlFreeFr.py index 8ab9dd8eb..7cb58e6f4 100644 --- a/module/plugins/hoster/DlFreeFr.py +++ b/module/plugins/hoster/DlFreeFr.py @@ -2,72 +2,36 @@ # -*- coding: utf-8 -*- import re +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -from module.plugins.Hoster import Hoster - -class DlFreeFr(Hoster): +class DlFreeFr(SimpleHoster): __name__ = "DlFreeFr" __type__ = "hoster" __pattern__ = r"http://dl\.free\.fr/([a-zA-Z0-9]+|getfile\.pl\?file=/[a-zA-Z0-9]+)$" - __version__ = "0.1" + __version__ = "0.2" __description__ = """dl.free.fr download hoster""" - __author_name__ = ("the-razer") - __author_mail__ = ("daniel_ AT gmx DOT net") - + __author_name__ = ("the-razer", "zoidberg") + __author_mail__ = ("daniel_ AT gmx DOT net", "zoidberg@mujmail.cz") + + FILE_NAME_PATTERN = r"Fichier:</td>\s*<td[^>]*>(?P<N>[^>]*)</td>" + FILE_SIZE_PATTERN = r"Taille:</td>\s*<td[^>]*>(?P<S>[\d.]+[KMG])</td>" + FILE_OFFLINE_PATTERN = r"Erreur 404 - Document non trouv|Fichier inexistant|Le fichier demandé n'a pas été trouvé" + FILE_URL_PATTERN = r'href="(?P<url>http://.*?)">Télécharger ce fichier' + def setup(self): - self.html = None - self.multiDL = False - - def process(self, pyfile): - - self.download_html() - - if not self.file_exists(): - self.log.debug(self.__name__+": File not yet available.") - self.offline() - - pyfile.name = self.get_file_name() - - url = self.get_file_url() - if url: - self.download(url) - else: - self.offline() + self.limitDL = 5 + self.resumeDownload = True + self.chunkLimit = 1 - def download_html(self): - self.html = self.load(self.pyfile.url, cookies=False) - - def file_exists(self): - warnings = (r"Erreur 404 - Document non trouv", - r"Fichier inexistant.", - r"Le fichier demandé n'a pas été trouvé") - expr = '(' + '|'.join(warnings) + ')' - if re.search(expr, self.html) is not None: - return False - return True + def handleFree(self): + if "Trop de slots utilisés" in self.html: + self.retry(300) - def get_file_url(self): - self.log.debug(self.__name__+": Getting file URL") - file_url_pattern = r'href="(?P<url>http://.*?)">Télécharger ce fichier' + m = re.search(self.FILE_URL_PATTERN, self.html) + if not m: self.parseError('URL') - m = re.search(file_url_pattern, self.html) - if m is not None: - url = m.group('url') - self.log.debug(self.__name__+": File URL [%s]" % url) - return url - else: - self.log.debug(self.__name__+": Error getting URL") - return False + url = m.group('url') + self.logDebug("File URL [%s]" % url) + self.download(url) - def get_file_name(self): - self.log.debug(self.__name__+": Getting file name") - - file_name_pattern = r"Fichier:</td>\s*<td.*>(?P<name>.*?)</td>" - m = re.search(file_name_pattern, self.html) - - if m is not None: - name = m.group('name').strip() - self.log.debug(self.__name__+": File name [%s]" % name) - return name - else: - self.log.debug(self.__name__+": Could not find filename") +getInfo = create_getInfo(DlFreeFr)
\ No newline at end of file |