diff options
author | GamaC0de <nitzo2001@yahoo.com> | 2016-05-12 03:59:44 +0200 |
---|---|---|
committer | GamaC0de <nitzo2001@yahoo.com> | 2016-05-12 03:59:44 +0200 |
commit | 4a3d869e0a4ab6b9e0c2dec79f6268bd7cd1c03b (patch) | |
tree | 8a95e284305235dc449bb3d03380b3c59613907f | |
parent | [ClicknuploadCom] Update (diff) | |
download | pyload-4a3d869e0a4ab6b9e0c2dec79f6268bd7cd1c03b.tar.xz |
[New hoster] DatafileCom (fix 2461)
-rw-r--r-- | module/plugins/crypter/DatafileComFolder.py | 40 | ||||
-rw-r--r-- | module/plugins/hoster/DatafileCom.py | 71 |
2 files changed, 111 insertions, 0 deletions
diff --git a/module/plugins/crypter/DatafileComFolder.py b/module/plugins/crypter/DatafileComFolder.py new file mode 100644 index 000000000..a5d7d7764 --- /dev/null +++ b/module/plugins/crypter/DatafileComFolder.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- + +import re + +from module.plugins.internal.Crypter import Crypter + + +class DatafileComFolder(Crypter): + __name__ = "DatafileComFolder" + __type__ = "crypter" + __version__ = "0.01" + __status__ = "testing" + + __pattern__ = r'https?://(?:www\.)?datafile\.com/f/\w{12}' + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] + + + __description__ = """datafile.com decrypter plugin""" + __license__ = "GPLv3" + __authors__ = [("GammaC0de", "nitzo2001[AT]yahoo[DOT]com")] + + LINK_PATTERN = r'https?://(?:www\.)?datafile\.com/d/\w{17}' + NAME_PATTERN = r'<div class="file-name">(?P<N>.+?)<' + + + def decrypt(self, pyfile): + self.data = self.load(pyfile.url) + + links = re.findall(self.LINK_PATTERN, self.data) + + m = re.search(self.NAME_PATTERN, self.data) + if m: + name = m.group('N') + self.packages.append((name, links, name)) + + else: + self.links.extend(links)
\ No newline at end of file diff --git a/module/plugins/hoster/DatafileCom.py b/module/plugins/hoster/DatafileCom.py new file mode 100644 index 000000000..fd4554ee9 --- /dev/null +++ b/module/plugins/hoster/DatafileCom.py @@ -0,0 +1,71 @@ +# -*- coding: utf-8 -*- + +import re + +from module.plugins.internal.misc import json +from module.plugins.captcha.ReCaptcha import ReCaptcha +from module.plugins.internal.SimpleHoster import SimpleHoster + + +class DatafileCom(SimpleHoster): + __name__ = "DatafileCom" + __type__ = "hoster" + __version__ = "0.01" + __status__ = "testing" + + __pattern__ = r'https?://(?:www\.)?datafile\.com/d/(?P<ID>\w{17})' + __config__ = [("activated" , "bool", "Activated" , True), + ("use_premium" , "bool", "Use premium account if available" , True), + ("fallback" , "bool", "Fallback to free download if premium fails" , True), + ("chk_filesize", "bool", "Check file size" , True), + ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] + + __description__ = """Datafile.com hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("GammaC0de", "nitzo2001[AT]yahoo[DOT]com")] + + NAME_PATTERN = r'<div class="file-name">\s+?(?P<N>\S+)\s+?<' + SIZE_PATTERN = r'>Filesize: <span class="lime">(?P<S>[\d.,]+) (?P<U>[\w^_]+)' + + OFFLINE_PATTERN = r'Invalid Link' + TEMP_OFFLINE_PATTERN = r'You are downloading another file at this moment' + PREMIUM_ONLY_PATTERN = r'This file is only available for premium users' + + DIRECT_LINK = False + + + def handle_free(self, pyfile): + m = re.search(r'<span class="time">([\d:]+)<', self.data) + if m: + wait_time = sum(int(_d) * 60 ** _i for _i, _d in enumerate(reversed(m.group(1).split(':')))) + + else: + wait_time = 0 + + self.captcha = ReCaptcha(pyfile) + captcha_key = self.captcha.detect_key() + + if captcha_key: + response, challenge = self.captcha.challenge(captcha_key) + + post_data = {'doaction' : "validateCaptcha", + 'recaptcha_challenge_field': challenge, + 'recaptcha_response_field' : response, + 'fileid' : self.info['pattern']['ID']} + + catcha_result = json.loads(self.load("http://www.datafile.com/files/ajax.html", post=post_data)) + + if not catcha_result['success']: + self.retry_captcha() + + self.captcha.correct() + + self.wait(wait_time) + + post_data['doaction'] = "getFileDownloadLink" + post_data['token'] = catcha_result['token'] + + file_info = json.loads(self.load("http://www.datafile.com/files/ajax.html", post=post_data)) + if file_info['success']: + self.link = file_info['link'] + self.log_debug("URL:%s" % file_info['link']) |