HearthPwn (http://hearthpwn.com) からハースストーンのデッキを収集し、結果の SQLite データベースを構築します。 HearthPwn/Innkeeper (http://innkeeper.com) からカード コレクション データを収集することもでき、omgvamp の Mashape Hearthstone API (http://hearthstoneapi.com) と統合して、より多くのカードを作成するために使用できるカード データのテーブルを構築します。高度なクエリ。
lxml、cssselect、および request パッケージが必要です。これらは、hearthstats フォルダーでコマンド プロンプトを開き、次のコマンドを実行することでインストールできます。
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.
カード データベースにデータを入力する前に、まず Mashape.com で API キーを登録する必要があります。 API キーを取得したら、config.ini が存在しない場合は config.ini.example の名前を config.ini に変更し、テキスト エディタで config.ini を開きます (スクリプトを 1 回実行すると、空の config.ini ファイルも作成されます)。 :
[Configuration]
mashapekey = keygoeshere
authsession = authsessiongoeshere
keygoeshere を Mashape API キーに置き換えます。
カード コレクション データベースにデータを入力する前に、まず Innkeeper を使用してカード コレクションを同期する必要があります。次に、HearthPwn アカウントにログインします。 Web ブラウザの開発コンソール (または別の Cookie 表示ツール) を使用して、Auth.Session Cookie の値を取得します。 Auth.Session 値を取得したら、config.ini がまだ存在しない場合は config.ini.example の名前を config.ini に変更し、テキスト エディタで config.ini を開きます (スクリプトを 1 回実行すると空の config.ini も作成されます)ファイル):
[Configuration]
mashapekey = keygoeshere
authsession = authsessiongoeshere
authsessiongoeshere を Auth.Session 値に置き換えます。