Kikis dek Hearthstone dari HearthPwn (http://hearthpwn.com), lalu buat database SQLite dari hasilnya. Dapat juga mengikis data pengumpulan kartu dari HearthPwn/Innkeeper (http://innkeeper.com), dan terintegrasi dengan API Mashape Hearthstone milik omgvamp (http://hearthstoneapi.com) untuk membuat tabel data kartu yang dapat digunakan untuk menghasilkan lebih banyak pertanyaan tingkat lanjut.
Membutuhkan paket lxml, cssselect, dan permintaan. Ini dapat diinstal dengan membuka command prompt di folder hearthstats, dan menjalankan perintah berikut:
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.
Sebelum mengisi database kartu, Anda harus mendaftar terlebih dahulu untuk mendapatkan kunci API di Mashape.com. Setelah Anda memiliki kunci API, ganti nama config.ini.example menjadi config.ini jika config.ini belum ada, dan buka config.ini di editor teks (menjalankan skrip sekali juga akan membuat file config.ini kosong) :
[Configuration]
mashapekey = keygoeshere
authsession = authsessiongoeshere
Ganti keygoeshere dengan kunci API Mashape Anda.
Sebelum mengisi database koleksi kartu, Anda harus melakukan sinkronisasi terlebih dahulu koleksi kartu Anda menggunakan Innkeeper. Kemudian, masuk ke akun HearthPwn Anda. Dengan menggunakan konsol pengembangan browser web Anda (atau alat penampil cookie lainnya), dapatkan nilai cookie Auth.Session. Setelah Anda memiliki nilai Auth.Session, ganti nama config.ini.example menjadi config.ini jika config.ini belum ada, dan buka config.ini di editor teks (menjalankan skrip sekali juga akan membuat config.ini kosong mengajukan):
[Configuration]
mashapekey = keygoeshere
authsession = authsessiongoeshere
Ganti authsessiongoeshere dengan nilai Auth.Session Anda.