A project that I've had in my head for the longest time is to build a personalized recommendation engine based on the cards that a player has. Now that I have a little free time for a couple of days, I thought I would just start.
The idea i had was to extract the ruleset and lineup of my wins using the Splinterlands API.
from bs4 import BeautifulSoup
import requests
import json
url = "https://api.splinterlands.io/battle/history?player=numpypython"
req = requests.get(url)
y = req.json()
js = json.dumps(y, indent=4, separators=(',', ': '))
with open('test.json', 'w+') as f:
f.write(js)
So, i thought with the json output being a dictionary, it would be easy to parse through and extract the lineups.
Unfortunately, the portion with the battle lineup is a bit of a word salad. Also, the API returns the NFT id of the card that was played and not the name of the summoner or monster.
Here's a screenshot:
I am starting to think that perhaps using puppeteer or selenium and extracting the information from the tree structure of the battle-log page might be easier. I'll still explore the first option for another day before possibly switching strategy.
If you have any idea or suggestions, they are most welcome.