In advance: Sorry for any bady formatting, this is my very first post!
I'm trying to create a program that scrapes "CoinMarketCap" and compares the prices from a South African exchange (Luno) and all the other Bitcoin exchanges.
Sadly, it doesn't work on the https://coinmarketcap.com/de/currencies/bitcoin/markets/ page. It works on the https://coinmarketcap.com/de/exchanges/luno/ page though.
Any suggestions? Here is my code:
from bs4 import BeautifulSoup
import requests
from time import sleep
from random import randint
def scrapeWebsite(link):
headers = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36'}
results = requests.get(link, headers=headers)
src = results.content
soup = BeautifulSoup(src,features="html.parser")
items = []
print(soup.prettify())
for tr in soup.find_all("tr"):
line = ""
for td in tr.find_all("td"):
line = line + td.text + "/"
if(td.text == "Kürzlich"):
items.append(line)
return items
itemsLuno = scrapeWebsite("https://coinmarketcap.com/de/currencies/bitcoin/markets/")
#Coins on Luno are: Bitcoin, Ethereum, Litecoin and ripple
for item in itemsLuno:
print(item)