小编Aak*_*ane的帖子

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

我试图从这个网站上抓取之前的收盘价和开盘价。这是一张图像,作为要抓取的信息所在位置的参考。

股票信息表

看起来特定表是带有 的div标签的子表class="col-lg-13",但 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
Run Code Online (Sandbox Code Playgroud)

我也试过:

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

>>> []
Run Code Online (Sandbox Code Playgroud)

python beautifulsoup web-scraping

1
推荐指数
1
解决办法
341
查看次数

标签 统计

beautifulsoup ×1

python ×1

web-scraping ×1