hsdata
用数据玩炉石
快速收集和分析炉石传说的卡牌及卡组数据
运行环境
hsdata 使用 Python 3 编写,引用了 requests 和 scrapy 两个模块,理论上可以在所有支持这两个模块的系统环境中运行。
如何安装
推荐使用 pip 安装
pip3 install -U hsdata
快速上手
import hsdata
# 获取卡组数据
decks = hsdata.HSBoxDecks()
# 若未找到本地数据,会自动从网络获取
print('从炉石盒子获取到', len(decks), '个卡组数据!')
# 更新卡组数据
# decks.update()
# 搜索卡组
found = decks.search(
career='萨满',
mode=hsdata.MODE_STANDARD,
min_games=10000,
win_rate_top_n=5)
print('其中5个胜率最高的萨满卡组:')
for deck in found:
print('{}: {} 场, {:.2%} 胜'.format(
deck.name, deck.games, deck.win_rate))
# 查看卡组中的卡牌
print('其中第一个卡组用了这些卡牌')
print(found[0].cards)
运行结果类似这样
从炉石盒子获取到 1574 个卡组数据!
其中5个胜率最高的萨满卡组:【黄金赛冠军】OmegaZero中速萨: 124830 场, 63.47% 胜【欧服登顶】Janos 中速萨: 172444 场, 63.02% 胜【EULC冠军】Pavel中速萨: 61187 场, 62.73% 胜【欧服前50】Toymachine中速萨: 41754 场, 60.95% 胜【外服登顶】Ownerism 中速萨: 152966 场, 60.94% 胜其中第一个卡组用了这些卡牌Counter({<Card: 坑道穴居人 (LOE_018)>: 2,<Card: 大漩涡传送门 (KAR_073)>: 2,<Card: 碧蓝幼龙 (EX1_284)>: 2,<Card: 幽灵之爪 (KAR_063)>: 2,<Card: 火元素 (CS2_042)>: 2,<Card: 巴内斯 (KAR_114)>: 1,<Card: 银色侍从 (EX1_008)>: 1,<Card: 血法师萨尔诺斯 (EX1_012)>: 1,<Card: 野性狼魂 (EX1_248)>: 2,<Card: 法力之潮图腾 (EX1_575)>: 2,<Card: 深渊魔物 (OG_028)>: 2,<Card: 闪电箭 (EX1_238)>: 2,<Card: 雷霆崖勇士 (AT_049)>: 2,<Card: 火舌图腾 (EX1_565)>: 2,<Card: 图腾魔像 (AT_052)>: 2,<Card: 闪电风暴 (EX1_259)>: 1,<Card: 妖术 (EX1_246)>: 2})
以上只是个帮助入门的例子,发挥想象力,用它来探索更多吧!
数据来源
目前 hsdata 采用了以下数据来源,这些数据的版权为各数据源所有。
卡牌数据
卡组数据
许可协议: Apache License, Version 2.0
Metadata
Release files for hsdata 0.2.16
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hsdata-0.2.16.tar.gz | 20.2 kB | Without provenance | Details for hsdata-0.2.16.tar.gz |
Release files / hsdata-0.2.16.tar.gz
| Download URL | hsdata-0.2.16.tar.gz |
|---|---|
| Size | 20.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0bb458aed4ef5d3ed66a34863bd0b77e6f88f6e0bf7c3ff139c14efbf72905e2
|
|
BLAKE2b-256 checksum How to use checksums |
418a177218be984eb64ec7f2068bf3e311c7c688c8a374344f209f90bed20112
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for hsdata 0.2.16
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.