This repository contains a Python scraper to extract real-time cryptocurrency prices from CoinMarketCap. The script uses the Crawlbase Smart Proxy to avoid IP blocks and bypass bot protections, ensuring reliable access to dynamic content.
It extracts data for the top 10 cryptocurrencies, including their name, symbol, and current price in USD, and saves the results to both CSV and JSON files.
β‘ Read the full blog here to learn more.
-
Scrapes top 10 crypto coins from CoinMarketCap
-
Extracts:
- Coin Name
- Symbol
- Price in USD
-
Stores data in:
crypto_prices.csvcrypto_prices.json
-
Uses Crawlbase Smart Proxy to bypass anti-scraping measures
- Install Python 3.7 or higher Check version:
python --version- Install Required Libraries
pip install requests beautifulsoup4- Get Your Crawlbase Smart Proxy Token Sign up at Crawlbase and get your Smart Proxy token.
- Update the Script
Replace
_USER_TOKEN_in the proxy URL with your actual Crawlbase token.
proxy_url = "http://_USER_TOKEN_:@smartproxy.crawlbase.com:8012"python coinmarketcap_crypto_data_scraper.pyThis will output two files in your directory:
crypto_prices.csvcrypto_prices.json
crypto_prices.json
[
{
"name": "Bitcoin",
"symbol": "BTC",
"price_usd": "$27,384.91"
},
...
]crypto_prices.csv
name, symbol, price_usd;
Bitcoin, BTC, $27, 384.91;
Ethereum, ETH, $1, 823.77;CoinMarketCap uses bot protection techniques that can block basic scrapers. Crawlbase Smart Proxy:
- Rotates IPs automatically
- Handles CAPTCHAs
- Provides fully rendered HTML for JavaScript-heavy pages
Learn more: Crawlbase Smart Proxy