本文整理汇总了Python中module.plugins.internal.SimpleHoster.create_getInfo函数的典型用法代码示例。如果您正苦于以下问题:Python create_getInfo函数的具体用法?Python create_getInfo怎么用?Python create_getInfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_getInfo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup
("chk_filesize", "bool", "Check file size" , True),
("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )]
__description__ = """Filepup.net hoster plugin"""
__license__ = "GPLv3"
__authors__ = [("zapp-brannigan", "[email protected]"),
("Walter Purcaro", "[email protected]")]
NAME_PATTERN = r'>(?P<N>.+?)</h1>'
SIZE_PATTERN = r'class="fa fa-archive"></i> \((?P<S>[\d.,]+) (?P<U>[\w^_]+)'
OFFLINE_PATTERN = r'>This file has been deleted'
LINK_FREE_PATTERN = r'(http://www\.filepup\.net/get/.+?)\''
def setup(self):
self.multiDL = False
self.chunk_limit = 1
def handle_free(self, pyfile):
m = re.search(self.LINK_FREE_PATTERN, self.data)
if m is not None:
dl_link = m.group(1)
self.download(dl_link, post={'task': "download"})
getInfo = create_getInfo(FilepupNet)
示例2: decrypt
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()
def decrypt(self, data):
cipher = ARC4.new(hexlify('E\x15\xa1\x9e\xa3M\xa0\xc6\xa0\x84\xb6H\x83\xa8o\xa0'))
return unhexlify(cipher.encrypt(unhexlify(data)))
def getLocalTimeString(self):
lt = time.localtime()
tz = time.altzone if lt.tm_isdst else time.timezone
return "%s GMT%+03d%02d" % (time.strftime("%a %b %d %Y %H:%M:%S", lt), -tz // 3600, tz % 3600)
def handlePremium(self):
self.logDebug("Premium download as user %s" % self.user)
self.downloadFile()
def downloadFile(self):
found = re.search(self.DOWNLOAD_URL_PATTERN, self.html)
if not found: self.parseError("download link")
self.url = "http://turbobit.net" + found.group('url')
self.logDebug(self.url)
self.download(self.url)
getInfo = create_getInfo(TurbobitNet)
示例3: setup
SH_COOKIES = [("http://www.wrzuc.to", "language", "en")]
FILE_SIZE_PATTERN = r'class="info">\s*<tr>\s*<td>(?P<S>.*?)</td>'
FILE_NAME_PATTERN = r'id="file_info">\s*<strong>(?P<N>.*?)</strong>'
def setup(self):
self.multiDL = True
def handleFree(self):
data = dict(re.findall(r'(md5|file): "(.*?)"', self.html))
if len(data) != 2:
self.parseError('File ID')
self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"])
self.req.http.lastURL = self.pyfile.url
self.load("http://www.wrzuc.to/ajax/server/prepair", post={"md5": data['md5']})
self.req.http.lastURL = self.pyfile.url
self.html = self.load("http://www.wrzuc.to/ajax/server/download_link", post={"file": data['file']})
data.update(re.findall(r'"(download_link|server_id)":"(.*?)"', self.html))
if len(data) != 4:
self.parseError('Download URL')
download_url = "http://%s.wrzuc.to/pobierz/%s" % (data['server_id'], data['download_link'])
self.logDebug("Download URL: %s" % download_url)
self.download(download_url)
getInfo = create_getInfo(WrzucTo)
示例4: getLastHeaders
self.fail("Cookie error")
location = headers.get("location")
self.req.setCookieJar(cj)
self.download(location, disposition=True)
else:
self.fail("Invalid response")
def getLastHeaders(self):
#parse header
header = {"code": self.req.code}
for line in self.req.http.header.splitlines():
line = line.strip()
if not line or ":" not in line:
continue
key, none, value = line.partition(":")
key = key.lower().strip()
value = value.strip()
if key in header:
if type(header[key]) == list:
header[key].append(value)
else:
header[key] = [header[key], value]
else:
header[key] = value
return header
getInfo = create_getInfo(DlFreeFr)
示例5: handlePremium
self.retry(max_tries=5, reason="Wrong captcha")
def handlePremium(self):
header = self.load(self.pyfile.url, just_header=True)
if "location" in header:
url = header["location"]
else:
self.html = self.load(self.pyfile.url)
self.getFileInfo() #
if self.CREDIT_PATTERN in self.html:
self.logWarning("Not enough traffic left")
self.resetAccount()
else:
found = re.search(self.PREMIUM_URL_PATTERN, self.html)
if found:
url = found.group(1)
else:
self.parseError("Premium URL")
self.logDebug("PREMIUM URL: " + url)
self.download(url, disposition=True)
check = self.checkDownload({"credit": re.compile(self.CREDIT_PATTERN)})
if check == "credit":
self.resetAccount()
getInfo = create_getInfo(FastshareCz)
示例6: do_recaptcha
return swfdump
def do_recaptcha(self):
self.logDebug('Trying to solve captcha')
captcha_key = re.search(self.CAPTCHA_KEY_PATTERN, self.html).group(1)
shortencode = re.search(self.CAPTCHA_SHORTENCODE_PATTERN, self.html).group(1)
url = re.search(self.CAPTCHA_DOWNLOAD_PATTERN, self.html).group(1)
recaptcha = ReCaptcha(self)
for i in range(5):
challenge, code = recaptcha.challenge(captcha_key)
response = json_loads(self.load(self.file_info['HOST'] + '/rest/captcha/test',
post={'challenge': challenge,
'response': code,
'shortencode': shortencode}))
self.logDebug("reCaptcha response : %s" % response)
if response == True:
self.correctCaptcha()
break
else:
self.invalidCaptcha()
else:
self.fail("Invalid captcha")
return url
getInfo = create_getInfo(ZippyshareCom)
示例7: check_file
self.wait()
def check_file(self):
#: Check download
check = self.check_download({
"temp offline" : re.compile(r"^Soubor je do.*asn.* nedostupn.*$"),
'credit' : re.compile(r"^Nem.*te dostate.*n.* kredit.$"),
"multi-dl" : re.compile(self.MULTIDL_PATTERN),
'captcha' : "<li>Zadaný ověřovací kód nesouhlasí!</li>"
})
if check == "temp offline":
self.fail(_("File not available - try later"))
elif check == "credit":
self.restart(nopremium=True)
elif check == "multi-dl":
self.wait(5 * 60, 12, _("Download limit reached"))
elif check == "captcha":
self.captcha.invalid()
self.retry()
return super(CzshareCom, self).check_file()
getInfo = create_getInfo(CzshareCom)
示例8: handlePremium
if 'location' in self.req.http.header:
location = re.search(r'location: (\S+)', self.req.http.header).group(1)
downloadURL = 'http://filer.net' + location
self.correctCaptcha()
break
else:
self.logInfo('Wrong captcha')
self.invalidCaptcha()
if not downloadURL:
self.fail("No Download url retrieved/all captcha attempts failed")
self.download(downloadURL, disposition=True)
def handlePremium(self):
header = self.load(self.pyfile.url, just_header=True)
if 'location' in header: # Direct Download ON
dl = self.pyfile.url
else: # Direct Download OFF
html = self.load(self.pyfile.url)
m = re.search(self.DIRECT_LINK_PATTERN, html)
if not m:
self.parseError("Unable to detect direct link, try to enable 'Direct download' in your user settings")
dl = 'http://filer.net' + m.group(1)
self.logDebug('Direct link: ' + dl)
self.download(dl, disposition=True)
getInfo = create_getInfo(FilerNet)
示例9: handle_free
'wst' : ""})
if not re.search(r'<status>OK', api):
info['status'] = 1
else:
info['status'] = 2
info['name'] = re.search(r'<name>(.+?)<', api).group(1)
info['size'] = re.search(r'<size>(.+?)<', api).group(1)
return info
def handle_free(self, pyfile):
wst = self.account.get_data('wst') if self.account else None
api_data = get_url("https://webshare.cz/api/file_link/",
post={'ident': self.info['pattern']['ID'], 'wst': wst})
self.log_debug("API data: " + api_data)
m = re.search('<link>(.+)</link>', api_data)
if m is not None:
self.link = m.group(1)
def handle_premium(self, pyfile):
return self.handle_free(pyfile)
getInfo = create_getInfo(WebshareCz)
示例10: DataHu
class DataHu(SimpleHoster):
__name__ = "DataHu"
__type__ = "hoster"
__version__ = "0.06"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?data\.hu/get/\w+'
__config__ = [("activated" , "bool", "Activated" , True),
("use_premium" , "bool", "Use premium account if available" , True),
("fallback" , "bool", "Fallback to free download if premium fails" , True),
("chk_filesize", "bool", "Check file size" , True),
("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )]
__description__ = """Data.hu hoster plugin"""
__license__ = "GPLv3"
__authors__ = [("crash", None),
("stickell", "[email protected]")]
INFO_PATTERN = ur'<title>(?P<N>.*) \((?P<S>[^)]+)\) let\xf6lt\xe9se</title>'
OFFLINE_PATTERN = ur'Az adott f\xe1jl nem l\xe9tezik'
LINK_FREE_PATTERN = r'<div class="download_box_button"><a href="(.+?)">'
def setup(self):
self.resume_download = True
self.multiDL = self.premium
getInfo = create_getInfo(DataHu)
示例11: create_getInfo
found = re.search(self.DOWNLOAD_URL_PATTERN, self.html)
if found:
if 'captcha_hash' in params:
self.correctCaptcha()
download_url = found.group(1)
break
found = re.search(self.CAPTCHA_PATTERN, self.html)
if found:
if 'captcha_hash' in params:
self.invalidCaptcha()
captcha_url1 = "http://www.sendspace.com/" + found.group(1)
found = re.search(self.USER_CAPTCHA_PATTERN, self.html)
captcha_url2 = "http://www.sendspace.com/" + found.group(1)
params = {'captcha_hash': found.group(2),
'captcha_submit': 'Verify',
'captcha_answer': self.decryptCaptcha(captcha_url1) + " " + self.decryptCaptcha(captcha_url2)}
else:
params = {'download': "Regular Download"}
self.logDebug(params)
self.html = self.load(self.pyfile.url, post=params)
else:
self.fail("Download link not found")
self.logDebug("Download URL: %s" % download_url)
self.download(download_url)
create_getInfo(SendspaceCom)
示例12: setup
INFO_PATTERN = r'<title>(?P<N>.+) \((?P<S>[\d.,]+) (?P<U>[\w^_]+)\)<'
OFFLINE_PATTERN = r'<div class="alert alert-error"'
IP_BLOCKED_PATTERN = ur'>Nasz serwis wykrył że Twój adres IP nie pochodzi z Polski.<'
WAIT_PATTERN = r'var\scount\s=\s(\d+);'
LINK_FREE_PATTERN = r'<form action="(.+?)" method="GET">'
LINK_PREMIUM_PATTERN = r'<form action="(.+?)" method="GET">'
def setup(self):
self.multiDL = self.premium
self.resume_download = True
def handle_free(self, pyfile):
recaptcha = ReCaptcha(self)
response, challenge = recaptcha.challenge()
self.data = self.load(pyfile.url,
post={'recaptcha_challenge_field': challenge,
'recaptcha_response_field' : response})
m = re.search(self.LINK_FREE_PATTERN, self.data)
if m is not None:
self.link = m.group(1)
getInfo = create_getInfo(CatShareNet)
示例13: create_getInfo
if m is None:
self.error(_("LINK_FREE_PATTERN not found"))
url = m.group(1)
self.log_debug(('FREEUSER' if m.group(2) == "download" else 'GUEST') + ' URL', url)
res = json.loads(self.load(urlparse.urljoin("http://115.com/", url), decode=False))
if "urls" in res:
mirrors = res['urls']
elif "data" in res:
mirrors = res['data']
else:
mirrors = None
for mr in mirrors:
try:
self.link = mr['url'].replace("\\", "")
self.log_debug("Trying URL: " + self.link)
break
except Exception:
pass
else:
self.fail(_("No working link found"))
getInfo = create_getInfo(YibaishiwuCom)
示例14: handle_captcha
def handle_captcha(self):
post_data = {'free' : 1,
'freeDownloadRequest': 1,
'uniqueId' : self.fid,
'yt0' : ''}
m = re.search(r'id="(captcha\-form)"', self.html)
self.log_debug("captcha-form found %s" % m)
m = re.search(self.CAPTCHA_PATTERN, self.html)
self.log_debug("CAPTCHA_PATTERN found %s" % m)
if m:
captcha_url = urlparse.urljoin("http://keep2s.cc/", m.group(1))
post_data['CaptchaForm[code]'] = self.captcha.decrypt(captcha_url)
else:
recaptcha = ReCaptcha(self)
response, challenge = recaptcha.challenge()
post_data.update({'recaptcha_challenge_field': challenge,
'recaptcha_response_field' : response})
self.html = self.load(self.pyfile.url, post=post_data)
if 'verification code is incorrect' not in self.html:
self.captcha.correct()
else:
self.captcha.invalid()
getInfo = create_getInfo(Keep2ShareCc)
示例15: checkWait
download_url = found.group(1)
self.logDebug(download_url)
self.download(download_url)
def checkWait(self):
found = re.search(r"(?:Delay between downloads must be not less than|Try again in)\s*(\d+)\s*(hour|min)",
self.html)
if found:
wait_time = int(found.group(1)) * {"hour": 60, "min": 1}[found.group(2)]
else:
found = re.search(r"You have reached your (daily|hourly) downloads limit", self.html)
if found:
wait_time = 60
else:
return
self.logDebug("Waiting %d minutes" % wait_time)
self.setWait(wait_time * 60, 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)