Raspe os decks de Hearthstone do HearthPwn (http://hearthpwn.com) e crie um banco de dados SQLite dos resultados. Também pode extrair dados de coleta de cartões do HearthPwn/Innkeeper (http://innkeeper.com) e integrar-se à API Mashape Hearthstone do omgvamp (http://hearthstoneapi.com) para criar uma tabela de dados de cartões que pode ser usada para fazer mais consultas avançadas.
Requer pacotes lxml, cssselect e requests. Eles podem ser instalados abrindo um prompt de comando na pasta hearthstats e executando o seguinte comando:
pip install -r requirements.txt
usage: hearth.py [-h] [--buildcards] [--builddecks] [--buildcollection]
[--perclass] [--count COUNT] [--filtering FILTERING]
[--sorting SORTING] [--patch PATCH] [--results]
Scrape Hearthstone decks from HearthPwn (http://hearthpwn.com), then build a
SQLite database of the results. Can also scrape card collection data from
HearthPwn/Innkeeper (http://innkeeper.com), and integrates with omgvamp's
Mashape Hearthstone API (http://hearthstoneapi.com) to build a table of card
data that can be used to make more advanced queries.
optional arguments:
-h, --help show this help message and exit
--buildcards build card database from Mashape
--builddecks build deck database from HearthPwn
--buildcollection build personal card collection from Hearthpwn
--perclass get the same number of decks for each class
--count COUNT number of decks to retrieve (per class, if --perclass
is set)
--filtering FILTERING
the HearthPwn filter used when finding decks, as seen
in the HearthPwn URL
--sorting SORTING the HearthPwn sorting used when finding decks, as seen
in the HearthPwn URL after "&sort="
--patch PATCH the HearthPwn patch ID used when finding decks, as
seen in the HearthPwn URL after "&filter-build="
--results for all cards, display (in a CSV-ish format) the:
cardname, hero (or neutral), total count of decks
using the card, percentage of decks using the card,
average count of the card in decks using it, and the
count of the card in your collection.
Antes de preencher o banco de dados de cartões, você deve primeiro registrar-se para obter uma chave API em Mashape.com. Depois de ter sua chave API, renomeie config.ini.example para config.ini se config.ini ainda não existir e abra config.ini em um editor de texto (executar o script uma vez também criará um arquivo config.ini em branco) :
[Configuration]
mashapekey = keygoeshere
authsession = authsessiongoeshere
Substitua keygoeshere pela sua chave de API Mashape.
Antes de preencher o banco de dados de coleta de cartões, você deve primeiro sincronizar sua coleção de cartões usando o Innkeeper. Em seguida, faça login na sua conta HearthPwn. Usando o console de desenvolvimento do seu navegador (ou outra ferramenta de visualização de cookies), obtenha o valor do cookie Auth.Session. Depois de ter seu valor Auth.Session, renomeie config.ini.example para config.ini se config.ini ainda não existir e abra config.ini em um editor de texto (executar o script uma vez também criará um config.ini em branco arquivo):
[Configuration]
mashapekey = keygoeshere
authsession = authsessiongoeshere
Substitua authsessiongoeshere pelo seu valor Auth.Session.