ขูดสำรับ Hearthstone จาก HearthPwn (http://hearthpwn.com) จากนั้นสร้างฐานข้อมูล SQLite ของผลลัพธ์ ยังสามารถขูดข้อมูลการรวบรวมการ์ดจาก HearthPwn/Innkeeper (http://innkeeper.com) และผสานรวมกับ Mashape Hearthstone API ของ omgvamp (http://hearthstoneapi.com) เพื่อสร้างตารางข้อมูลการ์ดที่สามารถใช้เพื่อสร้างรายได้มากขึ้น แบบสอบถามขั้นสูง
ต้องการ lxml, cssselect และร้องขอแพ็คเกจ สามารถติดตั้งได้โดยการเปิดพรอมต์คำสั่งในโฟลเดอร์ 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.
ก่อนที่จะเติมฐานข้อมูลการ์ด คุณต้องลงทะเบียนคีย์ API ที่ Mashape.com ก่อน เมื่อคุณมีคีย์ API แล้ว ให้เปลี่ยนชื่อ config.ini.example เป็น config.ini หากยังไม่มี config.ini และเปิด config.ini ในโปรแกรมแก้ไขข้อความ (การเรียกใช้สคริปต์หนึ่งครั้งจะสร้างไฟล์ config.ini เปล่าด้วย) : :
[Configuration]
mashapekey = keygoeshere
authsession = authsessiongoeshere
แทนที่ keygoeshere ด้วยคีย์ Mashape API ของคุณ
ก่อนที่จะเติมฐานข้อมูลคอลเลกชันการ์ด คุณต้องซิงค์คอลเลกชันการ์ดของคุณก่อนโดยใช้ Innkeeper จากนั้น เข้าสู่ระบบบัญชี HearthPwn ของคุณ การใช้คอนโซลการพัฒนาของเว็บเบราว์เซอร์ของคุณ (หรือเครื่องมือดูคุกกี้อื่น) รับค่าของคุกกี้ Auth.Session เมื่อคุณมีค่า Auth.Session แล้ว ให้เปลี่ยนชื่อ config.ini.example เป็น config.ini หากยังไม่มี config.ini และเปิด config.ini ในโปรแกรมแก้ไขข้อความ (การเรียกใช้สคริปต์หนึ่งครั้งจะสร้าง config.ini เปล่าด้วย ไฟล์):
[Configuration]
mashapekey = keygoeshere
authsession = authsessiongoeshere
แทนที่ authsessiongoeshere ด้วยค่า Auth.Session ของคุณ