diff options
author | therazer <devnull@localhost> | 2010-11-07 14:47:42 +0100 |
---|---|---|
committer | therazer <devnull@localhost> | 2010-11-07 14:47:42 +0100 |
commit | 4992b50a20e6bef57e3f6a5b37c11e1a3f037ffc (patch) | |
tree | 6d2e172cb22db148afcd585fed14ed9dcfd82ba4 /module/plugins | |
parent | missing file... (diff) | |
download | pyload-4992b50a20e6bef57e3f6a5b37c11e1a3f037ffc.tar.xz |
adding dl.free.fr
Diffstat (limited to 'module/plugins')
-rw-r--r-- | module/plugins/hoster/DlFreeFr.py | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/module/plugins/hoster/DlFreeFr.py b/module/plugins/hoster/DlFreeFr.py new file mode 100644 index 000000000..91b4928a1 --- /dev/null +++ b/module/plugins/hoster/DlFreeFr.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re + +from module.plugins.Hoster import Hoster + +class DlFreeFr(Hoster): + __name__ = "DlFreeFr" + __type__ = "hoster" + __pattern__ = r"http://dl\.free\.fr/([a-zA-Z0-9]+|getfile\.pl\?file=/[a-zA-Z0-9]+)$" + __version__ = "0.1" + __description__ = """dl.free.fr download hoster""" + __author_name__ = ("the-razer") + __author_mail__ = ("daniel_ AT gmx DOT net") + + 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() + + 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 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(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 |