A detailed guide for web scraping https://finance.yahoo.com/ using Requests, BeautifulSoup, Selenium, HTML tags & embedded JSON data.
https://blog.jovian.ai/web-scraping-yahoo-finance-using-python-7c4612fab70c
Use following notebook : https://github.com/vinodvidhole/yahoo-finance-scraper/blob/main/yahoo-finance-web-scraper.ipynb
putting all code together : https://github.com/vinodvidhole/yahoo-finance-scraper/blob/main/yahooscraper.py