From 942437162dabde1fa2d35452c76061889f47ec90 Mon Sep 17 00:00:00 2001 From: zoidberg10 Date: Tue, 20 Dec 2011 18:40:01 +0100 Subject: update bloody mediafire, fix share-rapid file info --- module/plugins/hoster/EasybytezCom.py | 60 +++++++++++++++++++++++ module/plugins/hoster/MediafireCom.py | 85 ++++++++------------------------- module/plugins/hoster/ShareRapidCom.py | 14 ++---- module/plugins/hoster/TurbouploadCom.py | 44 +++++++++++++++++ 4 files changed, 130 insertions(+), 73 deletions(-) create mode 100644 module/plugins/hoster/EasybytezCom.py create mode 100644 module/plugins/hoster/TurbouploadCom.py (limited to 'module/plugins/hoster') diff --git a/module/plugins/hoster/EasybytezCom.py b/module/plugins/hoster/EasybytezCom.py new file mode 100644 index 000000000..5858dd935 --- /dev/null +++ b/module/plugins/hoster/EasybytezCom.py @@ -0,0 +1,60 @@ +# -*- 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 . + + @author: zoidberg +""" + +import re +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + +class EasybytezCom(SimpleHoster): + __name__ = "EasybytezCom" + __type__ = "hoster" + __pattern__ = r"http://(?:\w*\.)?easybytez.com/(\w+).*" + __version__ = "0.01" + __description__ = """easybytez.com""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + # shares code with TurbouploadCom + + FILE_NAME_PATTERN = r'[^<]+ \((?P[^<]+)\)' + FILE_OFFLINE_PATTERN = r'

File Not Found

' + + FORM_INPUT_PATTERN = r']* name="([^"]+)" value="([^"]*)">' + WAIT_PATTERN = r'[^>]*>(\d+) seconds' + + def handleFree(self): + self.download(self.pyfile.url, post = self.getPostParameters(), ref = True, cookies = True) + + def getPostParameters(self): + inputs = dict(re.findall(self.FORM_INPUT_PATTERN, self.html)) + self.logDebug(inputs) + inputs['method_free'] = "Free Download" + inputs['referer'] = self.pyfile.url + if 'method_premium' in inputs: del inputs['method_premium'] + + self.html = self.load(self.pyfile.url, post = inputs, ref = True, cookies = True) + inputs = dict(re.findall(self.FORM_INPUT_PATTERN, self.html)) + self.logDebug(inputs) + + found = re.search(self.WAIT_PATTERN, self.html) + self.setWait(int(found.group(1)) + 1 if found else 60) + self.wait() + + return inputs + +getInfo = create_getInfo(EasybytezCom) \ No newline at end of file diff --git a/module/plugins/hoster/MediafireCom.py b/module/plugins/hoster/MediafireCom.py index a4c6b1d52..484b48ba6 100644 --- a/module/plugins/hoster/MediafireCom.py +++ b/module/plugins/hoster/MediafireCom.py @@ -58,27 +58,20 @@ class MediafireCom(SimpleHoster): __name__ = "MediafireCom" __type__ = "hoster" __pattern__ = r"http://(?:\w*\.)*mediafire\.com/[^?].*" - __version__ = "0.68" + __version__ = "0.70" __description__ = """Mediafire.com plugin - free only""" __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") - PAGE1_FUNCTION_PATTERN = r"function %s\(qk,pk1\)\{if[^']*'loadingicon'\);[^;]*; (.*?)eval" - PAGE1_KEY_PATTERN = ";break;}\s*(\w+='';\w+=unescape.*?)eval\(" - PAGE1_RESULT_PATTERN = r"(\w+)\('(?P[^']+)','(?P[^']+)'\)" - PAGE1_DIV_PATTERN = r'getElementById\("(\w{32})"\)' - PAGE1_PKR_PATTERN = r"pKr='([^']+)';" + DOWNLOAD_LINK_PATTERN = r'' def process(self, pyfile): @@ -108,61 +101,25 @@ class MediafireCom(SimpleHoster): else: self.fail("No or incorrect password") - found = re.search(self.PAGE1_KEY_PATTERN, self.html) - if found: - result = self.js.eval(found.group(1)) - found = re.search(self.PAGE1_RESULT_PATTERN, result) - else: - self.retry(3, 0, "Parse error (KEY)") - + found = re.search(self.JS_KEY_PATTERN, self.html) try: - param_dict = found.groupdict() - param_dict['r'] = re.search(self.PAGE1_PKR_PATTERN, self.html).group(1) - self.logDebug(param_dict) - key_func = found.group(1) - self.logDebug("KEY_FUNC: %s" % key_func) - - found = re.search(self.PAGE1_FUNCTION_PATTERN % key_func, self.html) result = self.js.eval(found.group(1)) - key_div = re.search(self.PAGE1_DIV_PATTERN, result).group(1) - self.logDebug("KEY_DIV: %s" % key_div) + zmodulo = int(re.search(self.JS_ZMODULO_PATTERN, result).group(1)) + self.logDebug("ZMODULO: %d" % zmodulo) except Exception, e: - self.logError(e) - self.retry(3, 0, "Parse error (KEY DIV)") - - self.html = self.load("http://www.mediafire.com/dynamic/download.php", get=param_dict) - js_expr = replace_eval(re.search(self.PAGE2_VARS_PATTERN, self.html).group(1)) - result = self.js.eval(js_expr) - var_list = dict(re.findall("([^=]+)='([^']+)';", result)) - - page2_dz = replace_eval(re.search(self.PAGE2_DZ_PATTERN, self.html, re.DOTALL).group(1)) - - final_link = None - for link_enc in re.finditer(self.PAGE2_LINK_PATTERN, page2_dz): - #self.logDebug("LINK_ENC: %s..." % link_enc.group(1)[:20]) - try: - link_dec = self.js.eval(link_enc.group(1)) - except Exception, e: - self.logError("Unable to decrypt link %s" % link_enc.group(1)[:20]) - self.logError(e) - self.logDebug(link_enc.group(1)) - continue - - #self.logDebug("LINK_DEC: %s" % link_dec) - if link_enc.group(2): link_dec = link_dec + replace_eval(link_enc.group(2)) - - found = re.search(self.FINAL_LINK_PATTERN, link_dec) - if found: - if found.group(1) == key_div: - final_link = found.group(2) + var_list[found.group(3)] + found.group(4) - break - else: - self.logDebug("Link not found in %s..." % link_dec) - else: - self.fail("Final link not found") - - self.logDebug("FINAL LINK: %s" % final_link) - self.download(final_link) + self.logDebug(e) + self.retry(3, 0, "Parse error (MODULO)") + + vlink = {'zindex': 0, 'href': ''} + for found in re.finditer(self.DOWNLOAD_LINK_PATTERN, self.html): + dlink = found.groupdict() + #self.logDebug(dlink) + dlink['zindex'] = int(dlink['zindex']) % zmodulo + if dlink['zindex'] >= vlink['zindex']: + vlink = dlink + + self.logDebug("DOWNLOAD LINK:", vlink) + self.download(vlink['href']) def checkCaptcha(self): for i in range(5): diff --git a/module/plugins/hoster/ShareRapidCom.py b/module/plugins/hoster/ShareRapidCom.py index 21512046e..b9ce61e18 100644 --- a/module/plugins/hoster/ShareRapidCom.py +++ b/module/plugins/hoster/ShareRapidCom.py @@ -8,31 +8,27 @@ from module.network.HTTPRequest import BadHeader from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo def getInfo(urls): - result = [] - + file_info = [] for url in urls: h = getRequest() try: h.c.setopt(HTTPHEADER, ["Accept: text/html"]) html = h.load(url, cookies = True, decode = True) - - file_info = parseFileInfo(ShareRapidCom, url, getURL(url, decode=True)) - result.append(file_info) + file_info = parseFileInfo(ShareRapidCom, url, html) finally: h.close() - - yield result + yield file_info class ShareRapidCom(SimpleHoster): __name__ = "ShareRapidCom" __type__ = "hoster" __pattern__ = r"http://(?:www\.)?((share(-?rapid\.(biz|com|cz|info|eu|net|org|pl|sk)|-(central|credit|free|net)\.cz|-ms\.net)|(s-?rapid|rapids)\.(cz|sk))|(e-stahuj|mediatack|premium-rapidshare|rapidshare-premium|qiuck)\.cz|kadzet\.com|stahuj-zdarma\.eu|strelci\.net|universal-share\.com)/(stahuj/.+)" - __version__ = "0.46" + __version__ = "0.47" __description__ = """Share-rapid.com plugin - premium only""" __author_name__ = ("MikyWoW", "zoidberg") __author_mail__ = ("MikyWoW@seznam.cz", "zoidberg@mujmail.cz") - FILE_NAME_PATTERN = r'(?:title="Stahnout"|

)(?P[^<]+)' + FILE_NAME_PATTERN = r']*>]*>(?:]*>)?(?P[^<]+)' FILE_SIZE_PATTERN = r'Velikost:\s*\s*(?P[0-9.]+) (?P[kKMG])i?B' DOWNLOAD_URL_PATTERN = r'([^<]+)' ERR_LOGIN_PATTERN = ur'
Stahování je přístupné pouze přihlášeným uživatelům' diff --git a/module/plugins/hoster/TurbouploadCom.py b/module/plugins/hoster/TurbouploadCom.py new file mode 100644 index 000000000..59939d3c7 --- /dev/null +++ b/module/plugins/hoster/TurbouploadCom.py @@ -0,0 +1,44 @@ +# -*- 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 . + + @author: zoidberg +""" + +import re +from module.plugins.internal.SimpleHoster import create_getInfo +from module.plugins.hoster.EasybytezCom import EasybytezCom + +class TurbouploadCom(EasybytezCom): + __name__ = "TurbouploadCom" + __type__ = "hoster" + __pattern__ = r"http://(?:\w*\.)?turboupload.com/(\w+).*" + __version__ = "0.01" + __description__ = """turboupload.com""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + # shares code with EasybytezCom + + DIRECT_LINK_PATTERN = r'\1' + + def handleFree(self): + self.html = self.load(self.pyfile.url, post = self.getPostParameters(), ref = True, cookies = True) + found = re.search(self.DIRECT_LINK_PATTERN, self.html) + if not found: self.parseError('Download Link') + url = found.group(1) + self.logDebug('URL: ' + url) + self.download(url) + +getInfo = create_getInfo(TurbouploadCom) \ No newline at end of file -- cgit v1.2.3