《王者荣耀》出装下助手

news/2024/12/23 2:27:14/

# coding: utf-8
from urllib.request import urlretrieve
import requests
import osdef hero_imgs_download(url, header):req = requests.get(url=url, headers=header).json()hero_num = len(req['list'])print('一共有%d个英雄' % hero_num)hero_images_path = 'hero_images'for each_hero in req['list']:hero_photo_url = each_hero['cover']hero_name = each_hero['name'] + '.jpg'filename = hero_images_path + '/' + hero_nameif hero_images_path not in os.listdir():os.makedirs(hero_images_path)urlretrieve(url=hero_photo_url, filename=filename)def hero_list(url, header):print('*' * 100)print('\t\t\t\t欢迎使用《王者荣耀》出装下助手!')print('*' * 100)req = requests.get(url=url, headers=header).json()flag = 0for each_hero in req['list']:flag += 1print('%s的ID为:%-7s' %(each_hero['name'], each_hero['hero_id']), end='\t\t')if flag == 3:print('\n', end='')flag = 0def seek_weapon(equip_id, weapon_info):for each_weapon in weapon_info:if each_weapon['equip_id'] == str(equip_id):weapon_name = each_weapon['name']weapon_price = each_weapon['price']return weapon_name, weapon_pricedef hero_info(url, header, weapon_info):req = requests.get(url=url, headers=header).json()print('\n历史上的%s:\n    %s' %(req['info']['name'], req['info']['history_intro']))for each_equip_choice in req['info']['equip_choice']:print('\n%s:\n   %s' %(each_equip_choice['title'], each_equip_choice['description']))total_price = 0flag = 0for each_weapon in each_equip_choice['list']:flag += 1weapon_name, weapon_price = seek_weapon(each_weapon['equip_id'], weapon_info)print('%s:%s' % (weapon_name, weapon_price), end='\t')if flag == 3:print('\n', end='')flag = 0total_price += int(weapon_price)print('神装套件价格共计:%d' % total_price)def hero_weapon(url, header):req = requests.get(url=url, headers=header).json()weapon_info_dict = req['list']return weapon_info_dictif __name__ == '__main__':headers = {'Accept-Charset': 'UTF-8','Accept-Encoding': 'gzip,deflate','User-Agent': 'Dalvik/2.1.0 (Linux; U; Android 6.0.1; MI 5 MIUI/V8.1.6.0.MAACNDI)','X-Requested-With': 'XMLHttpRequest','Content-type': 'application/x-www-form-urlencoded','Connection': 'Keep-Alive','Host': 'gamehelper.gm825.com'}weapon_url = "http://gamehelper.gm825.com/wzry/equip/list?channel_id=90009a&app_id=h9044j&game_id=7622&game_name=%E7%8E%8B%E8%80%85%E8%8D%A3%E8%80%80&vcode=12.0.3&version_code=1203&cuid=2654CC14D2D3894DBF5808264AE2DAD7&ovr=6.0.1&device=Xiaomi_MI+5&net_type=1&client_id=1Yfyt44QSqu7PcVdDduBYQ%3D%3D&info_ms=fBzJ%2BCu4ZDAtl4CyHuZ%2FJQ%3D%3D&info_ma=XshbgIgi0V1HxXTqixI%2BKbgXtNtOP0%2Fn1WZtMWRWj5o%3D&mno=0&info_la=9AChHTMC3uW%2BfY8%2BCFhcFw%3D%3D&info_ci=9AChHTMC3uW%2BfY8%2BCFhcFw%3D%3D&mcc=0&clientversion=&bssid=VY%2BeiuZRJ%2FwaXmoLLVUrMODX1ZTf%2F2dzsWn2AOEM0I4%3D&os_level=23&os_id=dc451556fc0eeadb&resolution=1080_1920&dpi=480&client_ip=192.168.0.198&pdunid=a83d20d8"heros_url = "http://gamehelper.gm825.com/wzry/hero/list?channel_id=90009a&app_id=h9044j&game_id=7622&game_name=%E7%8E%8B%E8%80%85%E8%8D%A3%E8%80%80&vcode=12.0.3&version_code=1203&cuid=2654CC14D2D3894DBF5808264AE2DAD7&ovr=6.0.1&device=Xiaomi_MI+5&net_type=1&client_id=1Yfyt44QSqu7PcVdDduBYQ%3D%3D&info_ms=fBzJ%2BCu4ZDAtl4CyHuZ%2FJQ%3D%3D&info_ma=XshbgIgi0V1HxXTqixI%2BKbgXtNtOP0%2Fn1WZtMWRWj5o%3D&mno=0&info_la=9AChHTMC3uW%2BfY8%2BCFhcFw%3D%3D&info_ci=9AChHTMC3uW%2BfY8%2BCFhcFw%3D%3D&mcc=0&clientversion=&bssid=VY%2BeiuZRJ%2FwaXmoLLVUrMODX1ZTf%2F2dzsWn2AOEM0I4%3D&os_level=23&os_id=dc451556fc0eeadb&resolution=1080_1920&dpi=480&client_ip=192.168.0.198&pdunid=a83d20d8"hero_list(heros_url, headers)hero_id = input("请输入要查询的英雄ID:")hero_url = "http://gamehelper.gm825.com/wzry/hero/detail?hero_id={}&channel_id=90009a&app_id=h9044j&game_id=7622&game_name=%E7%8E%8B%E8%80%85%E8%8D%A3%E8%80%80&vcode=12.0.3&version_code=1203&cuid=2654CC14D2D3894DBF5808264AE2DAD7&ovr=6.0.1&device=Xiaomi_MI+5&net_type=1&client_id=1Yfyt44QSqu7PcVdDduBYQ%3D%3D&info_ms=fBzJ%2BCu4ZDAtl4CyHuZ%2FJQ%3D%3D&info_ma=XshbgIgi0V1HxXTqixI%2BKbgXtNtOP0%2Fn1WZtMWRWj5o%3D&mno=0&info_la=9AChHTMC3uW%2BfY8%2BCFhcFw%3D%3D&info_ci=9AChHTMC3uW%2BfY8%2BCFhcFw%3D%3D&mcc=0&clientversion=&bssid=VY%2BeiuZRJ%2FwaXmoLLVUrMODX1ZTf%2F2dzsWn2AOEM0I4%3D&os_level=23&os_id=dc451556fc0eeadb&resolution=1080_1920&dpi=480&client_ip=192.168.0.198&pdunid=a83d20d8".format(hero_id)weapon_info_dict = hero_weapon(weapon_url, headers)hero_info(hero_url, headers, weapon_info_dict)

 

 


http://www.ppmy.cn/news/336668.html

相关文章

python个人信息查询代码_80行python代码查询你想要的英雄信息

#-*- coding: UTF-8 -*- from urllib.request import urlretrieve import requests import os def hero_imgs_download(url, header): req requests.get(url url, headers header).json() hero_num len(req[list]) print(一共有%d个英雄 % hero_num) hero_images_path her…

c语言开发工具 ios版,ios命令行工具开发

简单说明: 命令行工具的开发对于我们ios开发者来说可能不常使用,但是作为一个程序员我个人认为首先要确保自己的专业知识要过关,其次是其他的知识也要懂些。就比如玩王者荣耀你要有自己擅长的几个英雄,其他的英雄你也要有所了解因…

拯救童年系列-GameBoy介绍及FPGA实现

拯救童年系列-GameBoy介绍及FPGA实现 这个掌上游戏机应该不需要过多言语,大部分的80后、90后的青春记忆,记忆中是那个抱着Game Boy的漫长午后,那个躲在被子里打着手电筒玩Game Boy的不眠夜晚... 玩着智能手机的你,可能无法理解这个…

世界杯---人生就是一届又一届世界杯

注意:下面有视频看到文章会有声音,如果打扰到您非常抱歉,视频在文章最下面,还望观众老爷们不要在意,蟹蟹理解~ 🚀write in front🚀 📝个人主页:认真写博客的夏目浅石. &a…

android平板开机定屏,定屏死机问题操作指南

和您一起终身学习,这里是程序员Android 本篇文章主要介绍 Android 开发中的定屏死机部分知识点,通过阅读本篇文章,您将收获以下内容: 一、定屏死机问题抓取 Log 要求 二、 复现定屏死机问题后做什么 三、检查adb是否可连的方法 四、连接adb 抓取以下Log 五、如果adb不可连,…

中柏pad7安装linux,中柏 EZpad 6Plus安装凤凰系统全过程,今天抽空整理了一下,看看有没有人需要...

首先要对大神@youling257的无私帮助报以万分感谢~~ 一直想弄一台双系统平板玩玩,主要看盘用,所以对于硬件要求不会太高,几个国产寨板对比了一下最后入坑中柏 EZpad 6Plus。 主要配置: 型号:中柏EZpad 6Plus系统:WIN10 64专业版 处理器 英特尔 Celeron(赛扬) N3450 @ 1.…

荣耀9不负众望 科技美学再升级

6月12日下午,荣耀在上海发布了一款新品旗舰——荣耀9。该机和去年发布的荣耀8定位相同,主打高颜值,外观设计极为精美,同时荣耀9拥有多种配色版本,主推海鸥灰版本。 荣耀赵明在荣耀9发布会:年轻,…

荣耀手机国际化版图再扩张:登陆哥伦比亚,意在“席卷拉美”

当地时间6月28日,荣耀手机在哥伦比亚的首次官方发布会顺利举行,荣耀View 10、荣耀畅玩7X、荣耀畅玩7A以及荣耀7S(国内荣耀畅玩7)四款产品首发亮相。同时,荣耀手机宣布正式投入拉美市场的怀抱,且在未来两周之…