本文整理汇总了Python中pyload.utils.json_loads函数的典型用法代码示例。如果您正苦于以下问题:Python json_loads函数的具体用法?Python json_loads怎么用?Python json_loads使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了json_loads函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: handleFree
def handleFree(self, pyfile):
m = re.search('<h2>((Daily )?Download Limit)</h2>', self.html)
if m:
pyfile.error = m.group(1)
self.logWarning(pyfile.error)
self.retry(6, (6 * 60 if m.group(2) else 15) * 60, pyfile.error)
ajax_url = "http://uploading.com/files/get/?ajax"
self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With: XMLHttpRequest"])
self.req.http.lastURL = pyfile.url
res = json_loads(self.load(ajax_url, post={'action': 'second_page', 'code': self.info['pattern']['ID']}))
if 'answer' in res and 'wait_time' in res['answer']:
wait_time = int(res['answer']['wait_time'])
self.logInfo(_("Waiting %d seconds") % wait_time)
self.wait(wait_time)
else:
self.error(_("No AJAX/WAIT"))
res = json_loads(self.load(ajax_url, post={'action': 'get_link', 'code': self.info['pattern']['ID'], 'pass': 'false'}))
if 'answer' in res and 'link' in res['answer']:
url = res['answer']['link']
else:
self.error(_("No AJAX/URL"))
self.html = self.load(url)
m = re.search(r'<form id="file_form" action="(.*?)"', self.html)
if m:
url = m.group(1)
else:
self.error(_("No URL"))
self.link = url
开发者ID:reissdorf,项目名称:pyload,代码行数:35,代码来源:UploadingCom.py
示例2: challenge
def challenge(self, key=None, html=None):
if not key:
if self.detect_key(html):
key = self.key
else:
errmsg = _("AdYouLike key not found")
self.plugin.fail(errmsg)
raise TypeError(errmsg)
ayl, callback = key
# {"adyoulike":{"key":"P~zQ~O0zV0WTiAzC-iw0navWQpCLoYEP"},
# "all":{"element_id":"ayl_private_cap_92300","lang":"fr","env":"prod"}}
ayl = json_loads(ayl)
html = self.plugin.req.load("http://api-ayl.appspot.com/challenge",
get={'key': ayl['adyoulike']['key'],
'env': ayl['all']['env'],
'callback': callback})
try:
challenge = json_loads(re.search(callback + r'\s*\((.+?)\)', html).group(1))
except AttributeError:
errmsg = _("AdYouLike challenge pattern not found")
self.plugin.fail(errmsg)
raise AttributeError(errmsg)
self.logDebug("Challenge: %s" % challenge)
return self.result(ayl, challenge), challenge
开发者ID:Bobbaone,项目名称:pyload,代码行数:30,代码来源:AdYouLike.py
示例3: result
def result(self, server, challenge):
# Adyoulike.g._jsonp_5579316662423138
# ({"translations":{"fr":{"instructions_visual":"Recopiez « Soonnight » ci-dessous :"}},
# "site_under":true,"clickable":true,"pixels":{"VIDEO_050":[],"DISPLAY":[],"VIDEO_000":[],"VIDEO_100":[],
# "VIDEO_025":[],"VIDEO_075":[]},"medium_type":"image/adyoulike",
# "iframes":{"big":"<iframe src=\"http://www.soonnight.com/campagn.html\" scrolling=\"no\"
# height=\"250\" width=\"300\" frameborder=\"0\"></iframe>"},"shares":{},"id":256,
# "token":"e6QuI4aRSnbIZJg02IsV6cp4JQ9~MjA1","formats":{"small":{"y":300,"x":0,"w":300,"h":60},
# "big":{"y":0,"x":0,"w":300,"h":250},"hover":{"y":440,"x":0,"w":300,"h":60}},
# "tid":"SqwuAdxT1EZoi4B5q0T63LN2AkiCJBg5"})
if isinstance(server, basestring):
server = json_loads(server)
if isinstance(challenge, basestring):
challenge = json_loads(challenge)
try:
instructions_visual = challenge['translations'][server['all']['lang']]['instructions_visual']
result = re.search(u'«(.+?)»', instructions_visual).group(1).strip()
except AttributeError:
errmsg = _("AdYouLike result not found")
self.plugin.fail(errmsg)
raise AttributeError(errmsg)
result = {'_ayl_captcha_engine': "adyoulike",
'_ayl_env': server['all']['env'],
'_ayl_tid': challenge['tid'],
'_ayl_token_challenge': challenge['token'],
'_ayl_response': response}
self.logDebug("Result: %s" % result)
return result
开发者ID:Bobbaone,项目名称:pyload,代码行数:35,代码来源:AdYouLike.py
示例4: handle_premium
def handle_premium(self, pyfile):
user, data = self.account.selectAccount()
# Get the download link
res = self.load("https://premium.rpnet.biz/client_api.php",
get={"username": user,
"password": data['password'],
"action" : "generate",
"links" : pyfile.url})
self.logDebug("JSON data: %s" % res)
link_status = json_loads(res)['links'][0] #: get the first link... since we only queried one
# Check if we only have an id as a HDD link
if 'id' in link_status:
self.logDebug("Need to wait at least 30 seconds before requery")
self.setWait(30) #: wait for 30 seconds
self.wait()
# Lets query the server again asking for the status on the link,
# we need to keep doing this until we reach 100
max_tries = 30
my_try = 0
while (my_try <= max_tries):
self.logDebug("Try: %d ; Max Tries: %d" % (my_try, max_tries))
res = self.load("https://premium.rpnet.biz/client_api.php",
get={"username": user,
"password": data['password'],
"action": "downloadInformation",
"id": link_status['id']})
self.logDebug("JSON data hdd query: %s" % res)
download_status = json_loads(res)['download']
if download_status['status'] == '100':
link_status['generated'] = download_status['rpnet_link']
self.logDebug("Successfully downloaded to rpnet HDD: %s" % link_status['generated'])
break
else:
self.logDebug("At %s%% for the file download" % download_status['status'])
self.setWait(30)
self.wait()
my_try += 1
if my_try > max_tries: #: We went over the limit!
self.fail(_("Waited for about 15 minutes for download to finish but failed"))
if 'generated' in link_status:
self.link = link_status['generated']
return
elif 'error' in link_status:
self.fail(link_status['error'])
else:
self.fail(_("Something went wrong, not supposed to enter here"))
开发者ID:Bobbaone,项目名称:pyload,代码行数:53,代码来源:RPNetBiz.py
示例5: getInfo
def getInfo(cls, url="", html=""):
info = super(YadiSk, cls).getInfo(url, html)
if html:
if 'idclient' not in info:
info['idclient'] = ""
for _i in xrange(32):
info ['idclient'] += random.choice('0123456abcdef')
m = re.search(r'<script id="models-client" type="application/json">(.+?)</script>', html)
if m:
api_data = json_loads(m.group(1))
try:
for sect in api_data:
if 'model' in sect:
if sect['model'] == "config":
info['version'] = sect['data']['version']
info['sk'] = sect['data']['sk']
elif sect['model'] == "resource":
info['id'] = sect['data']['id']
info['size'] = sect['data']['meta']['size']
info['name'] = sect['data']['name']
except Exception, e:
info['status'] = 8
info['error'] = _("Unexpected server response: %s") % e.message
else:
info['status'] = 8
info['error'] = _("could not find required json data")
开发者ID:Bobbaone,项目名称:pyload,代码行数:31,代码来源:YadiSk.py
示例6: getHosters
def getHosters(self):
json_data = self.getURL("http://www.simply-premium.com/api/hosts.php", get={'format': "json", 'online': 1})
json_data = json_loads(json_data)
host_list = [element['regex'] for element in json_data['result']]
return host_list
开发者ID:Bobbaone,项目名称:pyload,代码行数:7,代码来源:SimplyPremiumCom.py
示例7: handle_free
def handle_free(self, pyfile):
m = re.search(self.LINK_FREE_PATTERN, self.html)
if m is None:
self.error(_("LINK_FREE_PATTERN not found"))
url = m.group(1)
self.logDebug(('FREEUSER' if m.group(2) == 'download' else 'GUEST') + ' URL', url)
res = json_loads(self.load("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.logDebug("Trying URL: " + self.link)
break
except Exception:
continue
else:
self.fail(_("No working link found"))
开发者ID:Bobbaone,项目名称:pyload,代码行数:28,代码来源:YibaishiwuCom.py
示例8: getHosters
def getHosters(self):
html = self.getURL("http://fastix.ru/api_v2",
get={'apikey': "5182964c3f8f9a7f0b00000a_kelmFB4n1IrnCDYuIFn2y",
'sub' : "allowed_sources"})
host_list = json_loads(html)
host_list = host_list['allow']
return host_list
开发者ID:Bobbaone,项目名称:pyload,代码行数:7,代码来源:FastixRu.py
示例9: api_response
def api_response(self, api="captcha", post=False, multipart=False):
req = getRequest()
req.c.setopt(pycurl.HTTPHEADER, ["Accept: application/json", "User-Agent: pyLoad %s" % self.core.version])
if post:
if not isinstance(post, dict):
post = {}
post.update({"username": self.getConfig('username'),
"password": self.getConfig('passkey')})
res = None
try:
json = req.load("%s%s" % (self.API_URL, api),
post=post,
multipart=multipart)
self.logDebug(json)
res = json_loads(json)
if "error" in res:
raise DeathByCaptchaException(res['error'])
elif "status" not in res:
raise DeathByCaptchaException(str(res))
except BadHeader, e:
if 403 == e.code:
raise DeathByCaptchaException('not-logged-in')
elif 413 == e.code:
raise DeathByCaptchaException('invalid-captcha')
elif 503 == e.code:
raise DeathByCaptchaException('service-overload')
elif e.code in (400, 405):
raise DeathByCaptchaException('invalid-request')
else:
raise
开发者ID:reissdorf,项目名称:pyload,代码行数:34,代码来源:DeathByCaptcha.py
示例10: loadAccountInfo
def loadAccountInfo(self, user, req):
data = self.getAccountData(user)
r = req.load('http://gen.linksnappy.com/lseAPI.php',
get={'act': 'USERDETAILS', 'username': user, 'password': hashlib.md5(data['password']).hexdigest()})
self.logDebug("JSON data: " + r)
j = json_loads(r)
if j['error']:
return {"premium": False}
validuntil = j['return']['expire']
if validuntil == 'lifetime':
validuntil = -1
elif validuntil == 'expired':
return {"premium": False}
else:
validuntil = float(validuntil)
if 'trafficleft' not in j['return'] or isinstance(j['return']['trafficleft'], str):
trafficleft = -1
else:
trafficleft = self.parseTraffic("%d MB" % j['return']['trafficleft'])
return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft}
开发者ID:Bobbaone,项目名称:pyload,代码行数:29,代码来源:LinksnappyCom.py
示例11: handle_premium
def handle_premium(self, pyfile):
data = json_loads(self.load("https://real-debrid.com/ajax/unrestrict.php",
get={'lang' : "en",
'link' : pyfile.url,
'password': self.getPassword(),
'time' : int(time.time() * 1000)}))
self.logDebug("Returned Data: %s" % data)
if data['error'] != 0:
if data['message'] == "Your file is unavailable on the hoster.":
self.offline()
else:
self.logWarning(data['message'])
self.tempOffline()
else:
if pyfile.name and pyfile.name.endswith('.tmp') and data['file_name']:
pyfile.name = data['file_name']
pyfile.size = parseFileSize(data['file_size'])
self.link = data['generated_links'][0][-1]
if self.getConfig('ssl'):
self.link = self.link.replace("http://", "https://")
else:
self.link = self.link.replace("https://", "http://")
开发者ID:Bobbaone,项目名称:pyload,代码行数:25,代码来源:RealdebridCom.py
示例12: process
def process(self, pyfile):
if not self.account:
self.logError(_("Please enter your %s account or deactivate this plugin") % "Unrestrict.li")
self.fail("No Unrestrict.li account provided")
self.logDebug("Old URL: %s" % pyfile.url)
if re.match(self.__pattern__, pyfile.url):
new_url = pyfile.url
else:
for i in xrange(5):
page = self.req.load('https://unrestrict.li/unrestrict.php',
post={'link': pyfile.url, 'domain': 'long'})
self.logDebug("JSON data: " + page)
if page != '':
break
if "File offline" in page:
self.offline()
elif "You are not allowed to download from this host" in page:
self.fail("You are not allowed to download from this host")
elif "You have reached your daily limit for this host" in page:
self.logInfo("Reached daily limit for this host. Waiting until 00:10 GMT+2")
self.retry(5, secondsToMidnight(), "Daily limit for this host reached")
page = json_loads(page)
new_url = page.keys()[0]
self.api_data = page[new_url]
self.logDebug("New URL: " + new_url)
self.download(new_url, disposition=True)
if self.getConfig("history"):
self.load("https://unrestrict.li/history/&delete=all")
self.logInfo("Download history deleted")
开发者ID:DasLampe,项目名称:pyload,代码行数:33,代码来源:UnrestrictLi.py
示例13: handleFree
def handleFree(self, pyfile):
action, inputs = self.parseHtmlForm('id="frm-downloadDialog-freeDownloadForm"')
if not action or not inputs:
self.error(_("Free download form not found"))
self.logDebug("inputs.keys = " + str(inputs.keys()))
# get and decrypt captcha
if all(key in inputs for key in ("captcha_value", "captcha_id", "captcha_key")):
# Old version - last seen 9.12.2013
self.logDebug('Using "old" version')
captcha_value = self.decryptCaptcha("http://img.uloz.to/captcha/%s.png" % inputs['captcha_id'])
self.logDebug("CAPTCHA ID: " + inputs['captcha_id'] + ", CAPTCHA VALUE: " + captcha_value)
inputs.update({'captcha_id': inputs['captcha_id'], 'captcha_key': inputs['captcha_key'], 'captcha_value': captcha_value})
elif all(key in inputs for key in ("captcha_value", "timestamp", "salt", "hash")):
# 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()))})
self.logDebug("xapca = " + str(xapca))
data = json_loads(xapca)
captcha_value = self.decryptCaptcha(str(data['image']))
self.logDebug("CAPTCHA HASH: " + data['hash'], "CAPTCHA SALT: " + str(data['salt']), "CAPTCHA VALUE: " + captcha_value)
inputs.update({'timestamp': data['timestamp'], 'salt': data['salt'], 'hash': data['hash'], 'captcha_value': captcha_value})
else:
self.error(_("CAPTCHA form changed"))
self.download("http://www.ulozto.net" + action, post=inputs)
开发者ID:PaddyPat,项目名称:pyload,代码行数:33,代码来源:UlozTo.py
示例14: loadAccountInfo
def loadAccountInfo(self, user, req):
validuntil = None
trafficleft = None
premium = False
sid = None
try:
sid = self.getAccountData(user).get('sid')
assert sid
html = req.load("%s/info" % self.API_URL, get={'sid': sid})
self.logDebug("API:USERINFO", html)
json = json_loads(html)
if json['response_status'] == 200:
if "reset_in" in json['response']:
self.scheduleRefresh(user, json['response']['reset_in'])
validuntil = json['response']['expire_date']
trafficleft = float(json['response']['traffic_left'])
premium = True
else:
self.logError(json['response_details'])
except Exception, e:
self.logError(e)
开发者ID:Bobbaone,项目名称:pyload,代码行数:28,代码来源:RapidgatorNet.py
示例15: decrypt
def decrypt(self, pyfile):
url, result = checkHTMLHeader(pyfile.url)
self.logDebug("Location (%d): %s" % (result, url))
if result == 0:
# load and parse html
html = self.load(pyfile.url)
m = re.search(self.LINK_PATTERN, html)
if m:
# file page
self.urls.append("http://www.mediafire.com/file/%s" % m.group(1))
else:
# folder page
m = re.search(self.FOLDER_KEY_PATTERN, html)
if m:
folder_key = m.group(1)
self.logDebug("FOLDER KEY: %s" % folder_key)
json_resp = json_loads(self.load("http://www.mediafire.com/api/folder/get_info.php",
get={'folder_key' : folder_key,
'response_format': "json",
'version' : 1}))
#self.logInfo(json_resp)
if json_resp['response']['result'] == "Success":
for link in json_resp['response']['folder_info']['files']:
self.urls.append("http://www.mediafire.com/file/%s" % link['quickkey'])
else:
self.fail(json_resp['response']['message'])
elif result == 1:
self.offline()
else:
self.urls.append(url)
开发者ID:achimschneider,项目名称:pyload,代码行数:32,代码来源:MediafireCom.py
示例16: getHosters
def getHosters(self):
hostings = json_loads(self.getURL("https://www.nopremium.pl/clipboard.php?json=3").strip())
hostings_domains = [domain for row in hostings for domain in row['domains'] if row['sdownload'] == "0"]
self.logDebug(hostings_domains)
return hostings_domains
开发者ID:Bobbaone,项目名称:pyload,代码行数:7,代码来源:NoPremiumPl.py
示例17: getJsonResponse
def getJsonResponse(self, get_dict, post_dict, field):
res = json_loads(self.load('https://filepost.com/files/get/', get=get_dict, post=post_dict))
self.logDebug(res)
if not 'js' in res:
self.error(_("JSON %s 1") % field)
# i changed js_answer to res['js'] since js_answer is nowhere set.
# i don't know the JSON-HTTP specs in detail, but the previous author
# accessed res['js']['error'] as well as js_answer['error'].
# see the two lines commented out with "# ~?".
if 'error' in res['js']:
if res['js']['error'] == 'download_delay':
self.retry(wait_time=res['js']['params']['next_download'])
# ~? self.retry(wait_time=js_answer['params']['next_download'])
elif 'Wrong file password' in res['js']['error'] \
or 'You entered a wrong CAPTCHA code' in res['js']['error'] \
or 'CAPTCHA Code nicht korrekt' in res['js']['error']:
return None
elif 'CAPTCHA' in res['js']['error']:
self.logDebug("Error response is unknown, but mentions CAPTCHA")
return None
else:
self.fail(res['js']['error'])
if not 'answer' in res['js'] or not field in res['js']['answer']:
self.error(_("JSON %s 2") % field)
return res['js']['answer'][field]
开发者ID:PaddyPat,项目名称:pyload,代码行数:34,代码来源:FilepostCom.py
示例18: getAccountStatus
def getAccountStatus(self, user, req):
# Use premiumize.me API v1 (see https://secure.premiumize.me/?show=api)
# to retrieve account info and return the parsed json answer
answer = req.load(
"https://api.premiumize.me/pm-api/v1.php?method=accountstatus¶ms[login]=%s¶ms[pass]=%s" % (
user, self.accounts[user]['password']))
return json_loads(answer)
开发者ID:fraglord,项目名称:pyload,代码行数:7,代码来源:PremiumizeMe.py
示例19: handle_free
def handle_free(self, pyfile):
try:
song_id = re.search(r'sounds:(\d+)"', self.html).group(1)
except Exception:
self.error(_("Could not find song id"))
try:
client_id = re.search(r'"clientID":"(.+?)"', self.html).group(1)
except Exception:
client_id = "b45b1aa10f1ac2941910a7f0d10f8e28"
# url to retrieve the actual song url
streams = json_loads(self.load("https://api.soundcloud.com/tracks/%s/streams" % song_id,
get={'client_id': client_id}))
regex = re.compile(r'[^\d]')
http_streams = sorted([(key, value) for key, value in streams.iteritems() if key.startswith('http_')],
key=lambda t: regex.sub(t[0], ''),
reverse=True)
self.logDebug("Streams found: %s" % (http_streams or "None"))
if http_streams:
stream_name, self.link = http_streams[0 if self.getConfig('quality') == "Higher" else -1]
pyfile.name += '.' + stream_name.split('_')[1].lower()
开发者ID:Bobbaone,项目名称:pyload,代码行数:27,代码来源:SoundcloudCom.py
示例20: loadHosterList
def loadHosterList(self, req):
json_data = req.load('http://unrestrict.li/api/jdownloader/hosts.php?format=json')
json_data = json_loads(json_data)
host_list = [element['host'] for element in json_data['result']]
return host_list
开发者ID:fraglord,项目名称:pyload,代码行数:7,代码来源:UnrestrictLi.py
注:本文中的pyload.utils.json_loads函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论