If you’re involved in crypto trading, building dashboards, or conducting market research, obtaining real-time cryptocurrency prices is crucial. While CoinMarketCap provides a significant amount of this data on its website, it does not offer a free and open API for live prices. That’s where web scraping becomes useful.

In this article, we’ll show you how to scrape live crypto prices from CoinMarketCap using Python. We’ll guide you through sending requests, parsing HTML, and extracting data for popular cryptocurrencies like Bitcoin, Ethereum, and other top coins. You’ll also learn how to avoid getting blocked by using tools like Crawlbase Smart Proxy and how to export your data for future use.

Let’s get started.

Table of Contents

  1. Why Scrape CoinMarketCap for Crypto Prices?
  2. Tools You Need to Get Started
  • Python & Required Libraries
  • Installing BeautifulSoup and Requests
  1. Step-by-Step Guide to Scrape Crypto Prices on CoinMarketCap
  • Send HTTP Request to CoinMarketCap
  • Parse the HTML with BeautifulSoup
  • Extract Live Crypto Prices
  1. Avoid Getting Blocked: Use Crawlbase Smart Proxy
  2. Export the Data to CSV or JSON
  3. Final Thoughts
  4. Frequently Asked Questions

Why Scrape CoinMarketCap for Crypto Prices?

CoinMarketCap is the most popular website for tracking cryptocurrency prices, market cap, volume, and rankings. It updates prices in real-time and has thousands of coins. It’s the go-to source for crypto data.

However, CoinMarketCap’s official API has limits on free access, and real-time data requires a paid plan. If you’re a developer, researcher, or crypto enthusiast looking for free and flexible access to live price data, web scraping is the way to go.

Scraping cryptocurrency prices from CoinMarketCap can be very useful for various purposes. The following image illustrates some common use cases with their corresponding examples for Crypto Price Scraping.

Common Usecases of Crpto Price Data

With Python, BeautifulSoup, and smart proxies, you can extract this data easily and reliably without paying for expensive APIs.

Tools You Need to Get Started

Before we scrape crypto prices from CoinMarketCap, let’s set up the tools and libraries we need. We’ll use Python because it’s simple, powerful, and has great libraries for web scraping.

Python & Required Libraries

Make sure you have Python installed. You can download it from python.org.

We’ll use two main Python libraries:

  • Requests – to send HTTP requests and get the HTML of the page
  • BeautifulSoup – to parse and extract data from the HTML

🔧 Installing BeautifulSoup and Requests

You can install both libraries using pip, which is Python’s package manager. Open your terminal or command prompt and run:

1
pip install requests beautifulsoup4

Once installed, you’re ready to start scraping crypto data from CoinMarketCap.

Step-by-Step Guide to Scrape Crypto Prices on CoinMarketCap

Now that your setup is ready, let’s scrape real-time cryptocurrency prices from CoinMarketCap. We’ll go step by step using Python and BeautifulSoup.

Send HTTP Request to CoinMarketCap

First, we need to send a request to the CoinMarketCap website and get the page content.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
import requests

url = "https://coinmarketcap.com/"
headers = {
"User-Agent": "Mozilla/5.0"
}

response = requests.get(url, headers=headers)

# Check if request was successful
if response.status_code == 200:
print("Page loaded successfully!")
else:
print("Failed to load page.")
Always use headers like User-Agent to mimic a real browser.

Parse the HTML with BeautifulSoup

Once we have the page content, we can parse it using BeautifulSoup.

1
2
3
from bs4 import BeautifulSoup

soup = BeautifulSoup(response.text, "html.parser")

Extract Live Crypto Prices from CoinMarketCap

Let’s extract the name and current price of the top 10 cryptocurrencies.

CoinMarketCap uses dynamic HTML classes, so you may need to inspect the page source to adjust the class names.

Here’s a working example:

1
2
3
4
5
6
7
# Find the table rows that contain the coins
rows = soup.select("table tbody tr")

for row in rows[:10]: # Top 10 coins
name = row.select_one("p.coin-item-name").text
price = row.select_one("div.sc-142c02c-0.lmjbLF").text
print(f"{name}: {price}")

Output:

1
2
3
4
5
6
7
8
9
10
Bitcoin: $92,477.64
Ethereum: $1,744.77
Tether: $1.00
XRP: $2.14
BNB: $596.63
Solana: $146.85
USDC: $1.00
Dogecoin: $0.1732
Cardano: $0.6866
TRON: $0.2439

Note: Class names are subject to frequent changes. You can always right-click → “Inspect” on the page to check the updated class names

Avoid Getting Blocked: Use Crawlbase Smart Proxy

CoinMarketCap uses protection like Cloudflare to block bots. If you send too many requests, your IP can get blocked. To fix this, use Crawlbase Smart Proxy. It helps you scrape data without getting blocked or dealing with captchas. Additionally, you don’t need to worry about manually rotating IPs, as it’s all handled for you.

How to Use Crawlbase Smart Proxy in Python

Here’s a simple example using requests:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import requests
import time

# Replace with your Crawlbase token
token = "_USER_TOKEN_"
proxy_url = f"http://{token}:@smartproxy.crawlbase.com:8012"
proxies = {
"http": proxy_url,
"https": proxy_url
}

# CoinMarketCap URL
url = "https://coinmarketcap.com/"

# Optional: Wait before request
time.sleep(2)

# Send request using Smart Proxy
response = requests.get(url, proxies=proxies, verify=False)

if response.status_code == 200:
print("Request successful!")
else:
print("Request failed:", response.status_code)

You can get a token by signing up on Crawlbase. With Crawlbase Smart Proxy, your scraper stays stable and unblocked—even on sites with strong protections.

Exporting the Data to CSV or JSON

In this section, we’ll see how to export cryptocurrency data from CoinMarketCap to both CSV and JSON formats. This is useful when you want to store the data or analyze it later. We will also use Crawlbase Smart Proxy to prevent being blocked while scraping.

Steps:

  1. Use Crawlbase Smart Proxy to send requests to CoinMarketCap.
  2. Extract cryptocurrency data, including name, symbol, and price.
  3. Export the data to CSV and JSON formats.

Here’s the complete code to accomplish this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import requests
from bs4 import BeautifulSoup
import csv
import json

# 🛡️ Crawlbase Smart Proxy setup
proxy_url = "http://_USER_TOKEN_:@smartproxy.crawlbase.com:8012"
proxies = {"http": proxy_url, "https": proxy_url}

# 🌐 CoinMarketCap URL
url = "https://coinmarketcap.com/"

# 📥 Send HTTP request using Crawlbase Smart Proxy
headers = {
"User-Agent": "Mozilla/5.0"
}
response = requests.get(url, headers=headers, proxies=proxies, verify=False)
soup = BeautifulSoup(response.text, "html.parser")

# 🧠 Extract cryptocurrency data (Top 10 coins)
crypto_data = []

# Select table rows containing the crypto data
rows = soup.select('table.cmc-table tbody tr')[:10] # Get data for top 10 coins

# Loop through each row and extract the necessary data
for row in rows:
try:
name = row.select_one("p.coin-item-name").text.strip()
symbol = row.select_one('p.coin-item-symbol').text.strip()
price = row.select_one("div.sc-142c02c-0.lmjbLF").text.strip()

crypto_data.append({
"name": name,
"symbol": symbol,
"price_usd": price
})
except Exception as e:
print("Skipping a row due to error:", e)

# ✅ Export data to CSV file
with open("crypto_prices.csv", "w", newline="") as csv_file:
writer = csv.DictWriter(csv_file, fieldnames=["name", "symbol", "price_usd"])
writer.writeheader()
writer.writerows(crypto_data)

# ✅ Export data to JSON file
with open("crypto_prices.json", "w") as json_file:
json.dump(crypto_data, json_file, indent=2)

print("✅ Crypto prices have been saved to 'crypto_prices.csv' and 'crypto_prices.json'")

This way, you can scrape data from CoinMarketCap without getting blocked, and the data export feature makes it easy to save and analyze later. If you need to scrape more data or automate the process, just adjust the logic accordingly.

Final Thoughts

Scraping cryptocurrency prices from CoinMarketCap using Python is a smart way to stay up-to-date with the volatile financial markets. With just a few lines of code, you can track live prices, export data, and use it for analysis or building crypto tools.

However, remember that websites like CoinMarketCap have built-in anti-bot protections. That’s why using tools like Crawlbase Smart Proxy is very helpful. It keeps your scraping smooth and avoids IP blocks and captchas.

Whether you’re a developer, trader, or data analyst, this guide gives you a simple way to get started with crypto data scraping using Python. Sign up now.

Frequently Asked Questions

Scraping public data from CoinMarketCap is generally allowed for personal or educational use. However, always check their Terms of Service before using scraped data for commercial projects to avoid any legal issues.

Q. Why do I get blocked while scraping CoinMarketCap?

CoinMarketCap utilizes security tools, such as Cloudflare, to block bots. If you send too many requests from the same IP address, you may face CAPTCHAs or blocks. To solve this, use Crawlbase Smart Proxy,, which automatically rotates IPs and bypasses bot protection.

Q. How often can I scrape crypto prices?

If you’re scraping manually, it’s safe to fetch data every few minutes to avoid getting blocked. With Crawlbase Smart Proxy, you can scale scraping with better speed and frequency, making it ideal for tracking live crypto data.