Scrapen Sie Hearthstone-Decks von HearthPwn (http://hearthpwn.com) und erstellen Sie dann eine SQLite-Datenbank der Ergebnisse. Kann auch Kartensammlungsdaten von HearthPwn/Innkeeper (http://innkeeper.com) extrahieren und mit der Mashape Hearthstone API von omgvamp (http://hearthstoneapi.com) integrieren, um eine Tabelle mit Kartendaten zu erstellen, die für weitere Zwecke verwendet werden kann erweiterte Abfragen.
Erfordert lxml-, cssselect- und request-Pakete. Diese können installiert werden, indem Sie eine Eingabeaufforderung im Hearthstats-Ordner öffnen und den folgenden Befehl ausführen:
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.
Bevor Sie die Kartendatenbank füllen, müssen Sie sich zunächst bei Mashape.com für einen API-Schlüssel registrieren. Sobald Sie Ihren API-Schlüssel haben, benennen Sie config.ini.example in config.ini um, wenn config.ini noch nicht vorhanden ist, und öffnen Sie config.ini in einem Texteditor (durch einmaliges Ausführen des Skripts wird auch eine leere config.ini-Datei erstellt). :
[Configuration]
mashapekey = keygoeshere
authsession = authsessiongoeshere
Ersetzen Sie keygoeshere durch Ihren Mashape-API-Schlüssel.
Bevor Sie die Kartensammlungsdatenbank füllen, müssen Sie Ihre Kartensammlung zunächst mit Innkeeper synchronisieren. Melden Sie sich dann bei Ihrem HearthPwn-Konto an. Rufen Sie mithilfe der Entwicklungskonsole Ihres Webbrowsers (oder eines anderen Tools zur Cookie-Anzeige) den Wert des Auth.Session-Cookies ab. Sobald Sie Ihren Auth.Session-Wert haben, benennen Sie config.ini.example in config.ini um, wenn config.ini noch nicht vorhanden ist, und öffnen Sie config.ini in einem Texteditor (durch einmaliges Ausführen des Skripts wird auch eine leere config.ini erstellt). Datei):
[Configuration]
mashapekey = keygoeshere
authsession = authsessiongoeshere
Ersetzen Sie authsessiongoeshere durch Ihren Auth.Session-Wert.