Pulling Magic Commander Rankings from EDHREC
I'm working on a tool to help me build Magic Decksmdb. It'll let me search and assemble cards from data via Scryfallsf. I also want to see other folks are doing. For example, which are the most used commanders. I'm grabbing data from EDHRECedh for that.
This is the script I'm using to pull in the raw data.
#!/usr/bin/env python3
=
=
=
=
=
=
=
The code's a little brittle in terms of doing a split to pull out the data instead of more advanced parsing with something like Beautiful Soupbs. That's not a big deal. If they change the page and things break I'll just update the script.
-a
Endnotes
The EDHREC data uses Scryfall IDs. Combining data sets is no fuss, no muss.
Footnotes
The little tool I'm making to make Magic decks. Still very much a work in progress at press time.
The place to search for Magic cards. Even better, they provide bulk data downloads.
Fantastic fan content for all things Magic. They've got articles and stuff which I'm sure are great. I'm only there for the deck lists and rankings though.
For those times when doing simple splits doesn't get you what you need, try Beautiful Soup. It's the only way to fly with python HTML parsing.