From 6358c74165e54a86d28c1d0bde8fc1a7a13e9830 Mon Sep 17 00:00:00 2001 From: zapp-brannigan Date: Sat, 2 Aug 2014 12:33:05 +0200 Subject: [kingfiles.net] New hoster As requested in https://github.com/pyload/pyload/issues/510 --- module/plugins/hoster/KingfilesNet.py | 63 +++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 module/plugins/hoster/KingfilesNet.py (limited to 'module/plugins') diff --git a/module/plugins/hoster/KingfilesNet.py b/module/plugins/hoster/KingfilesNet.py new file mode 100644 index 000000000..62ba6a225 --- /dev/null +++ b/module/plugins/hoster/KingfilesNet.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +# Testlink: http://www.kingfiles.net/zcegm9nkh2n1/test.dd + +import re +from module.plugins.internal.CaptchaService import SolveMedia +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + +class KingfilesNet(SimpleHoster): + __name__ = "KingfilesNet" + __type__ = "hoster" + __pattern__ = r'https?://(www\.)?kingfiles.net/.+' + __version__ = "0.01" + __description__ = """KingfilesNet hoster plugin (free-user)""" + __author_name__ = ("zapp-brannigan") + __author_mail__ = ("fuerst.reinje@web.de") + + FILE_NAME_PATTERN = r'.+)\">' + FILE_SIZE_PATTERN = r'>Size: (?P.+) (?P[kKmMgG]?i?[bB])<' + OFFLINE_PATTERN = r'No such file with this filename' + FILE_ID_PATTERN = r'' + RANDOM_PATTERN = r'type=\"hidden\" name=\"rand\" value=\"(.+)\">' + DOWNLOAD_URL_PATTERN = r'var download_url = \'(.+)\';' + SOLVEMEDIA_PATTERN = r'src=\"http://api.solvemedia.com/papi/challenge.script\?k=(.+)\">' + + def setup(self): + self.multiDL = False + self.chunkLimit = 1 + + def process(self,pyfile): + #Load main page and find file-id + a = self.load(pyfile.url, cookies=True, decode=True) + file_id = re.search(self.FILE_ID_PATTERN, a).group(1) + self.logDebug("file_id: "+file_id) + + #Click the free user button + post_data = { "op": "download1", "usr_login": "", "id": file_id, "fname": pyfile.name, "referer": "", "method_free": "+" } + b = self.load(pyfile.url, post=post_data, cookies=True, decode=True) + + #Do the captcha stuff + captcha_key = re.search(self.SOLVEMEDIA_PATTERN, b).group(1) + if not captcha_key: + self.fail("Can not find captcha_key, maybe the plugin is out of date") + self.logDebug("captcha_key: "+captcha_key) + rand = re.search(self.RANDOM_PATTERN, b).group(1) + if not rand: + self.fail("Can not find random string, maybe the plugin is out of date") + self.logDebug("random string: "+rand) + solvemedia = SolveMedia(self) + captcha_challenge, captcha_response = solvemedia.challenge(captcha_key) + + #Make the downloadlink appear and load the file + post_data = { "op": "download2", "id": file_id, "rand": rand, "referer": pyfile.url, "method_free": "+", "method_premium": "", "adcopy_response": captcha_response, "adcopy_challenge": captcha_challenge, "down_direct": "1" } + c = self.load(pyfile.url, post=post_data, cookies=True, decode=True) + dl_url = re.search(self.DOWNLOAD_URL_PATTERN, c).group(1) + if not dl_url: + self.fail("Can not find download-url, maybe the plugin is out of date") + self.logDebug("Downloadurl: "+dl_url) + self.download(dl_url, cookies=True, disposition=True) + check = self.checkDownload({"is_html": re.compile("")}) + if check == "is_html": + self.fail("The downloaded file is html, something went wrong. Maybe the plugin is out of date") + +getInfo = create_getInfo(KingfilesNet) -- cgit v1.2.3