《明日方舟》Python版公开招募工具

工具介绍根据输入的标签,快速找出能够招募4星,5星干员的标签组合,比如刷出了重装|男|支援|术师|先锋五个标签,输入效果如下:注意:不支持高级干员和资深高级干员标签使用环境安装python3安装模块:requests、BeautifulSoup4代码importrequests,sys,bs4,itertoolsall_tags=set()defparseData(data):worker_inf...

《明日方舟》Python版公开招募工具

工具介绍

根据输入的标签,快速找出能够招募4星,5星干员的标签组合,比如刷出了 重装 | 男 | 支援 |术师 | 先锋 五个标签,输入效果如下:

注意:不支持高级干员和资深高级干员标签

使用环境

  1. 安装python3
  2. 安装模块:requests、BeautifulSoup4

代码

import requests, sys, bs4, itertoolsall_tags = set()def parseData(data): worker_infos = [] bsObj = bs4.BeautifulSoup(data, “html.parser“) details = bsObj.findAll(“div“,{“class“: “contentDetail“}) for detail in details:  if u“公开招募“ not in detail.attrs[“data-param1“]:continue  name = detail.find(“a“).attrs[“title“].strip()  profes = detail.attrs[“data-param1“].split(“,“)[0].strip()  sex = detail.attrs[“data-param1“].split(“,“)[1].strip()  star = detail.attrs[“data-param2“].strip()  tags = set()  for tag in detail.findAll(“span“, {“class“: “tagText“}):tags.add(tag.getText().strip())all_tags.add(tag.getText().strip())  tags.add(profes)  tags.add(sex)  all_tags.add(profes)  all_tags.add(sex)  info = [tags, star, “%s(%s星)“ % (name, star)]  worker_infos.append(info) return worker_infosdef printTip(): tip = “\n可选标签:\n“ count = 0 for tag in all_tags:  tip = tiptag“ | “  count  = 1  if count % 9 == 0:tip  = “\n“ tip  = “\n“ print(tip)def checkTags(tags): for tag in tags:  if tag not in all_tags:print(“\n“tag“ 为无效标签“)def getCombs(tags): combs = [] for i in range(len(tags)):  for iter in itertools.combinations(tags, i1):combs.append(set(iter)) return combsdef getWorkers(tags, worker_infos): ret = [] combs = getCombs(tags) for comb in combs:  workers = []  over4 = True  for worker in worker_infos:if comb <= worker[0]: if int(worker[1]) == 4 or int(worker[1]) == 5:  workers.append(worker) elif int(worker[1]) == 3:  over4 = False  if over4 == True and len(workers) > 0:ret.append([comb, workers]) return retdef printWorkers(workers): for worker in workers:  tip = “\n| “  for tag in worker[0]:tip = tiptag“ | “  tip  = “可以招募以下干员:\n“  for info in worker[1]:tip = tipinfo[2]“\n“  print(tip)url = “http://wiki.joyme.com/arknights/公开招募工具“res = requests.get(url)if res.status_code == requests.codes.ok: infos = parseData(res.text) printTip()   while True:  input_tags = input(“请输入标签,使用空格隔开:\n“).split()  checkTags(input_tags)    workers = getWorkers(input_tags, infos)  if len(workers) > 0:printWorkers(workers)  else:print(“不能招聘高星干员“)  print(“--------------------------------------\n“)else: print(“获取数据失败“)

数据来源

公开招募工具

源文地址:https://www.guoxiongfei.cn/cntech/19298.html