Need help web scraping | Sololearn: Learn to code for FREE!

0

Need help web scraping

Want to print price of stock Inspect element is below 👇 <div class="tv-symbol-price-quote__value js-symbol-last">1.1850<span class=""><sup>3</sup></span></div> So i code for it below 👇 import bs4 from bs4 import BeautifulSoup import requests page= requests.get("https://in.tradingview.com/symbols/EURUSD") soup = BeautifulSoup(page.text,'html.parser') k = soup.find_all('div', class_='tv-symbol-price-quote__value js-symbol-last') print(k) #But output does not print the price 😥

8/20/2020 4:57:30 AM

ғᴜɴ 3x

1 Answer

New Answer

0

You are doing everything correctly to scrape a static website. The problem is this website loads data using JS and it's impossible to scrape that using bs4. You can check if what you want to scrape is possible by disabling js in your browser on that webpage, if you can still see it then bs4 will work. To scrape data loaded by JS you can try an automated browser like selenium.