Cardmarket is Europe's biggest marketplace for Magic: The Gathering, Pokémon, Yu-Gi-Oh! and other trading cards. Every set has a page listing each card with its rarity, the number of copies for sale and the lowest price, and every card has a price guide with a trend, 30/7/1-day averages and the cheapest offers. For collection valuation, buylist pricing or spotting cards selling under the guide, that is a clean dataset. Here is how to pull it into Python.
Why plain requests fail
import requests r = requests.get("https://www.cardmarket.com/en/Magic/Products/Singles/Modern-Horizons-3") print(r.status_code) # 403 print(r.text[:200]) # ... <title>Attention Required! | Cloudflare</title> ... Cardmarket sits behind Cloudflare, which answers a script with 403. Sending the request through Scrape.do returns the real server-rendered page: 1 credit per page. Cloudflare sometimes refuses a request for a moment anyway; Scrape.do then answers 502 without charging it, so retry with a short pause.
import csv import re import time import requests TOKEN = "<your_token>" BASE = "https://www.cardmarket.com" def fetch(url, tries=5): for attempt in range(tries): r = requests.get("https://api.scrape.do/", params={"token": TOKEN, "url": url}, timeout=90) if r.status_code == 200: return r.text time.sleep(3 * (attempt + 1)) # 502 = Cloudflare said no this time, not charged r.raise_for_status() def price(text): """'1.234,56 €' -> 1234.56""" v = re.sub(r"[^\d,.]", "", text).replace(".", "").replace(",", ".") return float(v) if v else None Step 1: the set page in list mode
Add ?mode=list&sortBy=price_desc to a set URL and Cardmarket switches to a table of 30 cards per page, most expensive first, with &site=N for the next page. Every cell carries a data-testid, which makes the parsing short:
def cell(row, name): m = re.search(rf'data-testid="{name}"[^>]*>(.*?)</div>', row, re.S) return re.sub(r"<[^>]+>", "", m.group(1)).strip() if m else "" def set_page(expansion, page=1): url = f"{BASE}/en/Magic/Products/Singles/{expansion}?mode=list&sortBy=price_desc&site={page}" html = fetch(url) cards = [] for row in re.split(r'<div id="productRow\d+"', html)[1:]: link = re.search(r'data-testid="name"[^>]*>\s*<a href="([^"]+)"[^>]*>(.*?)</a>', row, re.S) rarity = re.search(r'data-testid="rarity".*?title="([^"]+)"', row, re.S) cards.append({ "name": link.group(2), "rarity": rarity.group(1) if rarity else "", "number": cell(row, "collector_number"), "available": int(re.sub(r"\D", "", cell(row, "availability")) or 0), "from_price": price(cell(row, "from_price")), "foil_from": price(cell(row, "price_from_foils")), "url": BASE + link.group(1), }) pages = int(re.search(r"Page \d+ of (\d+)", html).group(1)) return cards, pages Step 2: the whole set to CSV
cards, pages = set_page("Modern-Horizons-3") for page in range(2, pages + 1): cards += set_page("Modern-Horizons-3", page)[0] with open("mh3.csv", "w", newline="", encoding="utf-8") as fh: writer = csv.DictWriter(fh, fieldnames=cards[0].keys()) writer.writeheader() writer.writerows(cards) print(len(cards), "cards") Step 3: the price guide of one card
A card page holds the price guide in a <dl class="labeled"> list, the 30-day price chart as a Chart.js config, and the 50 cheapest offers as articleRow blocks:
def guide(url): html = fetch(url) dl = re.search(r'<dl class="labeled[^"]*"[^>]*>(.*?)</dl>', html, re.S).group(1) info = {re.sub(r"<[^>]+>", "", k).strip(): re.sub(r"<[^>]+>", "", v).strip() for k, v in re.findall(r"<dt[^>]*>(.*?)</dt>\s*<dd[^>]*>(.*?)</dd>", dl, re.S)} offers = [price(p) for p in re.findall( r'class="price-container.*?<span class="[^"]*fw-bold[^"]*">(.*?)</span>', html, re.S)] return { "available": info.get("Available items"), "from": price(info.get("From", "")), "trend": price(info.get("Price Trend", "")), "avg_30": price(info.get("30-days average price", "")), "offers": offers, } What a live run showed
All 10 list pages of Modern Horizons 3 gave the set's 300 singles for 10 credits. One cheapest copy of every card added up to €333.36, and the 10 most expensive cards made up 47% of that, while 204 cards started under €0.10. Opening those top 10 cards showed how far offers sit from the price guide: Ocelot Pride started at €32.45 against a €39.35 price trend, Flooded Strand at €11.00 against €15.23, and for 8 of the 10 cards every one of the 50 cheapest offers was below the trend. 20 pages in all, 20 credits; Cloudflare refused 6 requests along the way, and Scrape.do didn't charge them.
Limits to know
- The trend is not the floor. The price trend smooths recent sales; the cheapest offers can sit well under it. Compare both before you price anything.
- Logged-out pages show the 50 cheapest offers. Add Cardmarket's own filters (language, condition) to the product URL to narrow them.
- Prices use European formatting.
1.234,56 €is one thousand two hundred thirty-four euros.
Skip the code
The same scraper is an open-source package with a CLI:
pip install cardmarket-scraper export SCRAPEDO_TOKEN=<your_token> cardmarket-scraper -f csv -o mh3.csv set "Modern Horizons 3" --pages 0 cardmarket-scraper -f csv -o top.csv set "Modern Horizons 3" --details cardmarket-scraper set "Prismatic Evolutions" --game pokemon Source and tests: github.com/bugrahansss/cardmarket-scraper
Use the data responsibly
Card prices are public, but respect Cardmarket's terms, keep request rates low and don't republish seller data. The offers include sellers' usernames; leave them out of anything you publish.
Run it at scale with Scrape.do
Every page is one Scrape.do call: no proxy pool, no Cloudflare handling, no headless browser. A whole 300-card set costs 10 credits. Get 1000 free credits and start scraping with Scrape.do.

