没有在 Python 中使用 Requests 和 BeautifulSoup 从网站获取所有数据

问题描述 投票:0回答:0

我正在使用 BS 和请求抓取 yfinance 的历史数据。我正在抓取的表有 250 行数据,从 16 Feb,2023 到 17 Feb, 2022 但是我只得到 100 行数据,从 16 Feb 2023 到 27 Sep 2022。我试过用 html、html5lib 和 lxml 进行解析,但我仍然得到 100 行数据。

url-https://uk.finance.yahoo.com/quote/HSBC/history?period1=1645349926&period2=1676885926&interval=1d&filter=history&frequency=1d&includeAdjustedClose=true

我已经尝试使用 html、html5lib 和 lxml 进行解析,但我仍然得到 100 行数据。 到目前为止,这是我的代码

`导入请求 从 bs4 导入 BeautifulSoup 将熊猫导入为 pd headers = {"user-agent" : "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/110.0"}

url = "https://uk.finance.yahoo.com/quote/HSBC/history?period1=1645349926&period2=1676885926&interval=1d&filter=history&frequency=1d&includeAdjustedClose=true"

response = requests.get(url, headers = headers) html = response.content

soup = BeautifulSoup(html, 'html5lib')

打印(response.status_code)`

python web-scraping beautifulsoup python-requests yahoo-finance
© www.soinside.com 2019 - 2024. All rights reserved.