diff options
author | zoidberg10 <zoidberg@mujmail.cz> | 2012-04-21 01:11:27 +0200 |
---|---|---|
committer | zoidberg10 <zoidberg@mujmail.cz> | 2012-04-21 01:11:27 +0200 |
commit | 44e49db14c4b96a228def7c871aea40dd07e1dd9 (patch) | |
tree | b8ae49a102c71f66ef2a7917efde5bfac7afc35b | |
parent | update uloz.to, uploading.com - closed #466 (diff) | |
download | pyload-44e49db14c4b96a228def7c871aea40dd07e1dd9.tar.xz |
update ifile.it - closed #583, XFileSharingPro, add rapidgator.net
-rw-r--r-- | module/plugins/hooks/XFileSharingPro.py | 66 | ||||
-rw-r--r-- | module/plugins/hoster/IfileIt.py | 34 | ||||
-rw-r--r-- | module/plugins/hoster/RapidgatorNet.py | 113 |
3 files changed, 195 insertions, 18 deletions
diff --git a/module/plugins/hooks/XFileSharingPro.py b/module/plugins/hooks/XFileSharingPro.py new file mode 100644 index 000000000..b87158a21 --- /dev/null +++ b/module/plugins/hooks/XFileSharingPro.py @@ -0,0 +1,66 @@ +# -*- coding: utf-8 -*- + +from module.plugins.Hook import Hook +import re + +class XFileSharingPro(Hook): + __name__ = "XFileSharingPro" + __version__ = "0.01" + __type__ = "hook" + __config__ = [ ("activated", "bool", "Activated" , "True"), + ("loadDefault", "bool", "Load default hoster list" , "True"), + ("includeList", "str", "Include hosters (comma separated)", ""), + ("excludeList", "str", "Exclude hosters (comma separated)", "")] + __description__ = """MultiShare.cz hook plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + def coreReady(self): + hosterList = self.getConfigSet('includeList') + excludeList = self.getConfigSet('excludeList') + + if self.getConfig('loadDefault'): + hosterList |= set(( + #WORKING HOSTERS: + #NOT TESTED: + "aieshare\.com", "amonshare\.com", "asixfiles\.com", "azsharing\.com", "banashare\.com", "batubia\.com", + "bebasupload\.com", "boosterking\.com", "buckshare\.com", "bulletupload\.com", "crocshare\.com", "ddlanime\.com", "divxme\.com", + "dopeshare\.com", "downupload\.com", "eyesfile\.com", "eyvx\.com", "fik1\.com", "file4safe\.com", "file4sharing\.com", + "fileband\.com", "filebeep\.com", "filebit\.com", "filebox\.com", "filedove\.com", "fileforth\.com", + "filemade\.com", "filemak\.com", "fileplanet\.com", "fileplaygroud\.com", "filerace\.com", "filerio\.com", "filestrack\.com", + "fileupper\.com", "filevelocity\.com", "fooget\.com", "4bytez\.com", "freefilessharing\.com", "glumbouploads\.com", "grupload\.com", + "heftyfile\.com", "hipfile\.com", "host4desi\.com", "hulkshare\.com", "idupin\.com", "imageporter\.com", "isharefast\.com", + "jalurcepat\.com", "kingsupload\.com", "laoupload\.com", "linkzhost\.com", "loombo\.com", "maknyos\.com", "migahost\.com", + "mlfat4arab\.com", "movreel\.com", "netuploaded\.com", "ok2upload\.com", "180upload\.com", "1hostclick\.com", "ovfile\.com", + "putshare\.com", "pyramidfiles\.com", "q4share\.com", "queenshare\.com", "ravishare\.com", "rockdizfile\.com", "sendmyway\.com", + "share76\.com", "sharebeast\.com", "sharehut\.com", "sharerun\.com", "shareswift\.com", "sharingonline\.com", "6ybh-upload\.com", + "skipfile\.com", "spaadyshare\.com", "space4file\.com", "speedoshare\.com", "uploadbaz\.com", "uploadboost\.com", "uploadc\.com", + "uploaddot\.com", "uploadfloor\.com", "uploadic\.com", "uploadville\.com", "uptobox\.com", "vidbull\.com", "zalaa\.com", + "zomgupload\\.com\.com", "kupload\.org", "movbay\.org", "multishare\.org", "omegave\.org", "toucansharing\.org", "uflinq\.org", + "banicrazy\.info", "flowhot\.info", "upbrasil\.info", "shareyourfilez\.biz", "bzlink\.us", "cloudcache\.cc", "fileserver\.cc" + "farshare\.to", "kingshare\.to", "filemaze\.ws", "filehost\.ws", "goldfile\.eu", "xfileshare\.eu", "filestock\.ru", "moidisk\.ru" + "4up\.me", "kfiles\.kz", "odsiebie\.pl", "upchi\.co\.il", "upit\.in", "verzend\.be" + )) + + #NOT WORKING: + """ + """ + + hosterList -= (excludeList) + hosterList -= set(('', u'')) + + if not hosterList: + self.logError("Hoster list is empty" % len(hosterList)) + return + + regexp = r"http://(?:[^./]/.)*?(%s)/\w{12}" % "|".join(hosterList) + self.logDebug("Added %d hosters" % len(hosterList)) + self.logDebug(regexp) + + dict = self.core.pluginManager.hosterPlugins['XFileSharingPro'] + dict["pattern"] = regexp + dict["re"] = re.compile(regexp) + + def getConfigSet(self, option): + s = self.getConfig(option).lower().replace('|',',').replace(';',',').replace('.','\.') + return set([x.strip() for x in s.split('|')])
\ No newline at end of file diff --git a/module/plugins/hoster/IfileIt.py b/module/plugins/hoster/IfileIt.py index cdb5a7919..1626b1853 100644 --- a/module/plugins/hoster/IfileIt.py +++ b/module/plugins/hoster/IfileIt.py @@ -26,7 +26,7 @@ class IfileIt(SimpleHoster): __name__ = "IfileIt" __type__ = "hoster" __pattern__ = r"http://(?:\w*\.)*(?:ifile\.it|mihd\.net)/(\w+).*" - __version__ = "0.25" + __version__ = "0.26" __description__ = """Ifile.it""" __author_name__ = ("zoidberg") @@ -35,29 +35,29 @@ class IfileIt(SimpleHoster): DOWNLOAD_LINK_PATTERN = r'</span> If it doesn\'t, <a target="_blank" href="([^"]+)">' RECAPTCHA_KEY_PATTERN = r"var __recaptcha_public\s*=\s*'([^']+)';" FILE_INFO_PATTERN = r'<span style="cursor: default;[^>]*>\s*(?P<N>.*?)\s* \s*<strong>\s*(?P<S>[0-9.]+)\s*(?P<U>[kKMG])i?B\s*</strong>\s*</span>' - FILE_OFFLINE_PATTERN = r'$\("#errorPnl"\)\.empty\(\)\.append\( "no such file" \);' + FILE_OFFLINE_PATTERN = r'<span style="cursor: default;[^>]*>\s* \s*<strong>\s*</strong>\s*</span>' TEMP_OFFLINE_PATTERN = r'<span class="msg_red">Downloading of this file is temporarily disabled</span>' def handleFree(self): ukey = re.search(self.__pattern__, self.pyfile.url).group(1) - json_url = 'http://ifile.it/download-request2.json?ukey=' + ukey - - json_response = json_loads(self.load(json_url)) + json_url = 'http://ifile.it/new_download-request.json' + post_data = {"ukey" : ukey, "ab": "0"} + + json_response = json_loads(self.load(json_url, post = post_data)) self.logDebug(json_response) + if json_response['status'] == 3: + self.offline() + if json_response["captcha"]: captcha_key = re.search(self.RECAPTCHA_KEY_PATTERN, self.html).group(1) recaptcha = ReCaptcha(self) + post_data["ctype"] = "recaptcha" for i in range(5): - captcha_challenge, captcha_response = recaptcha.challenge(captcha_key) - - json_response = json_loads(self.load(json_url, post={ - "ctype": "recaptcha", - "recaptcha_challenge": captcha_challenge, - "recaptcha_response": captcha_response - })) - + post_data["recaptcha_challenge"], post_data["recaptcha_response"] = recaptcha.challenge(captcha_key) + json_response = json_loads(self.load(json_url, post = post_data)) self.logDebug(json_response) + if json_response["retry"]: self.invalidCaptcha() else: @@ -66,11 +66,9 @@ class IfileIt(SimpleHoster): else: self.fail("Incorrect captcha") - # load twice - self.html = self.load(self.pyfile.url) - self.html = self.load(self.pyfile.url) - download_url = re.search(self.DOWNLOAD_LINK_PATTERN, self.html).group(1) + if not "ticket_url" in json_response: + self.parseError("Download URL") - self.download(download_url) + self.download(json_response["ticket_url"]) getInfo = create_getInfo(IfileIt)
\ No newline at end of file diff --git a/module/plugins/hoster/RapidgatorNet.py b/module/plugins/hoster/RapidgatorNet.py new file mode 100644 index 000000000..a8c55f0ba --- /dev/null +++ b/module/plugins/hoster/RapidgatorNet.py @@ -0,0 +1,113 @@ +# -*- coding: utf-8 -*- +""" + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, + or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see <http://www.gnu.org/licenses/>. + + @author: zoidberg +""" + +import re +from pycurl import HTTPHEADER + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.common.json_layer import json_loads +from module.plugins.ReCaptcha import ReCaptcha + +class RapidgatorNet(SimpleHoster): + __name__ = "RapidgatorNet" + __type__ = "hoster" + __pattern__ = r"http://(?:www\.)?(rapidgator.net)/file/(\d+)" + __version__ = "0.01" + __description__ = """rapidgator.net""" + __author_name__ = ("zoidberg") + + FILE_INFO_PATTERN = r'Downloading:\s*</strong>\s*(?P<N>.*?)\s*</p>\s*<div>\s*File size:\s*<strong>(?P<S>.*?)</strong>' + FILE_OFFLINE_PATTERN = r'<title>File not found</title>' + + JSVARS_PATTERN = r"\s+var\s*(startTimerUrl|getDownloadUrl|captchaUrl|fid|secs)\s*=\s*'?(.*?)'?;" + DOWNLOAD_LINK_PATTERN = r"location.href = '(.*?)'" + RECAPTCHA_KEY_PATTERN = r'"http://api.recaptcha.net/challenge?k=(.*?)"' + + def handleFree(self): + self.checkWait() + + jsvars = dict(re.findall(self.JSVARS_PATTERN, self.html)) + self.logDebug(jsvars) + + self.req.http.lastURL = self.pyfile.url + self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) + + url = "http://rapidgator.net%s?fid=%s" % (jsvars.get('startTimerUrl', '/download/AjaxStartTimer'), jsvars["fid"]) + jsvars.update(self.getJsonResponse(url)) + + self.setWait(int(jsvars.get('secs', 30)) + 1, False) + self.wait() + + url = "http://rapidgator.net%s?sid=%s" % (jsvars.get('getDownloadUrl', '/download/AjaxGetDownload'), jsvars["sid"]) + jsvars.update(self.getJsonResponse(url)) + + self.req.http.lastURL = self.pyfile.url + self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With:"]) + + url = "http://rapidgator.net%s" % jsvars.get('captchaUrl', '/download/captcha') + self.html = self.load(url) + found = re.search(self.RECAPTCHA_KEY_PATTERN, self.html) + captcha_key = found.group(1) if found else "6Lc3yccSAAAAACb1PdeP4xZm1oTZrYzhlhRPjQd_" + recaptcha = ReCaptcha(self) + + for i in range(5): + self.checkWait() + captcha_challenge, captcha_response = recaptcha.challenge(captcha_key) + + self.html = self.load(url, post={ + "DownloadCaptchaForm[captcha]": "", + "recaptcha_challenge_field": captcha_challenge, + "recaptcha_response_field": captcha_response + }) + + if 'The verification code is incorrect' in self.html: + self.invalidCaptcha() + else: + self.correctCaptcha() + break + else: + self.fail("No valid captcha solution received") + + found = re.search(self.DOWNLOAD_LINK_PATTERN, self.html) + if not found: + self.parseError("download link") + download_url = found.group(1) + self.logDebug(download_url) + self.download(download_url) + + def checkWait(self): + wait_time = 0 + if "Delay between downloads must be not less than" in self.html: + wait_time = 5 * 60 + elif "You have reached your daily downloads limit" in self.html: + self.logInfo("Daily limit reached") + wait_time = 60 * 60 + + if wait_time: + self.setWait(wait_time, True) + self.wait() + self.retry(max_tries = 24) + + def getJsonResponse(self, url): + response = self.load(url, decode = True) + if not response.startswith('{'): + self.retry() + self.logDebug(url, response) + return json_loads(response) + +getInfo = create_getInfo(RapidgatorNet)
\ No newline at end of file |