CW Wizard (Cardmarket Wantlist Wizard), is a Python 3 script to find the best deals (bundles) that can be done for the cards you are looking for in your wantlists.
- Bypass Cloudflare security π
- Easily find the sellers with the most cards you are looking for π
- Open Source script with MIT license, you can create you own Wizard π«
- Fully commented, you can check what is done and how it's done π§
- Work with all card games available on Cardmarket (Magic: The Gathering, Yu-Gi-Oh!, PokΓ©mon, ...) β¨
Disclaimer: If you have activated the Two-factor authentication (2FA) on your Cardmarket account this script won't work (this feature is not planned to be added soon).
It's a Python script, so first, make sure that the required packages are installed and up-to-date
Letβs get started by downloading the project:
> git clone https://github.com/BenSouchet/cw-wizard.git
Cloning into 'cw-wizard'...
> cd cw-wizard
Now you have two options: the script with a User Interface (like a true software) or via command line (like a true developer)
- In this case you need to make sure that tkinter is available on your computer (check here).
- Open on your favorite browser one Cardmarket tab (just one and don't log-in).
- Execute this command in your terminal:
> python3 cw-wizard-gui.py
- Then simply follow the steps in the interface that popped up.
- Open, on your favorite browser, one Cardmarket tab (just one, and don't log-in)
- Check the script help (to see available parameters):
> python3 cw-wizard.py -h
usage: CW Wizard [-h] [-v] -b BROWSER_NAME -u WANTLIST_URLS [WANTLIST_URLS ...] [-m MAX_SELLERS] [-w] [-c]
CW Wizard v1.0.3, Find the best bundles for the cards in your wantlist(s).
options:
-h, --help show this help message and exit
-v, --version show program's version number and exit
-b BROWSER_NAME, --browser_name BROWSER_NAME
Specify the browser name you used to open the Cardmarket tab (needed to bypass Cloudflare protection), accepted values are [chrome, firefox, opera, opera_gx, edge, chromium, brave, vivaldi, safari].
-u WANTLIST_URLS [WANTLIST_URLS ...], --wantlist-urls WANTLIST_URLS [WANTLIST_URLS ...]
wantlist url(s) (if you pass multiples whislists, separate them with spaces)
-m MAX_SELLERS, --max-sellers MAX_SELLERS
maximum number of sellers to display on the result page
-w, --continue-on-warning
if specified the script will continue on non fatal errors
-c, --articles-comment
if specified the sellers comments will be added to the result page
As you can see, you can call the script with one or more wantlist urls, and there is optional arguments available (info on script arguments).
- A basic example would be:
> python3 cw-wizard.py -b chrome -w https://www.cardmarket.com/en/Pokemon/Wants/10876807 -m 10
Example with multiple wantlists:
> python3 cw-wizard.py -b chrome -w https://www.cardmarket.com/en/Pokemon/Wants/10876807 https://www.cardmarket.com/en/Pokemon/Wants/10841970
- If it's the first time you start the script your Cardmarket credentials will be asked to create a
credentials.json
file at the root of the project directory. For info on why credentials are required read this section.
- It's all, if everything goes well a result HTML page will open on your default web browser, otherwise check the terminal to see the error message(s).
With the command line version of the script you can use the following arguments:
Argument Name | Description | Required |
---|---|---|
-v OR --version |
Display the version number of the script in your terminal. | No |
-h OR --help |
Display the help in your terminal. | No |
-b OR --browser-name |
Specify the browser you used to open a Cardmarket tab. | Yes |
-u OR --wantlist-urls |
One or more Cardmarket wantlists (wantlists) urls. If you add multiple urls simply put a space between then (not a comma). |
Yes |
-m OR --max-sellers |
The maximum number of sellers to display on the result page. Default value 20 . 0 means display all. |
No |
-w OR --continue-on-warning |
If specified the script won't stop on non fatal requests errors. | No |
-c OR --articles-comment |
If specified the script will retrieve and add sellers comments to the result page. | No |
Current version is 1.0.3
, you can download this latest release on the Releases category (on the sidebar), from this page or git clone
the main
branch of the repository.
- Bypassing newly added Cloudflare protection by using user cookies (thanks to package Browser Cookie 3).
- Apply platform specific user agent header ( #4 by @michasng )
- Fix attributes issue due to
isReverse
not always available. ( #5 )
- Handle more than the 50 first articles for the card pages (see function
load_more_articles()
). - Skip article and sellers that doesn't ship to your address.
- Extract and display sellers comments for articles (if script argument
-c
is specified). - Add number or sales of the current seller when you display the cards list.
- Minors code simplification.
Currently the most relevant sellers are the ones with the most cards you are looking for in your wantlists.
A more accurate way for sorting the sellers would be with cards prices and cards rarity:
- Rarity Index : Every rarity get a value from 1 to N (stating from the rarest to the more common).
We can assign the same rarity index for multiple rarities if they are equally "rare" ("rare" can be discribe as the percentage of chance to get this card in a booster). - Card Index : For every cards in a seller list we multiply the card rarity by the price.
- Total : Sum the cards Indexes and divide by the number of cards to get an average.
- Normalizing : when every sellers is done, the seller with the highest total value represent a deal index of 50% and the seller with the lower total value represent 100%. For all the other sellers do cross product to determine the deal index according to the highest and lowest we just find.
BUT the technic describe above is very good "in theory" but some heavy limitations occur:
- First point, there is A LOT of card rarities, across the different TCGs. Since we need to assign value (rarity index) for all of them this can get pretty messy.
- Second and most important point, cards with the same rarity aren't equally "rare", for example Charizard 4/102 and Alakazam 1/102 are both holofoil rare but Charizard is way more "rare" because of popularity. So, in the equation a Popularity Index need to be added for every cards...
As you can understand implementing a more accurate sorting system is not an easy task at all, and require lot of data.
If you have another method in mind let me know π
Since Cardmarket wantlists cannot be public this is required that you are logged in, so cards data can be retrieved.
This is why you credentials are required in order that the script work, if you aren't confident putting you credentials please review the code, since all the code is hosted here on Github you can see and check that nothing weird is done with your credentials.
As indicated at the beginning of this README, accounts with Two-factor authentication (2FA) enabled won't be able to use this script, currently the feature is not planned to be added to the project.
This project has been created because the exiting tools (provided by Cardmarket) are good but somehow limited, with this open-souce script it's easy to get exactly the result wanted.
If in the future, this project inspire others to create there own tools this would be a big success.
- CardmarketToCSV by ddkod
- Python Requests Documentation
- Tillana Font by the Indian Type Foundry (License: Open Font License)
CW Wizard has been created and is currently maintained by Ben Souchet.
The code present in this repository is under MIT license.