Skip to content

Instantly share code, notes, and snippets.

@Jzarecta
Created March 4, 2020 00:43
Show Gist options
  • Save Jzarecta/63d0d4da9304925003f7755a1aa167f5 to your computer and use it in GitHub Desktop.
Save Jzarecta/63d0d4da9304925003f7755a1aa167f5 to your computer and use it in GitHub Desktop.
Grab the data from CMC
import requests, time
from bs4 import BeautifulSoup
from selenium import webdriver
import cryptocurrencies
BASE_URL = 'http://coinmarketcap.com/currencies/'
CUR_URL = 'bitcoin' # This will be cycled
ATTR_URL = '/historical-data/?start=20130428&end=20200303'
page = BASE_URL+CUR_URL+ATTR_URL
print(page)
browser = webdriver.Firefox()
time.sleep(3)
browser.get(page)
time.sleep(5)
html = browser.page_source
pages = BeautifulSoup(html, 'html.parser')
table = pages.find_all('td', {"class":"cmc-table__cell"})
# print(table[4].find("div", {"class": ""}).get_text())
for result in table:
print(result.find("div", {"class":""}).get_text())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment