Python 无法使用bs4从BSE网站上刮取特定信息

Python 无法使用bs4从BSE网站上刮取特定信息,python,web-scraping,beautifulsoup,Python,Web Scraping,Beautifulsoup,我正试图从网站上获取以前的收盘价和开盘价。这里有一个图像作为要刮取的信息所在位置的参考 看起来特定的表是class=col-lg-13的div标记的子表,但是bs4在所有查找它的尝试中都只返回None 我尝试了以下方法: from bs4 import BeautifulSoup import requests link = "https://bseindia.com/stock-share-price/bharat-gears-ltd/bharatgear/505688/" resp =

我正试图从网站上获取以前的收盘价和开盘价。这里有一个图像作为要刮取的信息所在位置的参考

看起来特定的表是class=col-lg-13的div标记的子表,但是bs4在所有查找它的尝试中都只返回None

我尝试了以下方法:

from bs4 import BeautifulSoup
import requests

link = "https://bseindia.com/stock-share-price/bharat-gears-ltd/bharatgear/505688/"
resp = requests.get(link).content
soup = BeautifulSoup(resp, "lxml")

box = soup.find('div', class_="col-lg-13")
table = box.find('table')
print(table)

>>> None
我也试过:

container = soup.find('div', attr={'ng-init': "fnStockTrading()"})
tables = container.find_all('table')
print(tables)

>>> []

使用与页面用于数据的API相同的url。这可以在网络选项卡中找到

import requests
r = requests.get('https://api.bseindia.com/BseIndiaAPI/api/getScripHeaderData/w?Debtflag=&scripcode=505688&seriesid=').json()
prev_close = r['Header']['PrevClose']
prev_open = r['Header']['Open']
print(prev_close, prev_open)

使用与页面用于数据的API相同的url。这可以在网络选项卡中找到

import requests
r = requests.get('https://api.bseindia.com/BseIndiaAPI/api/getScripHeaderData/w?Debtflag=&scripcode=505688&seriesid=').json()
prev_close = r['Header']['PrevClose']
prev_open = r['Header']['Open']
print(prev_close, prev_open)