قم باستخراج تشكيلات Hearthstone من HearthPwn (http://hearthpwn.com)، ثم أنشئ قاعدة بيانات SQLite للنتائج. يمكن أيضًا استخراج بيانات جمع البطاقات من HearthPwn/Innkeeper (http://innkeeper.com)، والتكامل مع Mashape Hearthstone API الخاص بـ omgvamp (http://hearthstoneapi.com) لإنشاء جدول ببيانات البطاقة التي يمكن استخدامها لتحقيق المزيد الاستعلامات المتقدمة.
يتطلب حزم lxml وcsselect وطلبات. يمكن تثبيتها عن طريق فتح موجه الأوامر في مجلد 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 الخاصة بك.