Skip to content

Scrape Trading Card Prices in Python: A Practical Workflow

Card marketplaces usually put the number you want behind JavaScript and bot protection. A plain HTTP request often returns a page shell with no price in it. The workflow below solves that by sending the card's public page to a scraping API that renders the page and returns the final HTML or structured fields, then parsing or storing the result in Python. It works across games and marketplaces, with official APIs as a shortcut where they exist.

What you need before you start

You need an API key for a rendering scraping service, Python 3.10 or newer, and the requests and beautifulsoup4 packages. Keep the key in an environment variable rather than in source code. Before writing any request, read the target site's Terms of Service and robots.txt, and plan a polite request rate. The worked example uses a public PriceCharting card page because it renders prices with JavaScript and shows both ungraded and PSA 10 values on one page. The fetching pattern transfers to other marketplaces; only the selectors change.

Step 1: Fetch the rendered page

A plain requests.get() against a card page usually returns HTML without the price. The marketplace renders the price after load, and many sites also sit behind anti-bot protection. The do-it-yourself route is a headless browser driven by Selenium or Playwright, but then you own browser installs, proxies, and the anti-bot cat-and-mouse. A scraping API handles that server-side: pass the card URL with render_js=true and it returns the fully rendered HTML. For sites that block datacenter IPs, add premium_proxy=true to route through residential proxies. The PriceCharting example rendered without the premium proxy, so it stays as the escalation path. The exact request contract is provided in the accompanying code module code0003.

Step 2: Parse the price with BeautifulSoup

On PriceCharting card pages, the ungraded market price sits in #used_price .price and the PSA 10 graded price in #manual_only_price .price. To find a selector yourself, right-click the price in a browser and choose Inspect. The parsing function grabs the node, strips the dollar sign and commas, and converts to a float. The critical detail is the None check: if the selector matches nothing, return None instead of crashing. The exact parsing contract is provided in code0005.

Step 3: Get clean fields with extract_rules

Hand-parsing works, but you can skip it. Pass extract_rules with a mapping of field names to CSS selectors, and the API applies them server-side and returns named JSON fields instead of raw HTML. Send the mapping as a JSON string and read the response with response.json(). The exact extraction contract is provided in code0007.

Step 4: Skip brittle selectors with AI extraction

CSS selectors break when a site changes its markup. AI extraction lets you describe the fields you want in plain English with ai_query and lets the API locate them. This survives small layout changes, but it infers fields rather than reading exact nodes. A fuzzy field such as "lowest listing price" can map to whatever the model thinks is closest; in the captured example it reused the ungraded price. Name fields precisely and spot-check the output. ai_query costs +5 credits on top of the base call. The exact AI extraction contract is provided in code0009.

Step 5: Scrape a whole set or watchlist

Scaling from a single card to a full collection is where the workflow pays off. Keep your card URLs in a list, request each one through the API, gather the returned records, and export the batch as CSV. The example paces requests with a short pause to respect rate limits; paid plans allow running them concurrently instead. The exact watchlist contract is provided in code0011.

Step 6: Handle missing prices, errors, and retries

A real watchlist will eventually hit a card page that does not exist or a transient server error. Wrap the request in a retry loop, check the HTTP status, and skip cards with no price instead of crashing the whole job. HTTP 500 responses are not charged credits, so retrying on a 500 is free. The exact retry contract is provided in code0013.

Schedule the tracker and keep price history

Price tracking over time needs a recurring run that records each result rather than replacing it. Point a scheduler at the watchlist script and let it write a fresh, timestamped entry to a CSV or database on every pass; after several weeks you have a series for the whole collection. A cron job plus a CSV or database is the simplest setup. The exact cron contract is provided in code0015. Whatever storage you pick, the timestamp column is what matters: appending a new row per run, instead of overwriting the previous value, is what converts a single snapshot into a chartable history you can use to read price trends. A no-code alternative is Google Sheets: for simple public pages, IMPORTXML can pull a price into a cell; for pages that need JavaScript rendering or block automated requests, call the scraping API from Apps Script on a schedule and write the returned price and timestamp into the sheet.

Stay unblocked as you scale

As you scrape more cards more often, blocks get more likely. Match the proxy tier to each request instead of paying for the heaviest option everywhere. Classic (datacenter) handles easy pages, Premium (premium_proxy=true) handles sites that block datacenter IPs, and Stealth (stealth_proxy=true) handles the hardest anti-bot sites. Credit cost scales with the tier: Classic runs 1 to 5 credits per request, Premium 10 to 25, and Stealth 75, with AI extraction adding 5 on top. HTTP 500 responses are not charged, so retries are safe. Keep request rates polite, cache anything you do not need for real-time pricing, and pay only for the tier a given source actually needs.

Which card price APIs exist, and when to scrape

A few games have official price APIs, but most do not, and the biggest marketplace's API is closed. For Magic, Scryfall is free. For Pokémon, the Pokémon TCG API is free and returns prices sourced from TCGplayer and Cardmarket. PriceCharting has a paid API covering many games plus graded prices. There is no broad open API covering every game, and sports card and Yu-Gi-Oh price APIs are limited or unofficial. Scraping fills most of that gap: any game, most marketplaces, and fields an API does not expose. eBay is the notable exception; use its approved API rather than scraping. The legal directory table below summarizes each source.

API caveats worth knowing

Two API caveats matter before you depend on them. The Pokémon TCG API's free tier is still live and still serves TCGplayer and Cardmarket price snapshots with a free key, but its maintainers are shifting development toward a commercial successor (Scrydex), so treat free access as a convenience rather than a guarantee and cache the responses you keep. Scryfall is free but asks callers to stay polite, around 10 requests per second with 50 to 100 ms between calls. eBay is the exception to the scraping route: its User Agreement restricts automated access, so use the approved API instead. For every other source, reading the public page is the dependable path. TCGplayer illustrates why: its pricing-data policy has kept the developer API shut to new applicants since roughly late 2024, leaving public pages as the practical way to read its live prices.

Is it legal to scrape trading card prices?

In the United States, reading prices that are openly displayed on a card page is generally treated as lawful, and courts have interpreted the Computer Fraud and Abuse Act (CFAA) — the primary anti-hacking statute — in a narrow way. None of this is legal advice, though. A marketplace's Terms of Service may still prohibit automated collection, the rules vary from country to country, and the analysis changes entirely for data that requires an account. The dividing line that matters in practice is public versus login-gated: a price on an open product page can be read, while anything visible only after signing in cannot. Before you begin, review the target site's Terms and its robots.txt, throttle your requests so you are not straining the server, and cache values you do not need to refresh. Breaching a Terms of Service is normally a contractual dispute between you and the site rather than a criminal matter, but it can still result in your access being revoked. One rule worth making your own: never scrape behind a login.

Card price sources and how to get their prices
SourceGamesOfficial API?CostHow to get prices
ScryfallMagic: The GatheringYes (free)FreeFree API (shortcut for Magic)
Pokémon TCG APIPokémonYes (free, key)Free tierFree API returning TCGplayer and Cardmarket prices
PriceChartingMulti-game + gradedYes (paid)SubscriptionPaid API, or scrape the public page
TCGplayerMulti-game marketplaceClosed to new devsn/aScrape public pages (API closed to new applicants)
CardmarketMulti-game (EU)No open APIn/aScrape public pages politely
eBay sold listingsAll (real sales)Yes (approval)VariesUse eBay's approved API; scraping eBay is restricted by its User Agreement

API availability and access terms are a dated reference captured from the original page and may have changed; verify current terms with each source before building on them.

Frequently asked questions

Is there a Pokémon card price API?

Yes. A free tier of the Pokémon TCG API serves Pokémon card data alongside prices drawn from TCGplayer and Cardmarket. When you need a game or marketplace outside its coverage, or a field it does not return, fall back to scraping the public price page with a rendered request.

Is there a TCG, sports card, or Yu-Gi-Oh price API?

Partly. Scryfall covers Magic and the Pokémon TCG API covers Pokémon, but no broad open API spans every game, and TCGplayer's own developer API has been shut to new applicants since roughly late 2024. Sports card and Yu-Gi-Oh price APIs are limited or unofficial, so scraping public price pages is the dependable cross-game route.

Why does my Python scraper return no price?

Card pages typically inject the price with JavaScript once the document has loaded, so a bare requests call receives markup that never contained the figure. The fix is to execute the page first — either through a headless browser you control or through a scraping API that runs JavaScript server-side — and then parse the resulting rendered HTML.

Is it legal to scrape trading card prices?

Reading prices that a site shows openly is usually treated as lawful in the US, and courts have tended to interpret the primary anti-hacking statute narrowly. That is not legal advice, though: a marketplace's Terms of Service may still prohibit automated collection, the rules vary by country, and data behind a login is off limits. Review the target site's Terms and robots.txt before you start.

How do I scrape card prices into Google Sheets?

When the page is simple, IMPORTHTML or IMPORTXML can bring a public price straight into a spreadsheet cell. When the page needs JavaScript rendering or rejects automated requests, call a web scraping API from Apps Script on a schedule and write the returned price into a cell. A small tracking app built with Apps Script or a lightweight front end can then read those values back out of Google Sheets and display them.

How often can I refresh prices without getting blocked?

Stay courteous: add spacing between requests, switch to residential or stealth proxies for sites that block aggressively, and cache any price you do not need in real time. For a large collection, refreshing once or a few times per day is typically sufficient, which keeps both your block rate and your spending under control.

{
  "name": "Charizard #4 Pokemon Base Set",
  "ungraded_price": "$437.00",
  "grade_9_price": "$2,922.36",
  "psa10_price": "$30,100.00"
}
{
  "card_name": "Charizard #4",
  "ungraded_market_price": "$437.00",
  "lowest_listing_price": "$437.00",
  "psa_10_graded_price": "$30,100.00"
}