diff options
Diffstat (limited to 'module/plugins/hoster')
73 files changed, 413 insertions, 561 deletions
diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py index 6d3132e65..4f9e25a35 100644 --- a/module/plugins/hoster/BasePlugin.py +++ b/module/plugins/hoster/BasePlugin.py @@ -6,14 +6,14 @@ from urllib import unquote from urlparse import urljoin, urlparse from module.network.HTTPRequest import BadHeader -from module.plugins.internal.SimpleHoster import create_getInfo +from module.plugins.internal.SimpleHoster import create_getInfo, fileUrl from module.plugins.Hoster import Hoster class BasePlugin(Hoster): __name__ = "BasePlugin" __type__ = "hoster" - __version__ = "0.30" + __version__ = "0.33" __pattern__ = r'^unmatchable$' @@ -35,7 +35,8 @@ class BasePlugin(Hoster): def setup(self): - self.chunkLimit = -1 + self.chunkLimit = -1 + self.multiDL = True self.resumeDownload = True @@ -49,7 +50,12 @@ class BasePlugin(Hoster): for _i in xrange(5): try: - self.downloadFile(pyfile) + link = fileUrl(self, unquote(pyfile.url)) + + if link: + self.download(link, ref=False, disposition=True) + else: + self.fail(_("File not found")) except BadHeader, e: if e.code is 404: @@ -85,33 +91,4 @@ class BasePlugin(Hoster): self.fail(check.capitalize()) - def downloadFile(self, pyfile): - url = pyfile.url - - for i in xrange(1, 7): #@TODO: retrieve the pycurl.MAXREDIRS value set by req - header = self.load(url, ref=True, cookies=True, just_header=True, decode=True) - - if 'location' not in header or not header['location']: - if 'code' in header and header['code'] not in (200, 201, 203, 206): - self.logDebug("Received HTTP status code: %d" % header['code']) - self.fail(_("File not found")) - else: - break - - location = header['location'] - - self.logDebug("Redirect #%d to: %s" % (i, location)) - - if urlparse(location).scheme: - url = location - else: - p = urlparse(url) - base = "%s://%s" % (p.scheme, p.netloc) - url = urljoin(base, location) - else: - self.fail(_("Too many redirects")) - - self.download(unquote(url), disposition=True) - - getInfo = create_getInfo(BasePlugin) diff --git a/module/plugins/hoster/BillionuploadsCom.py b/module/plugins/hoster/BillionuploadsCom.py index b20ace0f1..7d7e2624a 100644 --- a/module/plugins/hoster/BillionuploadsCom.py +++ b/module/plugins/hoster/BillionuploadsCom.py @@ -15,8 +15,6 @@ class BillionuploadsCom(XFSHoster): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - HOSTER_DOMAIN = "billionuploads.com" - NAME_PATTERN = r'<td class="dofir" title="(?P<N>.+?)"' SIZE_PATTERN = r'<td class="dofir">(?P<S>[\d.,]+) (?P<U>[\w^_]+)' diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index f7b4d2709..657e70e56 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class BitshareCom(SimpleHoster): __name__ = "BitshareCom" __type__ = "hoster" - __version__ = "0.52" + __version__ = "0.53" __pattern__ = r'http://(?:www\.)?bitshare\.com/(files/)?(?(1)|\?f=)(?P<ID>\w+)(?(1)/(?P<NAME>.+?)\.html)' @@ -114,7 +114,7 @@ class BitshareCom(SimpleHoster): # Try up to 3 times for i in xrange(3): - challenge, response = recaptcha.challenge() + response, challenge = recaptcha.challenge() res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", post={"request" : "validateCaptcha", "ajaxid" : self.ajaxid, diff --git a/module/plugins/hoster/CatShareNet.py b/module/plugins/hoster/CatShareNet.py index f2ddd64a0..339253aeb 100644 --- a/module/plugins/hoster/CatShareNet.py +++ b/module/plugins/hoster/CatShareNet.py @@ -9,7 +9,7 @@ from module.plugins.internal.CaptchaService import ReCaptcha class CatShareNet(SimpleHoster): __name__ = "CatShareNet" __type__ = "hoster" - __version__ = "0.09" + __version__ = "0.11" __pattern__ = r'http://(?:www\.)?catshare\.net/\w{16}' @@ -26,8 +26,9 @@ class CatShareNet(SimpleHoster): OFFLINE_PATTERN = ur'Podany plik został usunięty\s*</div>' IP_BLOCKED_PATTERN = ur'>Nasz serwis wykrył że Twój adres IP nie pochodzi z Polski.<' - SECONDS_PATTERN = 'var\scount\s=\s(\d+);' - LINK_FREE_PATTERN = r'<form action="(.+?)" method="GET">' + WAIT_PATTERN = r'var\scount\s=\s(\d+);' + + LINK_FREE_PATTERN = LINK_PREMIUM_PATTERN = r'<form action="(.+?)" method="GET">' def setup(self): @@ -43,14 +44,9 @@ class CatShareNet(SimpleHoster): def handleFree(self, pyfile): - m = re.search(self.SECONDS_PATTERN, self.html) - if m: - wait_time = int(m.group(1)) - self.wait(wait_time, True) - recaptcha = ReCaptcha(self) - challenge, response = recaptcha.challenge() + response, challenge = recaptcha.challenge() self.html = self.load(pyfile.url, post={'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response}) diff --git a/module/plugins/hoster/CloudzillaTo.py b/module/plugins/hoster/CloudzillaTo.py index 58b1ac0dd..ee966c280 100644 --- a/module/plugins/hoster/CloudzillaTo.py +++ b/module/plugins/hoster/CloudzillaTo.py @@ -47,7 +47,7 @@ class CloudzillaTo(SimpleHoster): self.fail(ticket['error']) if 'wait' in ticket: - self.wait(int(ticket['wait']), int(ticket['wait']) > 5) + self.wait(ticket['wait'], int(ticket['wait']) > 5) self.link = "http://%(server)s/download/%(file_id)s/%(ticket_id)s" % {'server' : ticket['server'], 'file_id' : self.info['pattern']['ID'], diff --git a/module/plugins/hoster/CramitIn.py b/module/plugins/hoster/CramitIn.py index f444718bc..44dac958d 100644 --- a/module/plugins/hoster/CramitIn.py +++ b/module/plugins/hoster/CramitIn.py @@ -15,8 +15,6 @@ class CramitIn(XFSHoster): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - HOSTER_DOMAIN = "cramit.in" - INFO_PATTERN = r'<span class=t2>\s*(?P<N>.*?)</span>.*?<small>\s*\((?P<S>.*?)\)' LINK_PATTERN = r'href="(http://cramit\.in/file_download/.*?)"' diff --git a/module/plugins/hoster/CrockoCom.py b/module/plugins/hoster/CrockoCom.py index 31d0eec95..474042a5a 100644 --- a/module/plugins/hoster/CrockoCom.py +++ b/module/plugins/hoster/CrockoCom.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class CrockoCom(SimpleHoster): __name__ = "CrockoCom" __type__ = "hoster" - __version__ = "0.18" + __version__ = "0.19" __pattern__ = r'http://(?:www\.)?(crocko|easy-share)\.com/\w+' @@ -52,7 +52,7 @@ class CrockoCom(SimpleHoster): recaptcha = ReCaptcha(self) for _i in xrange(5): - inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge() + inputs['recaptcha_response_field'], inputs['recaptcha_challenge_field'] = recaptcha.challenge() self.download(action, post=inputs) if self.checkDownload({"captcha": recaptcha.KEY_AJAX_PATTERN}): diff --git a/module/plugins/hoster/DateiTo.py b/module/plugins/hoster/DateiTo.py index 99b86e000..e5061e026 100644 --- a/module/plugins/hoster/DateiTo.py +++ b/module/plugins/hoster/DateiTo.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DateiTo(SimpleHoster): __name__ = "DateiTo" __type__ = "hoster" - __version__ = "0.06" + __version__ = "0.07" __pattern__ = r'http://(?:www\.)?datei\.to/datei/(?P<ID>\w+)\.html' @@ -52,7 +52,7 @@ class DateiTo(SimpleHoster): data = dict(x.split('=') for x in m.group(2).split('&')) if url.endswith('recaptcha.php'): - data['recaptcha_challenge_field'], data['recaptcha_response_field'] = recaptcha.challenge() + data['recaptcha_response_field'], data['recaptcha_challenge_field'] = recaptcha.challenge() else: self.fail(_("Too bad...")) diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py index 9d060e75d..3af309cae 100644 --- a/module/plugins/hoster/DepositfilesCom.py +++ b/module/plugins/hoster/DepositfilesCom.py @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DepositfilesCom(SimpleHoster): __name__ = "DepositfilesCom" __type__ = "hoster" - __version__ = "0.52" + __version__ = "0.53" __pattern__ = r'https?://(?:www\.)?(depositfiles\.com|dfiles\.(eu|ru))(/\w{1,3})?/files/(?P<ID>\w+)' @@ -77,7 +77,7 @@ class DepositfilesCom(SimpleHoster): if '<input type=button value="Continue" onclick="check_recaptcha' in self.html: if 'response' in params: self.invalidCaptcha() - params['challenge'], params['response'] = recaptcha.challenge(captcha_key) + params['response'], params['challenge'] = recaptcha.challenge(captcha_key) self.logDebug(params) continue @@ -95,7 +95,7 @@ class DepositfilesCom(SimpleHoster): try: self.download(link, disposition=True) - except: + except Exception: self.retry(wait_time=60) diff --git a/module/plugins/hoster/DlFreeFr.py b/module/plugins/hoster/DlFreeFr.py index ec40b64ce..4776bf470 100644 --- a/module/plugins/hoster/DlFreeFr.py +++ b/module/plugins/hoster/DlFreeFr.py @@ -36,7 +36,7 @@ class CustomBrowser(Browser): class DlFreeFr(SimpleHoster): __name__ = "DlFreeFr" __type__ = "hoster" - __version__ = "0.27" + __version__ = "0.28" __pattern__ = r'http://(?:www\.)?dl\.free\.fr/(\w+|getfile\.pl\?file=/\w+)' @@ -92,7 +92,8 @@ class DlFreeFr(SimpleHoster): action, inputs = self.parseHtmlForm('action="getfile.pl"') adyoulike = AdYouLike(self) - inputs.update(adyoulike.challenge()) + response, challenge = adyoulike.challenge() + inputs.update(response) self.load("http://dl.free.fr/getfile.pl", post=inputs) headers = self.getLastHeaders() diff --git a/module/plugins/hoster/EasybytezCom.py b/module/plugins/hoster/EasybytezCom.py index cd54bdc70..693910c1b 100644 --- a/module/plugins/hoster/EasybytezCom.py +++ b/module/plugins/hoster/EasybytezCom.py @@ -16,8 +16,6 @@ class EasybytezCom(XFSHoster): ("stickell", "l.stickell@yahoo.it")] - HOSTER_DOMAIN = "easybytez.com" - OFFLINE_PATTERN = r'>File not available' LINK_PATTERN = r'(http://(\w+\.(easybytez|easyload|ezbytez|zingload)\.(com|to)|\d+\.\d+\.\d+\.\d+)/files/\d+/\w+/.+?)["\'<]' diff --git a/module/plugins/hoster/ExashareCom.py b/module/plugins/hoster/ExashareCom.py new file mode 100644 index 000000000..536c09b6d --- /dev/null +++ b/module/plugins/hoster/ExashareCom.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- + +import re + +from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo + + +class ExashareCom(XFSHoster): + __name__ = "ExashareCom" + __type__ = "hoster" + __version__ = "0.01" + + __pattern__ = r'http://(?:www\.)?exashare\.com/\w{12}' + + __description__ = """Exashare.com hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + INFO_PATTERN = r'>(?P<NAME>.+?)<small>\( (?P<S>[\d.,]+) (?P<U>[\w^_]+)' + LINK_FREE_PATTERN = r'file: "(.+?)"' + + + def setup(self): + self.multiDL = True + self.chunkLimit = 1 + self.resumeDownload = self.premium + + + def handleFree(self, pyfile): + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m is None: + self.error(_("Free download link not found")) + else: + self.link = m.group(1) + + +getInfo = create_getInfo(ExashareCom) diff --git a/module/plugins/hoster/ExtabitCom.py b/module/plugins/hoster/ExtabitCom.py index 5c2976a29..68695faad 100644 --- a/module/plugins/hoster/ExtabitCom.py +++ b/module/plugins/hoster/ExtabitCom.py @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, s class ExtabitCom(SimpleHoster): __name__ = "ExtabitCom" __type__ = "hoster" - __version__ = "0.64" + __version__ = "0.65" __pattern__ = r'http://(?:www\.)?extabit\.com/(file|go|fid)/(?P<ID>\w+)' @@ -50,7 +50,7 @@ class ExtabitCom(SimpleHoster): for _i in xrange(5): get_data = {"type": "recaptcha"} - get_data['challenge'], get_data['capture'] = recaptcha.challenge(captcha_key) + get_data['capture'], get_data['challenge'] = recaptcha.challenge(captcha_key) res = json_loads(self.load("http://extabit.com/file/%s/" % fileID, get=get_data)) if "ok" in res: self.correctCaptcha() diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index bc328ddbd..fb1aea58f 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FilecloudIo(SimpleHoster): __name__ = "FilecloudIo" __type__ = "hoster" - __version__ = "0.06" + __version__ = "0.08" __pattern__ = r'http://(?:www\.)?(?:filecloud\.io|ifile\.it|mihd\.net)/(?P<ID>\w+)' @@ -59,7 +59,7 @@ class FilecloudIo(SimpleHoster): if captcha_key is None: self.error(_("ReCaptcha key not found")) - challenge, response = recaptcha.challenge(captcha_key) + response, challenge = recaptcha.challenge(captcha_key) self.account.form_data = {"recaptcha_challenge_field": challenge, "recaptcha_response_field" : response} self.account.relogin(self.user) @@ -78,7 +78,7 @@ class FilecloudIo(SimpleHoster): data['ctype'] = "recaptcha" for _i in xrange(5): - data['recaptcha_challenge'], data['recaptcha_response'] = recaptcha.challenge(captcha_key) + data['recaptcha_response'], data['recaptcha_challenge'] = recaptcha.challenge(captcha_key) json_url = "http://filecloud.io/download-request.json" res = self.load(json_url, post=data) diff --git a/module/plugins/hoster/FilefactoryCom.py b/module/plugins/hoster/FilefactoryCom.py index 2c8ec58f4..30c1b85ec 100644 --- a/module/plugins/hoster/FilefactoryCom.py +++ b/module/plugins/hoster/FilefactoryCom.py @@ -56,7 +56,7 @@ class FilefactoryCom(SimpleHoster): m = re.search(self.WAIT_PATTERN, self.html) if m: - self.wait(int(m.group(1))) + self.wait(m.group(1)) self.download(dl_link, disposition=True) diff --git a/module/plugins/hoster/FileomCom.py b/module/plugins/hoster/FileomCom.py index 2b6fd34db..306953b84 100644 --- a/module/plugins/hoster/FileomCom.py +++ b/module/plugins/hoster/FileomCom.py @@ -18,8 +18,6 @@ class FileomCom(XFSHoster): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_DOMAIN = "fileom.com" - NAME_PATTERN = r'Filename: <span>(?P<N>.+?)<' SIZE_PATTERN = r'File Size: <span class="size">(?P<S>[\d.,]+) (?P<U>[\w^_]+)' diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index 4dd36c6e4..25def94e8 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -12,7 +12,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FilepostCom(SimpleHoster): __name__ = "FilepostCom" __type__ = "hoster" - __version__ = "0.32" + __version__ = "0.33" __pattern__ = r'https?://(?:www\.)?(?:filepost\.com/files|fp\.io)/(?P<ID>[^/]+)' @@ -74,7 +74,7 @@ class FilepostCom(SimpleHoster): for i in xrange(5): get_dict['JsHttpRequest'] = str(int(time() * 10000)) + '-xml' if i: - post_dict['recaptcha_challenge_field'], post_dict['recaptcha_response_field'] = recaptcha.challenge( + post_dict['recaptcha_response_field'], post_dict['recaptcha_challenge_field'] = recaptcha.challenge( captcha_key) self.logDebug(u"RECAPTCHA: %s : %s : %s" % ( captcha_key, post_dict['recaptcha_challenge_field'], post_dict['recaptcha_response_field'])) diff --git a/module/plugins/hoster/FilerNet.py b/module/plugins/hoster/FilerNet.py index a668a834b..c5007e945 100644 --- a/module/plugins/hoster/FilerNet.py +++ b/module/plugins/hoster/FilerNet.py @@ -16,7 +16,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FilerNet(SimpleHoster): __name__ = "FilerNet" __type__ = "hoster" - __version__ = "0.13" + __version__ = "0.16" __pattern__ = r'https?://(?:www\.)?filer\.net/get/\w+' @@ -53,30 +53,22 @@ class FilerNet(SimpleHoster): if 'hash' not in inputs: self.error(_("Unable to detect hash")) - recaptcha = ReCaptcha(self) - - for _i in xrange(5): - challenge, response = recaptcha.challenge() - - #@NOTE: Work-around for v0.4.9 just_header issue - #@TODO: Check for v0.4.10 - self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 0) - self.load(pyfile.url, post={'recaptcha_challenge_field': challenge, - 'recaptcha_response_field' : response, - 'hash' : inputs['hash']}) - self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 1) - - if 'location' in self.req.http.header.lower(): - self.link = re.search(r'location: (\S+)', self.req.http.header, re.I).group(1) - self.correctCaptcha() - break - else: - self.invalidCaptcha() - - - def downloadLink(self, link): - if link and isinstance(link, basestring): - self.download(urljoin("http://filer.net/", link), disposition=True) + recaptcha = ReCaptcha(self) + response, challenge = recaptcha.challenge() + + #@NOTE: Work-around for v0.4.9 just_header issue + #@TODO: Check for v0.4.10 + self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 0) + self.load(pyfile.url, post={'recaptcha_challenge_field': challenge, + 'recaptcha_response_field' : response, + 'hash' : inputs['hash']}) + self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 1) + + if 'location' in self.req.http.header.lower(): + self.link = re.search(r'location: (\S+)', self.req.http.header, re.I).group(1) + self.correctCaptcha() + else: + self.invalidCaptcha() getInfo = create_getInfo(FilerNet) diff --git a/module/plugins/hoster/FilerioCom.py b/module/plugins/hoster/FilerioCom.py index db81f5b16..c6ebbd444 100644 --- a/module/plugins/hoster/FilerioCom.py +++ b/module/plugins/hoster/FilerioCom.py @@ -15,8 +15,6 @@ class FilerioCom(XFSHoster): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - HOSTER_DOMAIN = "filerio.in" - URL_REPLACEMENTS = [(r'filekeen\.com', "filerio.in")] OFFLINE_PATTERN = r'>"File Not Found|File has been removed' diff --git a/module/plugins/hoster/FilesMailRu.py b/module/plugins/hoster/FilesMailRu.py index 18fca7176..7bd099282 100644 --- a/module/plugins/hoster/FilesMailRu.py +++ b/module/plugins/hoster/FilesMailRu.py @@ -21,7 +21,7 @@ def getInfo(urls): url_pattern = '<a href="(.+?)" onclick="return Act\(this\, \'dlink\'\, event\)">(.+?)</a>' file_name = re.search(url_pattern, html).group(0).split(', event)">')[1].split('</a>')[0] result.append((file_name, 0, 2, url)) - except: + except Exception: pass # status 1=OFFLINE, 2=OK, 3=UNKNOWN diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index 515ec9029..6f316cea3 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -33,7 +33,7 @@ def checkFile(plugin, urls): class FileserveCom(Hoster): __name__ = "FileserveCom" __type__ = "hoster" - __version__ = "0.53" + __version__ = "0.54" __pattern__ = r'http://(?:www\.)?fileserve\.com/file/(?P<ID>[^/]+)' @@ -161,7 +161,7 @@ class FileserveCom(Hoster): recaptcha = ReCaptcha(self) for _i in xrange(5): - challenge, response = recaptcha.challenge(captcha_key) + response, challenge = recaptcha.challenge(captcha_key) res = json_loads(self.load(self.URLS[2], post={'recaptcha_challenge_field' : challenge, 'recaptcha_response_field' : response, diff --git a/module/plugins/hoster/FourSharedCom.py b/module/plugins/hoster/FourSharedCom.py index 78aeece44..a3f53ac5e 100644 --- a/module/plugins/hoster/FourSharedCom.py +++ b/module/plugins/hoster/FourSharedCom.py @@ -53,7 +53,7 @@ class FourSharedCom(SimpleHoster): m = re.search(self.ID_PATTERN, self.html) res = self.load('http://www.4shared.com/web/d2/getFreeDownloadLimitInfo?fileId=%s' % m.group(1)) self.logDebug(res) - except: + except Exception: pass self.wait(20) diff --git a/module/plugins/hoster/FshareVn.py b/module/plugins/hoster/FshareVn.py index 872511afc..4912974ad 100644 --- a/module/plugins/hoster/FshareVn.py +++ b/module/plugins/hoster/FshareVn.py @@ -25,7 +25,7 @@ def doubleDecode(m): class FshareVn(SimpleHoster): __name__ = "FshareVn" __type__ = "hoster" - __version__ = "0.19" + __version__ = "0.20" __pattern__ = r'http://(?:www\.)?fshare\.vn/file/.+' @@ -58,7 +58,7 @@ class FshareVn(SimpleHoster): self.checkErrors() action, inputs = self.parseHtmlForm('frm_download') - self.url = urljoin(pyfile.url, action) + url = urljoin(pyfile.url, action) if not inputs: self.error(_("No FORM")) @@ -69,7 +69,7 @@ class FshareVn(SimpleHoster): if password: self.logInfo(_("Password protected link, trying ") + password) inputs['link_file_pwd_dl'] = password - self.html = self.load(self.url, post=inputs, decode=True) + self.html = self.load(url, post=inputs, decode=True) if 'name="link_file_pwd_dl"' in self.html: self.fail(_("Incorrect password")) @@ -77,7 +77,7 @@ class FshareVn(SimpleHoster): self.fail(_("No password found")) else: - self.html = self.load(self.url, post=inputs, decode=True) + self.html = self.load(url, post=inputs, decode=True) self.checkErrors() @@ -87,11 +87,9 @@ class FshareVn(SimpleHoster): m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: self.error(_("LINK_FREE_PATTERN not found")) - self.url = m.group(1) - self.logDebug("FREE DL URL: %s" % self.url) - + + self.link = m.group(1) self.wait() - self.download(self.url) def checkErrors(self): diff --git a/module/plugins/hoster/Ftp.py b/module/plugins/hoster/Ftp.py index 8562778c4..22fc5f67a 100644 --- a/module/plugins/hoster/Ftp.py +++ b/module/plugins/hoster/Ftp.py @@ -35,7 +35,7 @@ class Ftp(Hoster): pyfile.name = parsed_url.path.rpartition('/')[2] try: pyfile.name = unquote(str(pyfile.name)).decode('utf8') - except: + except Exception: pass if not "@" in netloc: diff --git a/module/plugins/hoster/HellshareCz.py b/module/plugins/hoster/HellshareCz.py index 47b981dd7..05caf052d 100644 --- a/module/plugins/hoster/HellshareCz.py +++ b/module/plugins/hoster/HellshareCz.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class HellshareCz(SimpleHoster): __name__ = "HellshareCz" __type__ = "hoster" - __version__ = "0.84" + __version__ = "0.85" __pattern__ = r'http://(?:www\.)?hellshare\.(?:cz|com|sk|hu|pl)/[^?]*/\d+' @@ -32,10 +32,4 @@ class HellshareCz(SimpleHoster): self.chunkLimit = 1 - def downloadLink(self, link): - if link and isinstance(link, basestring): - self.correctCaptcha() - self.download(urljoin("http://www.hellshare.com/", link), disposition=True) - - getInfo = create_getInfo(HellshareCz) diff --git a/module/plugins/hoster/HugefilesNet.py b/module/plugins/hoster/HugefilesNet.py index f7221f8c5..b7e599a50 100644 --- a/module/plugins/hoster/HugefilesNet.py +++ b/module/plugins/hoster/HugefilesNet.py @@ -17,8 +17,6 @@ class HugefilesNet(XFSHoster): __authors__ = [("stickell", "l.stickell@yahoo.it")] - HOSTER_DOMAIN = "hugefiles.net" - SIZE_PATTERN = r'File Size:</span>\s*<span[^>]*>(?P<S>[^<]+)</span></div>' FORM_INPUTS_MAP = {'ctype': re.compile(r'\d+')} diff --git a/module/plugins/hoster/HundredEightyUploadCom.py b/module/plugins/hoster/HundredEightyUploadCom.py index 4fc96a2b1..32d36ddb9 100644 --- a/module/plugins/hoster/HundredEightyUploadCom.py +++ b/module/plugins/hoster/HundredEightyUploadCom.py @@ -15,7 +15,5 @@ class HundredEightyUploadCom(XFSHoster): __authors__ = [("stickell", "l.stickell@yahoo.it")] - HOSTER_DOMAIN = "180upload.com" - getInfo = create_getInfo(HundredEightyUploadCom) diff --git a/module/plugins/hoster/JunocloudMe.py b/module/plugins/hoster/JunocloudMe.py index 56d6588fa..415d5e2d0 100644 --- a/module/plugins/hoster/JunocloudMe.py +++ b/module/plugins/hoster/JunocloudMe.py @@ -15,8 +15,6 @@ class JunocloudMe(XFSHoster): __authors__ = [("guidobelix", "guidobelix@hotmail.it")] - HOSTER_DOMAIN = "junocloud.me" - URL_REPLACEMENTS = [(r'//(www\.)?junocloud', "//dl3.junocloud")] OFFLINE_PATTERN = r'>No such file with this filename<' diff --git a/module/plugins/hoster/Keep2shareCc.py b/module/plugins/hoster/Keep2ShareCc.py index 05b3c639d..34bc3de54 100644 --- a/module/plugins/hoster/Keep2shareCc.py +++ b/module/plugins/hoster/Keep2ShareCc.py @@ -2,7 +2,7 @@ import re -from urlparse import urljoin, urlparse +from urlparse import urljoin from module.plugins.internal.CaptchaService import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class Keep2ShareCc(SimpleHoster): __name__ = "Keep2ShareCc" __type__ = "hoster" - __version__ = "0.19" + __version__ = "0.21" __pattern__ = r'https?://(?:www\.)?(keep2share|k2s|keep2s)\.cc/file/(?P<ID>\w+)' @@ -29,7 +29,8 @@ class Keep2ShareCc(SimpleHoster): OFFLINE_PATTERN = r'File not found or deleted|Sorry, this file is blocked or deleted|Error 404' TEMP_OFFLINE_PATTERN = r'Downloading blocked due to' - LINK_FREE_PATTERN = LINK_PREMIUM_PATTERN = r'"([^"]+url.html?file=.+?)"|window\.location\.href = \'(.+?)\';' + LINK_FREE_PATTERN = r'"([^"]+url.html?file=.+?)"|window\.location\.href = \'(.+?)\';' + LINK_PREMIUM_PATTERN = r'window\.location\.href = \'(.+?)\';' CAPTCHA_PATTERN = r'src="(/file/captcha\.html.+?)"' @@ -64,9 +65,9 @@ class Keep2ShareCc(SimpleHoster): self.info.pop('error', None) - def handleFree(self): + def handleFree(self, pyfile): self.fid = re.search(r'<input type="hidden" name="slow_id" value="([^"]+)">', self.html).group(1) - self.html = self.load(self.pyfile.url, post={'yt0': '', 'slow_id': self.fid}) + self.html = self.load(pyfile.url, post={'yt0': '', 'slow_id': self.fid}) self.checkErrors() @@ -77,54 +78,37 @@ class Keep2ShareCc(SimpleHoster): self.wait(30) - self.html = self.load(self.pyfile.url, post={'uniqueId': self.fid, 'free': 1}) - - self.checkErrors() + self.html = self.load(pyfile.url) m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: - self.error(_("LINK_FREE_PATTERN not found")) + self.error(_("Free download link not found")) self.link = m.group(1) def handleCaptcha(self): recaptcha = ReCaptcha(self) + post_data = {'free' : 1, + 'freeDownloadRequest': 1, + 'uniqueId' : self.fid, + 'yt0' : ''} - for _i in xrange(5): - post_data = {'free' : 1, - 'freeDownloadRequest': 1, - 'uniqueId' : self.fid, - 'yt0' : ''} - - m = re.search(self.CAPTCHA_PATTERN, self.html) - if m: - captcha_url = urljoin("http://k2s.cc/", m.group(1)) - post_data['CaptchaForm[code]'] = self.decryptCaptcha(captcha_url) - else: - challenge, response = recaptcha.challenge() - post_data.update({'recaptcha_challenge_field': challenge, - 'recaptcha_response_field' : response}) - - self.html = self.load(self.pyfile.url, post=post_data) - - if 'recaptcha' not in self.html: - self.correctCaptcha() - break - else: - self.invalidCaptcha() + m = re.search(self.CAPTCHA_PATTERN, self.html) + if m: + captcha_url = urljoin("http://k2s.cc/", m.group(1)) + post_data['CaptchaForm[code]'] = self.decryptCaptcha(captcha_url) else: - self.fail(_("All captcha attempts failed")) - + response, challenge = recaptcha.challenge() + post_data.update({'recaptcha_challenge_field': challenge, + 'recaptcha_response_field' : response}) - def downloadLink(self, link): - if not link or not isinstance(link, basestring): - return + self.html = self.load(self.pyfile.url, post=post_data) - link = self.directLink(self, link, self.resumeDownload) - - if link: - self.download(urljoin("http://k2s.cc/", link), disposition=True) + if 'verification code is incorrect' not in self.html: + self.correctCaptcha() + else: + self.invalidCaptcha() getInfo = create_getInfo(Keep2ShareCc) diff --git a/module/plugins/hoster/KingfilesNet.py b/module/plugins/hoster/KingfilesNet.py index a75ef5f3e..eb4d34cc2 100644 --- a/module/plugins/hoster/KingfilesNet.py +++ b/module/plugins/hoster/KingfilesNet.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class KingfilesNet(SimpleHoster): __name__ = "KingfilesNet" __type__ = "hoster" - __version__ = "0.06" + __version__ = "0.07" __pattern__ = r'http://(?:www\.)?kingfiles\.net/(?P<ID>\w{12})' @@ -46,7 +46,7 @@ class KingfilesNet(SimpleHoster): self.html = self.load(pyfile.url, post=post_data, cookies=True, decode=True) solvemedia = SolveMedia(self) - challenge, response = solvemedia.challenge() + response, challenge = solvemedia.challenge() # Make the downloadlink appear and load the file m = re.search(self.RAND_ID_PATTERN, self.html) diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index 6d5641778..cd922aea7 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -36,7 +36,7 @@ def getInfo(urls): class LetitbitNet(SimpleHoster): __name__ = "LetitbitNet" __type__ = "hoster" - __version__ = "0.29" + __version__ = "0.30" __pattern__ = r'https?://(?:www\.)?(letitbit|shareflare)\.net/download/.+' @@ -96,7 +96,7 @@ class LetitbitNet(SimpleHoster): self.logDebug(res) recaptcha = ReCaptcha(self) - challenge, response = recaptcha.challenge() + response, challenge = recaptcha.challenge() post_data = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": response, diff --git a/module/plugins/hoster/LoadTo.py b/module/plugins/hoster/LoadTo.py index b21a69b5f..6f4e8d73c 100644 --- a/module/plugins/hoster/LoadTo.py +++ b/module/plugins/hoster/LoadTo.py @@ -13,7 +13,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class LoadTo(SimpleHoster): __name__ = "LoadTo" __type__ = "hoster" - __version__ = "0.19" + __version__ = "0.20" __pattern__ = r'http://(?:www\.)?load\.to/\w+' @@ -49,7 +49,7 @@ class LoadTo(SimpleHoster): # Set Timer - may be obsolete m = re.search(self.WAIT_PATTERN, self.html) if m: - self.wait(int(m.group(1))) + self.wait(m.group(1)) # Load.to is using solvemedia captchas since ~july 2014: solvemedia = SolveMedia(self) @@ -58,7 +58,7 @@ class LoadTo(SimpleHoster): if captcha_key is None: self.download(download_url) else: - challenge, response = solvemedia.challenge(captcha_key) + response, challenge = solvemedia.challenge(captcha_key) self.download(download_url, post={"adcopy_challenge": challenge, "adcopy_response": response}) diff --git a/module/plugins/hoster/LuckyShareNet.py b/module/plugins/hoster/LuckyShareNet.py index 09300a41a..74bf877f1 100644 --- a/module/plugins/hoster/LuckyShareNet.py +++ b/module/plugins/hoster/LuckyShareNet.py @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class LuckyShareNet(SimpleHoster): __name__ = "LuckyShareNet" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" __pattern__ = r'https?://(?:www\.)?luckyshare\.net/(?P<ID>\d{10,})' @@ -47,12 +47,12 @@ class LuckyShareNet(SimpleHoster): self.logDebug("JSON: " + rep) json = self.parseJson(rep) - self.wait(int(json['time'])) + self.wait(json['time']) recaptcha = ReCaptcha(self) for _i in xrange(5): - challenge, response = recaptcha.challenge() + response, challenge = recaptcha.challenge() rep = self.load(r"http://luckyshare.net/download/verify/challenge/%s/response/%s/hash/%s" % (challenge, response, json['hash']), decode=True) self.logDebug("JSON: " + rep) diff --git a/module/plugins/hoster/MediafireCom.py b/module/plugins/hoster/MediafireCom.py index 81bd36f73..bc81c8202 100644 --- a/module/plugins/hoster/MediafireCom.py +++ b/module/plugins/hoster/MediafireCom.py @@ -33,7 +33,7 @@ def checkHTMLHeader(url): return url, 2 else: break - except: + except Exception: return url, 3 else: return url, 0 @@ -54,7 +54,7 @@ def getInfo(urls): class MediafireCom(SimpleHoster): __name__ = "MediafireCom" __type__ = "hoster" - __version__ = "0.83" + __version__ = "0.84" __pattern__ = r'http://(?:www\.)?mediafire\.com/(file/|(view/?|download\.php)?\?)(\w{11}|\w{15})($|/)' @@ -121,7 +121,7 @@ class MediafireCom(SimpleHoster): def checkCaptcha(self): solvemedia = SolveMedia(self) - challenge, response = solvemedia.challenge() + response, challenge = solvemedia.challenge() self.html = self.load(self.link, post={'adcopy_challenge': challenge, 'adcopy_response' : response}, diff --git a/module/plugins/hoster/MegaCoNz.py b/module/plugins/hoster/MegaCoNz.py index fbd34c563..4ad20b265 100644 --- a/module/plugins/hoster/MegaCoNz.py +++ b/module/plugins/hoster/MegaCoNz.py @@ -124,7 +124,7 @@ class MegaCoNz(Hoster): df = open(file_decrypted, "wb") except IOError, e: - self.fail(str(e)) + self.fail(e) chunk_size = 2 ** 15 # buffer size, 32k # file_mac = [0, 0, 0, 0] # calculate CBC-MAC for checksum @@ -160,7 +160,7 @@ class MegaCoNz(Hoster): # if file_mac[0] ^ file_mac[1], file_mac[2] ^ file_mac[3] != meta_mac: # os.remove(file_decrypted) - # self.fail("Checksum mismatch") + # self.fail(_("Checksum mismatch")) os.remove(file_crypted) self.lastDownload = fs_decode(file_decrypted) diff --git a/module/plugins/hoster/MovReelCom.py b/module/plugins/hoster/MovReelCom.py index 9bb63701c..9b8679c10 100644 --- a/module/plugins/hoster/MovReelCom.py +++ b/module/plugins/hoster/MovReelCom.py @@ -15,8 +15,6 @@ class MovReelCom(XFSHoster): __authors__ = [("JorisV83", "jorisv83-pyload@yahoo.com")] - HOSTER_DOMAIN = "movreel.com" - LINK_PATTERN = r'<a href="([^"]+)">Download Link' diff --git a/module/plugins/hoster/MultihostersCom.py b/module/plugins/hoster/MultihostersCom.py index c5a48310e..bcd7c6237 100644 --- a/module/plugins/hoster/MultihostersCom.py +++ b/module/plugins/hoster/MultihostersCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.hosters.ZeveraCom import ZeveraCom +from module.plugins.hoster.ZeveraCom import ZeveraCom class MultihostersCom(ZeveraCom): __name__ = "MultihostersCom" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" __pattern__ = r'https?://(?:www\.)multihosters\.com/(getFiles\.ashx|Members/download\.ashx)\?.*ourl=.+' diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index 35c814656..3efbdce23 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -23,7 +23,7 @@ def getInfo(urls): for url in chunk: match = id_regex.search(url) if match: - ids = ids + match.group(1) + ";" + ids = ids + match.group('ID') + ";" api = getURL(apiurl, get={'auth' : "Zf9SnQh9WiReEsb18akjvQGqT0I830e8", @@ -62,9 +62,9 @@ def getInfo(urls): class NetloadIn(Hoster): __name__ = "NetloadIn" __type__ = "hoster" - __version__ = "0.47" + __version__ = "0.49" - __pattern__ = r'https?://(?:[^/]*\.)?netload\.in/(?:datei(.*?)(?:\.htm|/)|index\.php?id=10&file_id=)' + __pattern__ = r'https?://(?:www\.)?netload\.in/(?P<PATH>datei|index\.php\?id=10&file_id=)(?P<ID>\w+)' __description__ = """Netload.in hoster plugin""" __license__ = "GPLv3" @@ -73,6 +73,9 @@ class NetloadIn(Hoster): ("Gregy", "gregy@gregy.cz")] + RECAPTCHA_KEY = "6LcLJMQSAAAAAJzquPUPKNovIhbK6LpSqCjYrsR1" + + def setup(self): self.multiDL = self.resumeDownload = self.premium @@ -118,7 +121,7 @@ class NetloadIn(Hoster): if match: #normalize url - self.url = 'http://www.netload.in/datei%s.htm' % match.group(1) + self.url = 'http://www.netload.in/datei%s.htm' % match.group('ID') self.logDebug("URL: %s" % self.url) else: self.api_data = False @@ -126,7 +129,7 @@ class NetloadIn(Hoster): apiurl = "http://api.netload.in/info.php" html = self.load(apiurl, cookies=False, - get={"file_id": match.group(1), "auth": "Zf9SnQh9WiReEsb18akjvQGqT0I830e8", "bz": "1", + get={"file_id": match.group('ID'), "auth": "Zf9SnQh9WiReEsb18akjvQGqT0I830e8", "bz": "1", "md5": "1"}, decode=True).strip() if not html and n <= 3: self.setWait(2) @@ -235,7 +238,7 @@ class NetloadIn(Hoster): recaptcha = ReCaptcha(self) for _i in xrange(5): - challenge, response = recaptcha.challenge() + response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) response_page = self.load("http://www.netload.in/index.php?id=10", post={'captcha_check' : '1', @@ -254,7 +257,7 @@ class NetloadIn(Hoster): download_url = self.get_file_url(response_page) self.logDebug("Download URL after get_file: " + download_url) if not download_url.startswith("http://"): - self.error("download url: %s" % download_url) + self.error(_("Download url: %s") % download_url) self.wait() self.url = download_url diff --git a/module/plugins/hoster/NitroflareCom.py b/module/plugins/hoster/NitroflareCom.py index 2367493e5..e21d067b3 100644 --- a/module/plugins/hoster/NitroflareCom.py +++ b/module/plugins/hoster/NitroflareCom.py @@ -16,64 +16,86 @@ from module.plugins.internal.SimpleHoster import SimpleHoster class NitroflareCom(SimpleHoster): __name__ = "NitroflareCom" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.07" __pattern__ = r'https?://(?:www\.)?nitroflare\.com/view/(?P<ID>[\w^_]+)' __description__ = """Nitroflare.com hoster plugin""" __license__ = "GPLv3" - __authors__ = [("sahil", ""), + __authors__ = [("sahil", "sahilshekhawat01@gmail.com"), ("Walter Purcaro", "vuolter@gmail.com")] - # URL_REPLACEMENTS = [("http://", "https://")] - LINK_FREE_PATTERN = r'(https?://[\w\\-]+\\.nitroflare\\.com/[^<>\"]*?)"' + INFO_PATTERN = r'title="(?P<N>.+?)".+>(?P<S>[\d.,]+) (?P<U>[\w^_]+)' + OFFLINE_PATTERN = r'>File doesn\'t exist' + + LINK_FREE_PATTERN = r'(https?://[\w\-]+\.nitroflare\.com/.+?)"' + + RECAPTCHA_KEY = "6Lenx_USAAAAAF5L1pmTWvWcH73dipAEzNnmNLgy" + + PREMIUM_ONLY_PATTERN = r'This file is available with Premium only' + WAIT_PATTERN = r'You have to wait .+?<' + ERROR_PATTERN = r'downloading is not possible' + + + def checkErrors(self): + if not self.html: + return + + if not self.premium and re.search(self.PREMIUM_ONLY_PATTERN, self.html): + self.fail(_("Link require a premium account to be handled")) + + elif hasattr(self, 'WAIT_PATTERN'): + m = re.search(self.WAIT_PATTERN, self.html) + if m: + wait_time = sum([int(v) * {"hr": 3600, "hour": 3600, "min": 60, "sec": 1}[u.lower()] for v, u in + re.findall(r'(\d+)\s*(hr|hour|min|sec)', m.group(0), re.I)]) + self.wait(wait_time, wait_time > 300) + return + + elif hasattr(self, 'ERROR_PATTERN'): + m = re.search(self.ERROR_PATTERN, self.html) + if m: + errmsg = self.info['error'] = m.group(1) + self.error(errmsg) + + self.info.pop('error', None) def handleFree(self, pyfile): - file_info = self.load("https://nitroflare.com/api/getDownloadLink", - get={'file': self.info['pattern']['ID']}) - - self.logWarning(file_info[3:]) - file_info = json_loads(file_info[3:]) # removing non ascii characters - if file_info['type'] == "success": - result = file_info['result'] # already a dict - if result['linkType'] == "free": - delay = result['delay'] # Don't need the delay for free downloads - captch_key = result['recaptchaPublic'] - filename = result['name'] - recaptcha = ReCaptcha(self) - # try upto 3 times to solve reCaptcha - for i in xrange(3): - challenge, response = recaptcha.challenge(key=captch_key) - res = self.load("https://nitroflare.com/ajax/freeDownload.php", - post={"method": "fetchDownload", - "recaptcha_challenge_field": challenge, - "recaptcha_response_field": response}) - if self.handleCaptchaErrors(res): - break - if "The captcha wasn't entered correctly" or "You have to fill the captcha" in res: - continue - else: - break - - if "The captcha wasn't entered correctly" or "You have to fill the captcha" in res: - self.logError("Captcha Failed") - self.offline() - # Captcha failed - else: - self.logInfo("result of the captcha is") - self.logInfo(res) - # self.offline() - download_link = re.search(self.DOWNLOAD_PATTERN, res) - if download_link is None: - print "downloasd link failed" - # Download link failed - else: - self.download(download_link) - else: - print "link is invalid" - self.offline() - # Link is invalid - # self.download() + # used here to load the cookies which will be required later + self.load(pyfile.url, post={'goToFreePage': ""}) + + self.html = self.load("http://nitroflare.com/ajax/freeDownload.php", + post={'method': "startTimer", 'fileId': self.info['pattern']['ID']})[4:] + + self.checkErrors() + + try: + js_file = self.load("http://nitroflare.com/js/downloadFree.js?v=1.0.1") + var_time = re.search("var time = (\\d+);", js_file) + wait_time = int(var_time.groups()[0]) + + except Exception: + wait_time = 60 + + self.wait(wait_time) + + recaptcha = ReCaptcha(self) + response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) + + self.html = self.load("http://nitroflare.com/ajax/freeDownload.php", + post={'method' : "fetchDownload", + 'recaptcha_challenge_field': challenge, + 'recaptcha_response_field' : response})[3:] + + self.logDebug(self.html) + + if "The captcha wasn't entered correctly" in self.html: + return + + if "You have to fill the captcha" in self.html: + return + + self.link = re.search(self.LINK_FREE_PATTERN, self.html) diff --git a/module/plugins/hoster/NoPremiumPl.py b/module/plugins/hoster/NoPremiumPl.py index 361d48c2d..43ae8b3cc 100644 --- a/module/plugins/hoster/NoPremiumPl.py +++ b/module/plugins/hoster/NoPremiumPl.py @@ -83,14 +83,14 @@ class NoPremiumPl(MultiHoster): # error code isn't yet added to plugin self.fail( parsed["errstring"] - or "Unknown error (code: %s)" % parsed["errno"] + or _("Unknown error (code: %s)") % parsed["errno"] ) if "sdownload" in parsed: if parsed["sdownload"] == "1": self.fail( - "Download from %s is possible only using NoPremium.pl webiste \ - directly. Update this plugin." % parsed["hosting"]) + _("Download from %s is possible only using NoPremium.pl website \ + directly") % parsed["hosting"]) pyfile.name = parsed["filename"] pyfile.size = parsed["filesize"] diff --git a/module/plugins/hoster/NosuploadCom.py b/module/plugins/hoster/NosuploadCom.py index 8a03d7090..aeedd54f6 100644 --- a/module/plugins/hoster/NosuploadCom.py +++ b/module/plugins/hoster/NosuploadCom.py @@ -17,8 +17,6 @@ class NosuploadCom(XFSHoster): __authors__ = [("igel", "igelkun@myopera.com")] - HOSTER_DOMAIN = "nosupload.com" - SIZE_PATTERN = r'<p><strong>Size:</strong> (?P<S>[\d.,]+) (?P<U>[\w^_]+)</p>' LINK_PATTERN = r'<a class="select" href="(http://.+?)">Download</a>' diff --git a/module/plugins/hoster/NovafileCom.py b/module/plugins/hoster/NovafileCom.py index 9754ceed1..bdd66473b 100644 --- a/module/plugins/hoster/NovafileCom.py +++ b/module/plugins/hoster/NovafileCom.py @@ -20,8 +20,6 @@ class NovafileCom(XFSHoster): ("stickell", "l.stickell@yahoo.it")] - HOSTER_DOMAIN = "novafile.com" - ERROR_PATTERN = r'class="alert[^"]*alert-separate"[^>]*>\s*(?:<p>)?(.*?)\s*</' WAIT_PATTERN = r'<p>Please wait <span id="count"[^>]*>(\d+)</span> seconds</p>' diff --git a/module/plugins/hoster/OboomCom.py b/module/plugins/hoster/OboomCom.py index 588d8f64a..725763345 100644 --- a/module/plugins/hoster/OboomCom.py +++ b/module/plugins/hoster/OboomCom.py @@ -13,7 +13,7 @@ from module.plugins.internal.CaptchaService import ReCaptcha class OboomCom(Hoster): __name__ = "OboomCom" __type__ = "hoster" - __version__ = "0.30" + __version__ = "0.31" __pattern__ = r'https?://(?:www\.)?oboom\.com/(#(id=|/)?)?(?P<ID>\w{8})' @@ -74,7 +74,7 @@ class OboomCom(Hoster): recaptcha = ReCaptcha(self) for _i in xrange(5): - challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY) + response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) apiUrl = "https://www.oboom.com/1.0/download/ticket" params = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": response, diff --git a/module/plugins/hoster/OneFichierCom.py b/module/plugins/hoster/OneFichierCom.py index f9c0dbe85..2e9e52813 100644 --- a/module/plugins/hoster/OneFichierCom.py +++ b/module/plugins/hoster/OneFichierCom.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class OneFichierCom(SimpleHoster): __name__ = "OneFichierCom" __type__ = "hoster" - __version__ = "0.76" + __version__ = "0.77" __pattern__ = r'https?://(?:www\.)?(?:(?P<ID1>\w+)\.)?(?P<HOST>1fichier\.com|alterupload\.com|cjoint\.net|d(es)?fichiers\.com|dl4free\.com|megadl\.fr|mesfichiers\.org|piecejointe\.net|pjointe\.com|tenvoi\.com)(?:/\?(?P<ID2>\w+))?' @@ -54,7 +54,7 @@ class OneFichierCom(SimpleHoster): def handlePremium(self, pyfile): - return self.handleFree(pyfile) + self.download(pyfile.url, post={'dl': "Download", 'did': 0}) getInfo = create_getInfo(OneFichierCom) diff --git a/module/plugins/hoster/PutdriveCom.py b/module/plugins/hoster/PutdriveCom.py index 67732a4cd..7f4b7b6cc 100644 --- a/module/plugins/hoster/PutdriveCom.py +++ b/module/plugins/hoster/PutdriveCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.hosters.ZeveraCom import ZeveraCom +from module.plugins.hoster.ZeveraCom import ZeveraCom class PutdriveCom(ZeveraCom): __name__ = "PutdriveCom" __type__ = "hoster" - __version__ = "0.01" + __version__ = "0.02" __pattern__ = r'https?://(?:www\.)putdrive\.com/(getFiles\.ashx|Members/download\.ashx)\?.*ourl=.+' diff --git a/module/plugins/hoster/RapideoPl.py b/module/plugins/hoster/RapideoPl.py index 2f7365e3b..85591f51f 100644 --- a/module/plugins/hoster/RapideoPl.py +++ b/module/plugins/hoster/RapideoPl.py @@ -83,14 +83,14 @@ class RapideoPl(MultiHoster): # error code isn't yet added to plugin self.fail( parsed["errstring"] - or "Unknown error (code: %s)" % parsed["errno"] + or _("Unknown error (code: %s)") % parsed["errno"] ) if "sdownload" in parsed: if parsed["sdownload"] == "1": self.fail( - "Download from %s is possible only using Rapideo.pl webiste \ - directly. Update this plugin." % parsed["hosting"]) + _("Download from %s is possible only using Rapideo.pl website \ + directly") % parsed["hosting"]) pyfile.name = parsed["filename"] pyfile.size = parsed["filesize"] diff --git a/module/plugins/hoster/RapidfileshareNet.py b/module/plugins/hoster/RapidfileshareNet.py index 3473b1c7c..0bbaed57f 100644 --- a/module/plugins/hoster/RapidfileshareNet.py +++ b/module/plugins/hoster/RapidfileshareNet.py @@ -15,8 +15,6 @@ class RapidfileshareNet(XFSHoster): __authors__ = [("guidobelix", "guidobelix@hotmail.it")] - HOSTER_DOMAIN = "rapidfileshare.net" - NAME_PATTERN = r'<input type="hidden" name="fname" value="(?P<N>.+?)">' SIZE_PATTERN = r'>http://www.rapidfileshare.net/\w+?</font> \((?P<S>[\d.,]+) (?P<U>[\w^_]+)\)</font>' diff --git a/module/plugins/hoster/RapidgatorNet.py b/module/plugins/hoster/RapidgatorNet.py index 84c3b20d6..f7e6534f2 100644 --- a/module/plugins/hoster/RapidgatorNet.py +++ b/module/plugins/hoster/RapidgatorNet.py @@ -13,7 +13,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, s class RapidgatorNet(SimpleHoster): __name__ = "RapidgatorNet" __type__ = "hoster" - __version__ = "0.29" + __version__ = "0.31" __pattern__ = r'http://(?:www\.)?(rapidgator\.net|rg\.to)/file/\w+' @@ -46,7 +46,7 @@ class RapidgatorNet(SimpleHoster): def setup(self): if self.account: - self.sid = self.account.getAccountInfo(self.user).get('SID', None) + self.sid = self.account.getAccountInfo(self.user).get('sid', None) else: self.sid = None @@ -107,7 +107,7 @@ class RapidgatorNet(SimpleHoster): jsvars.get('startTimerUrl', '/download/AjaxStartTimer'), jsvars['fid']) jsvars.update(self.getJsonResponse(url)) - self.wait(int(jsvars.get('secs', 45)), False) + self.wait(jsvars.get('secs', 45), False) url = "http://rapidgator.net%s?sid=%s" % ( jsvars.get('getDownloadUrl', '/download/AjaxGetDownload'), jsvars['sid']) @@ -128,7 +128,7 @@ class RapidgatorNet(SimpleHoster): break else: captcha, captcha_key = self.getCaptcha() - challenge, response = captcha.challenge(captcha_key) + response, challenge = captcha.challenge(captcha_key) self.html = self.load(url, post={'DownloadCaptchaForm[captcha]': "", 'adcopy_challenge' : challenge, @@ -146,17 +146,17 @@ class RapidgatorNet(SimpleHoster): m = re.search(self.ADSCAPTCHA_PATTERN, self.html) if m: captcha_key = m.group(1) - captcha = AdsCaptcha(self) + captcha = AdsCaptcha(self) else: m = re.search(self.RECAPTCHA_PATTERN, self.html) if m: captcha_key = m.group(1) - captcha = ReCaptcha(self) + captcha = ReCaptcha(self) else: m = re.search(self.SOLVEMEDIA_PATTERN, self.html) if m: captcha_key = m.group(1) - captcha = SolveMedia(self) + captcha = SolveMedia(self) else: self.error(_("Captcha")) diff --git a/module/plugins/hoster/RapiduNet.py b/module/plugins/hoster/RapiduNet.py index 0c40d95b9..b6806e49b 100644 --- a/module/plugins/hoster/RapiduNet.py +++ b/module/plugins/hoster/RapiduNet.py @@ -13,7 +13,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class RapiduNet(SimpleHoster): __name__ = "RapiduNet" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" __pattern__ = r'https?://(?:www\.)?rapidu\.net/(?P<ID>\d{10})' @@ -59,7 +59,7 @@ class RapiduNet(SimpleHoster): recaptcha = ReCaptcha(self) for _i in xrange(10): - challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY) + response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) jsvars = self.getJsonResponse("https://rapidu.net/ajax.php", get={'a': "getCheckCaptcha"}, diff --git a/module/plugins/hoster/RarefileNet.py b/module/plugins/hoster/RarefileNet.py index 2be952efe..a45e4ed4d 100644 --- a/module/plugins/hoster/RarefileNet.py +++ b/module/plugins/hoster/RarefileNet.py @@ -17,8 +17,6 @@ class RarefileNet(XFSHoster): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - HOSTER_DOMAIN = "rarefile.net" - LINK_PATTERN = r'<a href="(.+?)">\1</a>' diff --git a/module/plugins/hoster/RemixshareCom.py b/module/plugins/hoster/RemixshareCom.py index 11c9f3b0f..590f8daf5 100644 --- a/module/plugins/hoster/RemixshareCom.py +++ b/module/plugins/hoster/RemixshareCom.py @@ -54,7 +54,7 @@ class RemixshareCom(SimpleHoster): seconds = re.search(self.WAIT_PATTERN, self.html) if seconds: self.logDebug("Wait " + seconds.group(1)) - self.wait(int(seconds.group(1))) + self.wait(seconds.group(1)) # Finally start downloading... self.download(dl_url, disposition=True) diff --git a/module/plugins/hoster/SafesharingEu.py b/module/plugins/hoster/SafesharingEu.py index bb6e0f646..08612e413 100644 --- a/module/plugins/hoster/SafesharingEu.py +++ b/module/plugins/hoster/SafesharingEu.py @@ -15,8 +15,6 @@ class SafesharingEu(XFSHoster): __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] - HOSTER_DOMAIN = "safesharing.eu" - ERROR_PATTERN = r'(?:<div class="alert alert-danger">)(.+?)(?:</div>)' diff --git a/module/plugins/hoster/SecureUploadEu.py b/module/plugins/hoster/SecureUploadEu.py index 64e6456a9..6bfbce328 100644 --- a/module/plugins/hoster/SecureUploadEu.py +++ b/module/plugins/hoster/SecureUploadEu.py @@ -15,8 +15,6 @@ class SecureUploadEu(XFSHoster): __authors__ = [("z00nx", "z00nx0@gmail.com")] - HOSTER_DOMAIN = "secureupload.eu" - INFO_PATTERN = r'<h3>Downloading (?P<N>[^<]+) \((?P<S>[^<]+)\)</h3>' diff --git a/module/plugins/hoster/Share4webCom.py b/module/plugins/hoster/Share4WebCom.py index 7a276c1fe..7a276c1fe 100644 --- a/module/plugins/hoster/Share4webCom.py +++ b/module/plugins/hoster/Share4WebCom.py diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index 636e5824d..6f49711b8 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -14,7 +14,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class ShareonlineBiz(SimpleHoster): __name__ = "ShareonlineBiz" __type__ = "hoster" - __version__ = "0.47" + __version__ = "0.48" __pattern__ = r'https?://(?:www\.)?(share-online\.biz|egoshare\.com)/(download\.php\?id=|dl/)(?P<ID>\w+)' @@ -69,7 +69,7 @@ class ShareonlineBiz(SimpleHoster): recaptcha = ReCaptcha(self) for _i in xrange(5): - challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY) + response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) m = re.search(r'var wait=(\d+);', self.html) self.setWait(int(m.group(1)) if m else 30) @@ -164,7 +164,7 @@ class ShareonlineBiz(SimpleHoster): try: self.logError(errmsg, re.search(self.ERROR_PATTERN, self.html).group(1)) - except: + except Exception: self.logError("Unknown error occurred", errmsg) if errmsg is "invalid": diff --git a/module/plugins/hoster/SpeedyshareCom.py b/module/plugins/hoster/SpeedyshareCom.py index 0acdb7647..f21b0a3a7 100644 --- a/module/plugins/hoster/SpeedyshareCom.py +++ b/module/plugins/hoster/SpeedyshareCom.py @@ -13,7 +13,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class SpeedyshareCom(SimpleHoster): __name__ = "SpeedyshareCom" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.05" __pattern__ = r'https?://(?:www\.)?(speedyshare\.com|speedy\.sh)/\w+' @@ -38,10 +38,7 @@ class SpeedyshareCom(SimpleHoster): def handleFree(self, pyfile): m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: - self.error(_("Download link not found")) - - dl_link = urljoin("http://www.speedyshare.com", m.group(1)) - self.download(dl_link, disposition=True) + self.link = m.group(1) getInfo = create_getInfo(SpeedyshareCom) diff --git a/module/plugins/hoster/StreamcloudEu.py b/module/plugins/hoster/StreamcloudEu.py index b9d6d9ae6..54f430508 100644 --- a/module/plugins/hoster/StreamcloudEu.py +++ b/module/plugins/hoster/StreamcloudEu.py @@ -17,8 +17,6 @@ class StreamcloudEu(XFSHoster): __authors__ = [("seoester", "seoester@googlemail.com")] - HOSTER_DOMAIN = "streamcloud.eu" - WAIT_PATTERN = r'var count = (\d+)' LINK_PATTERN = r'file: "(http://(stor|cdn)\d+\.streamcloud\.eu:?\d*/.*/video\.(mp4|flv))",' diff --git a/module/plugins/hoster/TurbobitNet.py b/module/plugins/hoster/TurbobitNet.py index ccca76018..03e18a9cd 100644 --- a/module/plugins/hoster/TurbobitNet.py +++ b/module/plugins/hoster/TurbobitNet.py @@ -17,7 +17,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, t class TurbobitNet(SimpleHoster): __name__ = "TurbobitNet" __type__ = "hoster" - __version__ = "0.17" + __version__ = "0.19" __pattern__ = r'http://(?:www\.)?turbobit\.net/(?:download/free/)?(?P<ID>\w+)' @@ -35,15 +35,15 @@ class TurbobitNet(SimpleHoster): SIZE_PATTERN = r'class="file-size">(?P<S>[\d.,]+) (?P<U>[\w^_]+)' OFFLINE_PATTERN = r'<h2>File Not Found</h2>|html\(\'File (?:was )?not found' - LINK_PATTERN = r'(/download/redirect/[^"\']+)' + LINK_FREE_PATTERN = LINK_PREMIUM_PATTERN = r'(/download/redirect/[^"\']+)' LIMIT_WAIT_PATTERN = r'<div id=\'timeout\'>(\d+)<' CAPTCHA_PATTERN = r'<img alt="Captcha" src="(.+?)"' def handleFree(self, pyfile): - self.url = "http://turbobit.net/download/free/%s" % self.info['pattern']['ID'] - self.html = self.load(self.url, ref=True, decode=True) + self.html = self.load("http://turbobit.net/download/free/%s" % self.info['pattern']['ID'], + decode=True) rtUpdate = self.getRtUpdate() @@ -51,14 +51,13 @@ class TurbobitNet(SimpleHoster): self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) - self.url = self.getDownloadUrl(rtUpdate) - - self.wait() - self.html = self.load(self.url) + self.html = self.load(self.getDownloadUrl(rtUpdate)) self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With:"]) - self.downloadFile() + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m: + self.link = m.group(1) def solveCaptcha(self): @@ -76,7 +75,7 @@ class TurbobitNet(SimpleHoster): if inputs['captcha_type'] == 'recaptcha': recaptcha = ReCaptcha(self) - inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge() + inputs['recaptcha_response_field'], inputs['recaptcha_challenge_field'] = recaptcha.challenge() else: m = re.search(self.CAPTCHA_PATTERN, self.html) if m is None: @@ -141,13 +140,17 @@ class TurbobitNet(SimpleHoster): self.logDebug("URL", self.js.engine, out) if out.startswith('/download/'): return "http://turbobit.net%s" % out.strip() + except Exception, e: self.logError(e) else: if self.retries >= 2: # retry with updated js self.delStorage("rtUpdate") - self.retry() + else: + self.retry() + + self.wait() def decrypt(self, data): @@ -161,17 +164,4 @@ class TurbobitNet(SimpleHoster): return "%s GMT%+03d%02d" % (time.strftime("%a %b %d %Y %H:%M:%S", lt), -tz // 3600, tz % 3600) - def handlePremium(self, pyfile): - self.logDebug("Premium download as user %s" % self.user) - self.downloadFile() - - - def downloadFile(self): - m = re.search(self.LINK_PATTERN, self.html) - if m is None: - self.error(_("Download link not found")) - self.url = "http://turbobit.net" + m.group(1) - self.download(self.url) - - getInfo = create_getInfo(TurbobitNet) diff --git a/module/plugins/hoster/TusfilesNet.py b/module/plugins/hoster/TusfilesNet.py index 9d0a86fe9..9fdb6eae1 100644 --- a/module/plugins/hoster/TusfilesNet.py +++ b/module/plugins/hoster/TusfilesNet.py @@ -17,8 +17,6 @@ class TusfilesNet(XFSHoster): ("guidobelix", "guidobelix@hotmail.it")] - HOSTER_DOMAIN = "tusfiles.net" - INFO_PATTERN = r'\](?P<N>.+) - (?P<S>[\d.,]+) (?P<U>[\w^_]+)\[' OFFLINE_PATTERN = r'>File Not Found|<Title>TusFiles - Fast Sharing Files!|The file you are trying to download is no longer available' diff --git a/module/plugins/hoster/UlozTo.py b/module/plugins/hoster/UlozTo.py index cadd51149..3552942ff 100644 --- a/module/plugins/hoster/UlozTo.py +++ b/module/plugins/hoster/UlozTo.py @@ -15,7 +15,7 @@ def convertDecimalPrefix(m): class UlozTo(SimpleHoster): __name__ = "UlozTo" __type__ = "hoster" - __version__ = "1.02" + __version__ = "1.04" __pattern__ = r'http://(?:www\.)?(uloz\.to|ulozto\.(cz|sk|net)|bagruj\.cz|zachowajto\.pl)/(?:live/)?(?P<ID>\w+/[^/?]*)' @@ -39,6 +39,7 @@ class UlozTo(SimpleHoster): def setup(self): + self.chunkLimit = 16 if self.premium else 1 self.multiDL = self.premium self.resumeDownload = True @@ -55,7 +56,7 @@ class UlozTo(SimpleHoster): self.error(_("TOKEN_PATTERN not found")) token = m.group(1) - self.html = self.load(pyfile.url, get={"do": "askAgeForm-submit"}, + self.html = self.load(pyfile.url, get={'do': "askAgeForm-submit"}, post={"agree": "Confirm", "_token_": token}, cookies=True) if self.PASSWD_PATTERN in self.html: @@ -63,7 +64,7 @@ class UlozTo(SimpleHoster): if password: self.logInfo(_("Password protected link, trying ") + password) - self.html = self.load(pyfile.url, get={"do": "passwordProtectedForm-submit"}, + self.html = self.load(pyfile.url, get={'do': "passwordProtectedForm-submit"}, post={"password": password, "password_send": 'Send'}, cookies=True) if self.PASSWD_PATTERN in self.html: @@ -72,7 +73,7 @@ class UlozTo(SimpleHoster): self.fail(_("No password found")) if re.search(self.VIPLINK_PATTERN, self.html): - self.html = self.load(pyfile.url, get={"disclaimer": "1"}) + self.html = self.load(pyfile.url, get={'disclaimer': "1"}) self.getFileInfo() @@ -104,7 +105,7 @@ class UlozTo(SimpleHoster): # New version - better to get new parameters (like captcha reload) because of image url - since 6.12.2013 self.logDebug('Using "new" version') - xapca = self.load("http://www.ulozto.net/reloadXapca.php", get={"rnd": str(int(time.time()))}) + xapca = self.load("http://www.ulozto.net/reloadXapca.php", get={'rnd': str(int(time.time()))}) self.logDebug("xapca = " + str(xapca)) data = json_loads(xapca) @@ -120,7 +121,7 @@ class UlozTo(SimpleHoster): def handlePremium(self, pyfile): - self.download(pyfile.url, get={'do': directDownload}, disposition=True) + self.download(pyfile.url, get={'do': "directDownload"}, disposition=True) def doCheckDownload(self): diff --git a/module/plugins/hoster/UnibytesCom.py b/module/plugins/hoster/UnibytesCom.py index cd4e506c4..16b1f82ab 100644 --- a/module/plugins/hoster/UnibytesCom.py +++ b/module/plugins/hoster/UnibytesCom.py @@ -62,7 +62,7 @@ class UnibytesCom(SimpleHoster): if last_step == 'timer': m = re.search(self.WAIT_PATTERN, self.html) - self.wait(int(m.group(1)) if m else 60, False) + self.wait(m.group(1) if m else 60, False) elif last_step in ("captcha", "last"): post_data['captcha'] = self.decryptCaptcha(urljoin(domain, "/captcha.jpg")) diff --git a/module/plugins/hoster/UpleaCom.py b/module/plugins/hoster/UpleaCom.py index 4ea4e345f..c544c1222 100644 --- a/module/plugins/hoster/UpleaCom.py +++ b/module/plugins/hoster/UpleaCom.py @@ -19,8 +19,6 @@ class UpleaCom(XFSHoster): __authors__ = [("Redleon", None)] - HOSTER_DOMAIN = "uplea.com" - NAME_PATTERN = r'class="agmd size18">(?P<N>.+?)<' SIZE_PATTERN = r'size14">(?P<S>[\d.,]+) (?P<U>[\w^_])</span>' @@ -41,13 +39,13 @@ class UpleaCom(XFSHoster): def handleFree(self, pyfile): m = re.search(self.STEP_PATTERN, self.html) if m is None: - self.error("STEP_PATTERN not found") + self.error(_("STEP_PATTERN not found")) self.html = self.load(urljoin("http://uplea.com/", m.group(1))) m = re.search(self.WAIT_PATTERN, self.html) if m: - self.wait(int(m.group(1)), True) + self.wait(m.group(1), True) self.retry() m = re.search(self.LINK_PATTERN, self.html) diff --git a/module/plugins/hoster/UploadableCh.py b/module/plugins/hoster/UploadableCh.py index e28944ab9..be4cb5b06 100644 --- a/module/plugins/hoster/UploadableCh.py +++ b/module/plugins/hoster/UploadableCh.py @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UploadableCh(SimpleHoster): __name__ = "UploadableCh" __type__ = "hoster" - __version__ = "0.06" + __version__ = "0.07" __pattern__ = r'http://(?:www\.)?uploadable\.ch/file/(?P<ID>\w+)' @@ -46,7 +46,7 @@ class UploadableCh(SimpleHoster): recaptcha = ReCaptcha(self) - challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY) + response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) # Submit the captcha solution self.load("http://www.uploadable.ch/checkReCaptcha.php", diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py index 833468a80..9aef13cde 100644 --- a/module/plugins/hoster/UploadedTo.py +++ b/module/plugins/hoster/UploadedTo.py @@ -9,237 +9,120 @@ import re from time import sleep from module.network.RequestFactory import getURL -from module.plugins.Hoster import Hoster -from module.plugins.Plugin import chunks from module.plugins.internal.CaptchaService import ReCaptcha -from module.utils import html_unescape, parseFileSize +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -key = "bGhGMkllZXByd2VEZnU5Y2NXbHhYVlZ5cEE1bkEzRUw=".decode('base64') - - -def getID(url): - """ returns id from file url""" - m = re.match(UploadedTo.__pattern__, url) - return m.group('ID') - - -def getAPIData(urls): - post = {"apikey": key} - - idMap = {} - - for i, url in enumerate(urls): - id = getID(url) - post['id_%s' % i] = id - idMap[id] = url - - for _i in xrange(5): - api = unicode(getURL("http://uploaded.net/api/filemultiple", post=post, decode=False), 'iso-8859-1') - if api != "can't find request": - break - else: - sleep(3) - - result = {} - - if api: - for line in api.splitlines(): - data = line.split(",", 4) - if data[1] in idMap: - result[data[1]] = (data[0], data[2], data[4], data[3], idMap[data[1]]) - - return result - - -def parseFileInfo(self, url='', html=''): - if not html and hasattr(self, "html"): - html = self.html +class UploadedTo(SimpleHoster): + __name__ = "UploadedTo" + __type__ = "hoster" + __version__ = "0.78" - name = url - size = 0 - fileid = None + __pattern__ = r'https?://(?:www\.)?(uploaded\.(to|net)|ul\.to)(/file/|/?\?id=|.*?&id=|/)(?P<ID>\w+)' - if re.search(self.OFFLINE_PATTERN, html): - # File offline - status = 1 - else: - m = re.search(self.INFO_PATTERN, html) - if m: - name, fileid = html_unescape(m.group('N')), m.group('ID') - size = parseFileSize(m.group('S')) - status = 2 - else: - status = 3 + __description__ = """Uploaded.net hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - return name, size, status, fileid + API_KEY = "bGhGMkllZXByd2VEZnU5Y2NXbHhYVlZ5cEE1bkEzRUw=" #@NOTE: base64 encoded -def getInfo(urls): - for chunk in chunks(urls, 80): - result = [] + URL_REPLACEMENTS = [(__pattern__ + ".*", r'http://uploaded.net/file/\g<ID>')] - api = getAPIData(chunk) + INFO_PATTERN = r'<a href="file/(?P<ID>\w+)" id="filename">(?P<N>[^<]+)</a> \s*<small[^>]*>(?P<S>[^<]+)</small>' + OFFLINE_PATTERN = r'<small class="cL">Error: 404' - for data in api.itervalues(): - if data[0] == "online": - result.append((html_unescape(data[2]), data[1], 2, data[4])) + LINK_PREMIUM_PATTERN = r'<div class="tfree".*\s*<form method="post" action="(.+?)"' - elif data[0] == "offline": - result.append((data[4], 0, 1, data[4])) + DL_LIMIT_ERROR = r'You have reached the max. number of possible free downloads for this hour' - yield result + @classmethod + def apiInfo(cls, url="", get={}, post={}): + info = super(UploadedTo, cls).apiInfo(url) -class UploadedTo(Hoster): - __name__ = "UploadedTo" - __type__ = "hoster" - __version__ = "0.75" + for _i in xrange(5): + api = getURL("http://uploaded.net/api/filemultiple", + post={"apikey": cls.API_KEY.decode('base64'), 'id_0': re.match(cls.__pattern__, url).group('ID')}, + decode=True) + if api != "can't find request": + api = api.splitlines()[0].split(",", 4) - __pattern__ = r'https?://(?:www\.)?(uploaded\.(to|net)|ul\.to)(/file/|/?\?id=|.*?&id=|/)(?P<ID>\w+)' + if api[0] == "online": + info.update({'name': api[4], 'size': api[2], 'status': 2}) - __description__ = """Uploaded.net hoster plugin""" - __license__ = "GPLv3" - __authors__ = [("spoob", "spoob@pyload.org"), - ("mkaay", "mkaay@mkaay.de"), - ("zoidberg", "zoidberg@mujmail.cz"), - ("netpok", "netpok@gmail.com"), - ("stickell", "l.stickell@yahoo.it")] + elif api[0] == "offline": + info['status'] = 1 + break + else: + sleep(3) - INFO_PATTERN = r'<a href="file/(?P<ID>\w+)" id="filename">(?P<N>[^<]+)</a> \s*<small[^>]*>(?P<S>[^<]+)</small>' - OFFLINE_PATTERN = r'<small class="cL">Error: 404</small>' - DL_LIMIT_PATTERN = r'You have reached the max. number of possible free downloads for this hour' + return info def setup(self): self.multiDL = self.resumeDownload = self.premium self.chunkLimit = 1 # critical problems with more chunks - - self.fileID = getID(self.pyfile.url) - self.pyfile.url = "http://uploaded.net/file/%s" % self.fileID - - - def process(self, pyfile): self.load("http://uploaded.net/language/en", just_header=True) - api = getAPIData([pyfile.url]) - # TODO: fallback to parse from site, because api sometimes delivers wrong status codes + def checkErrors(self): + if 'var free_enabled = false;' in self.html: + self.logError(_("Free-download capacities exhausted")) + self.retry(24, 5 * 60) - if not api: - self.logWarning(_("No response for API call")) + m = re.search(r"Current waiting period: <span>(\d+)</span> seconds", self.html) + if m: + self.wait(m.group(1)) + else: + self.fail(_("File not downloadable for free users")) - self.html = unicode(self.load(pyfile.url, decode=False), 'iso-8859-1') - name, size, status, self.fileID = parseFileInfo(self) - self.logDebug(name, size, status, self.fileID) - if status == 1: - self.offline() - elif status == 2: - pyfile.name, pyfile.size = name, size - else: - self.error(_("file info")) + if "limit-size" in self.html: + self.fail(_("File too big for free download")) - elif api == 'Access denied': - self.fail(_("API key invalid")) + elif "limit-slot" in self.html: # Temporary restriction so just wait a bit + self.wait(30 * 60, True) + self.retry() - else: - if self.fileID not in api: - self.offline() + elif "limit-parallel" in self.html: + self.fail(_("Cannot download in parallel")) - self.data = api[self.fileID] - if self.data[0] != "online": - self.offline() + elif "limit-dl" in self.html or self.DL_LIMIT_ERROR in self.html: # limit-dl + self.wait(3 * 60 * 60, True) + self.retry() - pyfile.name = html_unescape(self.data[2]) + elif '"err":"captcha"' in self.html: + self.invalidCaptcha() - # pyfile.name = self.get_file_name() - if self.premium: - self.handlePremium() - else: - self.handleFree() - - - def handlePremium(self): - info = self.account.getAccountInfo(self.user, True) - self.logDebug("%(name)s: Use Premium Account (%(left)sGB left)" % {"name": self.__name__, - "left": info['trafficleft'] / 1024 / 1024}) - if int(self.data[1]) / 1024 > info['trafficleft']: - self.logInfo(_("Not enough traffic left")) - self.account.empty(self.user) - self.resetAccount() - self.fail(_("Traffic exceeded")) - - header = self.load("http://uploaded.net/file/%s" % self.fileID, just_header=True) - if 'location' in header: - #Direct download - self.logDebug("Direct download link detected") - self.download(header['location']) - else: - #Indirect download - self.html = self.load("http://uploaded.net/file/%s" % self.fileID) - m = re.search(r'<div class="tfree".*\s*<form method="post" action="(.*?)"', self.html) - if m is None: - self.fail(_("Download URL not m. Try to enable direct downloads")) - url = m.group(1) - self.download(url, post={}) + def handleFree(self, pyfile): + self.html = self.load("http://uploaded.net/js/download.js", decode=True) + recaptcha = ReCaptcha(self) + response, challenge = recaptcha.challenge() - def handleFree(self): - self.html = self.load(self.pyfile.url, decode=True) + self.html = self.load("http://uploaded.net/io/ticket/captcha/%s" % self.info['pattern']['ID'], + post={'recaptcha_challenge_field': challenge, + 'recaptcha_response_field' : response}) - if 'var free_enabled = false;' in self.html: - self.logError(_("Free-download capacities exhausted")) - self.retry(24, 5 * 60) + if "type:'download'" in self.html: + self.correctCaptcha() + try: + self.link = re.search("url:'([^']+)", self.html).group(1) - m = re.search(r"Current waiting period: <span>(\d+)</span> seconds", self.html) - if m is None: - self.fail(_("File not downloadable for free users")) - self.setWait(int(m.group(1))) + except Exception: + pass - self.html = self.load("http://uploaded.net/js/download.js", decode=True) + self.checkErrors() - url = "http://uploaded.net/io/ticket/captcha/%s" % self.fileID - downloadURL = "" - recaptcha = ReCaptcha(self) + def checkFile(self): + if self.checkDownload({'limit-dl': self.DL_LIMIT_ERROR}): + self.wait(3 * 60 * 60, True) + self.retry() - for _i in xrange(5): - challenge, response = recaptcha.challenge() - options = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": response} - self.wait() - - result = self.load(url, post=options) - self.logDebug("Result: %s" % result) - - if "limit-size" in result: - self.fail(_("File too big for free download")) - elif "limit-slot" in result: # Temporary restriction so just wait a bit - self.setWait(30 * 60, True) - self.wait() - self.retry() - elif "limit-parallel" in result: - self.fail(_("Cannot download in parallel")) - elif "limit-dl" in result or self.DL_LIMIT_PATTERN in result: # limit-dl - self.setWait(3 * 60 * 60, True) - self.wait() - self.retry() - elif '"err":"captcha"' in result: - self.invalidCaptcha() - elif "type:'download'" in result: - self.correctCaptcha() - downloadURL = re.search("url:'([^']+)", result).group(1) - break - else: - self.error(_("Unknown error: %s") % result) + return super(UploadedTo, self).checkFile() - if not downloadURL: - self.fail(_("No Download url retrieved/all captcha attempts failed")) - self.download(downloadURL, disposition=True) - check = self.checkDownload({"limit-dl": self.DL_LIMIT_PATTERN}) - if check == "limit-dl": - self.setWait(3 * 60 * 60, True) - self.wait() - self.retry() +getInfo = create_getInfo(UploadedTo) diff --git a/module/plugins/hoster/UpstoreNet.py b/module/plugins/hoster/UpstoreNet.py index f287a2b51..db9fa53a1 100644 --- a/module/plugins/hoster/UpstoreNet.py +++ b/module/plugins/hoster/UpstoreNet.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UpstoreNet(SimpleHoster): __name__ = "UpstoreNet" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.05" __pattern__ = r'https?://(?:www\.)?upstore\.net/' @@ -52,7 +52,7 @@ class UpstoreNet(SimpleHoster): self.wait(wait_time) # then, handle the captcha - challenge, response = recaptcha.challenge() + response, challenge = recaptcha.challenge() post_data.update({'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response}) diff --git a/module/plugins/hoster/UptoboxCom.py b/module/plugins/hoster/UptoboxCom.py index 21d781f55..dedb6ed1f 100644 --- a/module/plugins/hoster/UptoboxCom.py +++ b/module/plugins/hoster/UptoboxCom.py @@ -15,8 +15,6 @@ class UptoboxCom(XFSHoster): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_DOMAIN = "uptobox.com" - INFO_PATTERN = r'"para_title">(?P<N>.+) \((?P<S>[\d.,]+) (?P<U>[\w^_]+)\)' OFFLINE_PATTERN = r'>(File not found|Access Denied|404 Not Found)' diff --git a/module/plugins/hoster/VidPlayNet.py b/module/plugins/hoster/VidPlayNet.py index 76af05edd..f1a32a897 100644 --- a/module/plugins/hoster/VidPlayNet.py +++ b/module/plugins/hoster/VidPlayNet.py @@ -18,8 +18,6 @@ class VidPlayNet(XFSHoster): __authors__ = [("t4skforce", "t4skforce1337[AT]gmail[DOT]com")] - HOSTER_DOMAIN = "vidplay.net" - NAME_PATTERN = r'<b>Password:</b></div>\s*<h[1-6]>(?P<N>[^<]+)</h[1-6]>' diff --git a/module/plugins/hoster/Vipleech4uCom.py b/module/plugins/hoster/Vipleech4UCom.py index 2ae41b942..2ae41b942 100644 --- a/module/plugins/hoster/Vipleech4uCom.py +++ b/module/plugins/hoster/Vipleech4UCom.py diff --git a/module/plugins/hoster/WebshareCz.py b/module/plugins/hoster/WebshareCz.py index e3424fc21..98187d46a 100644 --- a/module/plugins/hoster/WebshareCz.py +++ b/module/plugins/hoster/WebshareCz.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class WebshareCz(SimpleHoster): __name__ = "WebshareCz" __type__ = "hoster" - __version__ = "0.15" + __version__ = "0.16" __pattern__ = r'https?://(?:www\.)?webshare\.cz/(?:#/)?file/(?P<ID>\w+)' @@ -21,7 +21,7 @@ class WebshareCz(SimpleHoster): @classmethod def getInfo(cls, url="", html=""): - info = super(WebshareCz, self).getInfo(url, html) + info = super(WebshareCz, cls).getInfo(url, html) if url: info['pattern'] = re.match(cls.__pattern__, url).groupdict() diff --git a/module/plugins/hoster/YibaishiwuCom.py b/module/plugins/hoster/YibaishiwuCom.py index adc403de4..cf1550ebc 100644 --- a/module/plugins/hoster/YibaishiwuCom.py +++ b/module/plugins/hoster/YibaishiwuCom.py @@ -50,7 +50,7 @@ class YibaishiwuCom(SimpleHoster): self.logDebug("Trying URL: " + url) self.download(url) break - except: + except Exception: continue else: self.fail(_("No working link found")) diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py index 90c6df3c2..5c2489d3c 100644 --- a/module/plugins/hoster/YoutubeCom.py +++ b/module/plugins/hoster/YoutubeCom.py @@ -13,40 +13,36 @@ from module.utils import html_unescape def which(program): """Works exactly like the unix command which - Courtesy of http://stackoverflow.com/a/377028/675646""" - def is_exe(fpath): - return os.path.isfile(fpath) and os.access(fpath, os.X_OK) + isExe = lambda x: os.path.isfile(x) and os.access(x, os.X_OK) fpath, fname = os.path.split(program) if fpath: - if is_exe(program): + if isExe(program): return program else: for path in os.environ['PATH'].split(os.pathsep): path = path.strip('"') exe_file = os.path.join(path, program) - if is_exe(exe_file): + if isExe(exe_file): return exe_file - return None - class YoutubeCom(Hoster): __name__ = "YoutubeCom" __type__ = "hoster" - __version__ = "0.40" + __version__ = "0.41" - __pattern__ = r'https?://(?:[^/]*\.)?(?:youtube\.com|youtu\.be)/watch.*?[?&]v=.+' - __config__ = [("quality", "sd;hd;fullhd;240p;360p;480p;720p;1080p;3072p", "Quality Setting", "hd"), - ("fmt", "int", "FMT/ITAG Number (5-102, 0 for auto)", 0), - (".mp4", "bool", "Allow .mp4", True), - (".flv", "bool", "Allow .flv", True), - (".webm", "bool", "Allow .webm", False), - (".3gp", "bool", "Allow .3gp", False), - ("3d", "bool", "Prefer 3D", False)] + __pattern__ = r'https?://(?:[^/]*\.)?(youtube\.com|youtu\.be)/watch\?(?:.*&)?v=.+' + __config__ = [("quality", "sd;hd;fullhd;240p;360p;480p;720p;1080p;3072p", "Quality Setting" , "hd" ), + ("fmt" , "int" , "FMT/ITAG Number (0 for auto)", 0 ), + (".mp4" , "bool" , "Allow .mp4" , True ), + (".flv" , "bool" , "Allow .flv" , True ), + (".webm" , "bool" , "Allow .webm" , False), + (".3gp" , "bool" , "Allow .3gp" , False), + ("3d" , "bool" , "Prefer 3D" , False)] __description__ = """Youtube.com hoster plugin""" __license__ = "GPLv3" @@ -90,7 +86,7 @@ class YoutubeCom(Hoster): def process(self, pyfile): pyfile.url = replace_patterns(pyfile.url, self.URL_REPLACEMENTS) - html = self.load(pyfile.url, decode=True) + html = self.load(pyfile.url, decode=True) if re.search(r'<div id="player-unavailable" class="\s*player-width player-height\s*">', html): self.offline() @@ -100,32 +96,40 @@ class YoutubeCom(Hoster): #get config use3d = self.getConfig("3d") + if use3d: quality = {"sd": 82, "hd": 84, "fullhd": 85, "240p": 83, "360p": 82, "480p": 82, "720p": 84, "1080p": 85, "3072p": 85} else: quality = {"sd": 18, "hd": 22, "fullhd": 37, "240p": 5, "360p": 18, "480p": 35, "720p": 22, "1080p": 37, "3072p": 38} + desired_fmt = self.getConfig("fmt") - if desired_fmt and desired_fmt not in self.formats: - self.logWarning(_("FMT %d unknown, using default") % desired_fmt) - desired_fmt = 0 + if not desired_fmt: desired_fmt = quality.get(self.getConfig("quality"), 18) + elif desired_fmt not in self.formats: + self.logWarning(_("FMT %d unknown, using default") % desired_fmt) + desired_fmt = 0 + #parse available streams - streams = re.search(r'"url_encoded_fmt_stream_map": "(.*?)",', html).group(1) + streams = re.search(r'"url_encoded_fmt_stream_map":"(.+?)",', html).group(1) streams = [x.split('\u0026') for x in streams.split(',')] streams = [dict((y.split('=', 1)) for y in x) for x in streams] streams = [(int(x['itag']), unquote(x['url'])) for x in streams] - #self.logDebug("Found links: %s" % streams) + + # self.logDebug("Found links: %s" % streams) + self.logDebug("AVAILABLE STREAMS: %s" % [x[0] for x in streams]) #build dictionary of supported itags (3D/2D) allowed = lambda x: self.getConfig(self.formats[x][0]) streams = [x for x in streams if x[0] in self.formats and allowed(x[0])] + if not streams: self.fail(_("No available stream meets your preferences")) + fmt_dict = dict([x for x in streams if self.formats[x[0]][4] == use3d] or streams) self.logDebug("DESIRED STREAM: ITAG:%d (%s) %sfound, %sallowed" % @@ -136,15 +140,18 @@ class YoutubeCom(Hoster): if desired_fmt in fmt_dict and allowed(desired_fmt): fmt = desired_fmt else: - sel = lambda x: self.formats[x][3] # select quality index + sel = lambda x: self.formats[x][3] # select quality index comp = lambda x, y: abs(sel(x) - sel(y)) self.logDebug("Choosing nearest fmt: %s" % [(x, allowed(x), comp(x, desired_fmt)) for x in fmt_dict.keys()]) + fmt = reduce(lambda x, y: x if comp(x, desired_fmt) <= comp(y, desired_fmt) and sel(x) > sel(y) else y, fmt_dict.keys()) self.logDebug("Chosen fmt: %s" % fmt) + url = fmt_dict[fmt] + self.logDebug("URL: %s" % url) #set file name @@ -167,9 +174,9 @@ class YoutubeCom(Hoster): m = "0" pyfile.name += " (starting at %s:%s)" % (m, s) - pyfile.name += file_suffix - filename = self.download(url) + pyfile.name += file_suffix + filename = self.download(url) if ffmpeg and time: inputfile = filename + "_" diff --git a/module/plugins/hoster/ZeveraCom.py b/module/plugins/hoster/ZeveraCom.py index fb251142e..665b64789 100644 --- a/module/plugins/hoster/ZeveraCom.py +++ b/module/plugins/hoster/ZeveraCom.py @@ -10,7 +10,7 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class ZeveraCom(MultiHoster): __name__ = "ZeveraCom" __type__ = "hoster" - __version__ = "0.27" + __version__ = "0.28" __pattern__ = r'https?://(?:www\.)zevera\.com/(getFiles\.ashx|Members/download\.ashx)\?.*ourl=.+' @@ -21,7 +21,7 @@ class ZeveraCom(MultiHoster): def handlePremium(self, pyfile): - return "https://%s/getFiles.ashx?ourl=%s" % (self.account.HOSTER_DOMAIN, pyfile.url) + self.link = "https://%s/getFiles.ashx?ourl=%s" % (self.account.HOSTER_DOMAIN, pyfile.url) def checkFile(self): diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py index 2648f532f..f32c5877f 100644 --- a/module/plugins/hoster/ZippyshareCom.py +++ b/module/plugins/hoster/ZippyshareCom.py @@ -2,42 +2,51 @@ import re -from urlparse import urljoin - +from module.plugins.internal.CaptchaService import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class ZippyshareCom(SimpleHoster): __name__ = "ZippyshareCom" __type__ = "hoster" - __version__ = "0.66" + __version__ = "0.68" - __pattern__ = r'(?P<HOST>http://www\d{0,2}\.zippyshare\.com)/v(?:/|iew\.jsp.*key=)(?P<KEY>\d+)' + __pattern__ = r'http://www\d{0,2}\.zippyshare\.com/v(/|iew\.jsp.*key=)(?P<KEY>[\w^_]+)' __description__ = """Zippyshare.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - NAME_PATTERN = r'("\d{6,}/"[ ]*\+.+?"/|<title>Zippyshare.com - )(?P<N>.+?)("|</title>)' - SIZE_PATTERN = r'>Size:.+?">(?P<S>[\d.,]+) (?P<U>[\w^_]+)' + COOKIES = [("zippyshare.com", "ziplocale", "en")] - OFFLINE_PATTERN = r'>File does not exist on this server<' + NAME_PATTERN = r'("\d{6,}/"[ ]*\+.+?"/|<title>Zippyshare.com - )(?P<N>.+?)("|</title>)' + SIZE_PATTERN = r'>Size:.+?">(?P<S>[\d.,]+) (?P<U>[\w^_]+)' + OFFLINE_PATTERN = r'>File does not exist on this server' - COOKIES = [("zippyshare.com", "ziplocale", "en")] + LINK_PREMIUM_PATTERN = r'document.location = \'(.+?)\'' def setup(self): - self.multiDL = True self.chunkLimit = -1 + self.multiDL = True self.resumeDownload = True def handleFree(self, pyfile): - checksum = self.get_checksum() - p_url = '/'.join(("d", self.info['pattern']['KEY'], str(checksum), self.pyfile.name)) + recaptcha = ReCaptcha(self) + captcha_key = recaptcha.detect_key() + + if captcha_key: + try: + self.link = re.search(self.LINK_PREMIUM_PATTERN, self.html) + recaptcha.challenge() - self.link = urljoin(self.info['pattern']['HOST'], p_url) + except Exception, e: + self.error(e) + + else: + self.link = '/'.join(("d", self.info['pattern']['KEY'], str(self.get_checksum()), self.pyfile.name)) def get_checksum(self): @@ -51,8 +60,8 @@ class ZippyshareCom(SimpleHoster): c1, c2 = map(int, re.search(r'\(\'downloadB\'\).omg\) \* \((\d+)%(\d+)', self.html).groups()) b = (a1 % a2) * (c1 % c2) + 18 - except Exception, e: - self.error(_("Unable to calculate checksum"), e) + except Exception: + self.error(_("Unable to calculate checksum")) else: return b |