0

I am trying to parse below webpage to get name of stocks hitting now all time high or low in the exchange.

https://www.bseindia.com/markets/equity/EQReports/HighLow.html?Flag=H#

however, when i download the webpage using beautiful soup and check the data i do not find the stock name or price mentioned in the webpage. I wish to write a function to download the stocks that hit a new all time high each day please help what am i missing?

1
  • 1
    Please show what you’ve tried and explain what the specific problem was. Commented Feb 23, 2019 at 13:13

1 Answer 1

2

Part of the HTML on the page is generated dynamically by JavaScript. You are most likely using the requests library, which cannot handle HTML generated in this way.

What you can do, instead, is use the Selenium library, which allows you to launch an instance of a web browser controlled by Python, and get the page source from there.

from selenium import webdriver

path = '...' # path to driver here
url = 'https://www.bseindia.com/markets/equity/EQReports/HighLow.html?Flag=H#'

driver = webdriver.Chrome(path)
page_source = driver.get(url).page_source

By parsing page_source with BeautifulSoup, you can get what you want.

Sign up to request clarification or add additional context in comments.

2 Comments

thank you for the quick response however the page has 2 pages in it so 25 stocks on 1 page and 25 on another using above method i am able to parse first page only , the url is also same if i click on second page, please help how can i solve this ?
That is a separate question, I think @AnandShukla

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.