There is a website like bonbast.com and I’m trying to get values but I’m just confused about how to do it. Values should be something like the output of "US Dollar" and "Euro".
My code:
import requests
from bs4 import BeautifulSoup
r = requests.get("https://bonbast.com/")
soup = BeautifulSoup(r.content, "html.parser")
usd1 = soup.find(id="usd1")
print(usd1)
same_val = soup.find_all(class_="same_val")
print(same_val)
the output is blank and not showing the number of the currency. HTML page https://i.imgur.com/NrTaUY8.png
2
Answers
That page is filled by Javascript, that’s not somthing BS can scrape.
You’ll need to use a browser like app like selenium, here is an example:
With the result:
From the Reference of this Repo – https://github.com/drstreet/Currency-Exchange-Rates-Scraper/blob/master/scrapper.py
Focusing only on the necessary parts to retrieve exchange rates USD and Euro.
output