Need help web scraping | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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 😥

20th Aug 2020, 4:57 AM
ғᴜɴ 3x
ғᴜɴ 3x - avatar
1 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.
20th Aug 2020, 5:23 AM
JME