Need help web scraping | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
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 Resposta
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