Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/kotlin/3.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 使用Beatiful Soup获取股票数据_Python_Web Scraping_Beautifulsoup_Stock - Fatal编程技术网

Python 使用Beatiful Soup获取股票数据

Python 使用Beatiful Soup获取股票数据,python,web-scraping,beautifulsoup,stock,Python,Web Scraping,Beautifulsoup,Stock,这是我的密码。问题是我不知道在find_all函数中放什么。如果你去我放在变量“URL”中的网站,你可以看到我想要的。我想在网站的底部有新闻标题。如果您需要更多信息,请告诉我。我们看不到您想要刮取的站点,因此我们不知道。你需要做的是看看你想要刮的东西是用什么html包装的,例如或,然后把“p”或“h”放在find_all中。但请在此处阅读更多内容,您仍然需要调查自己,找到您想要刮取的站点部分以及它们在站点中包装的html命令: from bs4 import BeautifulSoup impo

这是我的密码。问题是我不知道在find_all函数中放什么。如果你去我放在变量“URL”中的网站,你可以看到我想要的。我想在网站的底部有新闻标题。如果您需要更多信息,请告诉我。

我们看不到您想要刮取的站点,因此我们不知道。你需要做的是看看你想要刮的东西是用什么html包装的,例如或,然后把“p”或“h”放在find_all中。但请在此处阅读更多内容,您仍然需要调查自己,找到您想要刮取的站点部分以及它们在站点中包装的html命令:
from bs4 import BeautifulSoup
import requests

#ticker = input("Ticker: ")
ticker = "AAPL"
URL = f'https://uk.finance.yahoo.com/quote/{ticker}/news?p={ticker}'
page = requests.get(URL)
soup = BeautifulSoup(page.content, 'html.parser')
results = soup.find(id='YDC-Col1')

r = results.find_all('what do I put here', class_ = 'what do I put here')
print(r)
#print(results)