Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/287.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 从雅虎提取数据!用靓汤理财_Python_Web Scraping_Beautifulsoup_Yahoo Finance_Stock Data - Fatal编程技术网

Python 从雅虎提取数据!用靓汤理财

Python 从雅虎提取数据!用靓汤理财,python,web-scraping,beautifulsoup,yahoo-finance,stock-data,Python,Web Scraping,Beautifulsoup,Yahoo Finance,Stock Data,我目前正在尝试创建一个股票信息脚本。然而,我只能从股票的初始页面检索数据,而不能从关键统计页面检索数据。这是我试图从中获取数据的页面: 以下是我正在使用的代码:(主要来自我观看的视频) 股票代码AAPL的结果如下: 1.3T 24.52 11.89 Invalid parent for this element Invalid parent for this element Invalid parent for this element Invalid parent for this elem

我目前正在尝试创建一个股票信息脚本。然而,我只能从股票的初始页面检索数据,而不能从关键统计页面检索数据。这是我试图从中获取数据的页面:

以下是我正在使用的代码:(主要来自我观看的视频)

股票代码AAPL的结果如下:

1.3T
24.52
11.89
Invalid parent for this element
Invalid parent for this element
Invalid parent for this element
Invalid parent for this element
Invalid parent for this element
Invalid parent for this element
Invalid parent for this element
Invalid parent for this element
Invalid parent for this element
Invalid parent for this element

不太清楚为什么第二页没有被正确地刮取。。。我对靓汤不是很有经验。任何帮助都将不胜感激。

请参阅python模块主要问题是您使用
除了:
之外,您没有将得到的期望显示为ex:print(ex)除了异常之外-因此您不知道真正的问题是什么如果有什么东西出了问题,那么您应该显示它-即使用
print()
-然后您可以看到可能的错误。因此,显示
innerHTML
以查看您是否获得了正确的页面或带有机器人程序/脚本或验证码警告的HTML。
Selenium
具有
browser.page\u source
并且您不必使用
execute\u脚本(“return document.body.innerHTML”)
从8月17日起,这项功能仍然有效:
1.3T
24.52
11.89
Invalid parent for this element
Invalid parent for this element
Invalid parent for this element
Invalid parent for this element
Invalid parent for this element
Invalid parent for this element
Invalid parent for this element
Invalid parent for this element
Invalid parent for this element
Invalid parent for this element