Skip to content

ScraperHub/coinmarketcap-crypto-data-scraper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 

Repository files navigation

crawling-api-cta

coinmarketcap-crypto-data-scraper

πŸ“ Description

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.

πŸ“¦ Features

  • Scrapes top 10 crypto coins from CoinMarketCap

  • Extracts:

    • Coin Name
    • Symbol
    • Price in USD
  • Stores data in:

    • crypto_prices.csv
    • crypto_prices.json
  • Uses Crawlbase Smart Proxy to bypass anti-scraping measures

πŸ’» Environment Setup

  1. Install Python 3.7 or higher Check version:
python --version
  1. Install Required Libraries
pip install requests beautifulsoup4

πŸš€ How to Run

  1. Get Your Crawlbase Smart Proxy Token Sign up at Crawlbase and get your Smart Proxy token.
  2. Update the Script Replace _USER_TOKEN_ in the proxy URL with your actual Crawlbase token.
proxy_url = "http://_USER_TOKEN_:@smartproxy.crawlbase.com:8012"

3. Run the Scraper

python coinmarketcap_crypto_data_scraper.py

This will output two files in your directory:

  • crypto_prices.csv
  • crypto_prices.json

πŸ§ͺ Sample Output

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;

πŸ›‘ Why Use Crawlbase Smart Proxy?

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

About

CoinMarketCap.com Crypto Data Scraper. To handle CAPTCHAs, we are using Crawlbase Smart Proxy.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages