【发布时间】:2021-01-23 17:07:46
【问题描述】:
请见下文。我想搜索位于
中的餐厅名称 大力水手请参阅下图了解本网站的 HTML。
谁能告诉我如何使用 Beautiful Soup 或任何其他网络抓取包在 Python 上抓取餐厅名称“Popeyes”?
提前致谢!
下面是我用来抓取数据的代码,但是,它停在了那里,我无法继续前进。 ''' from bs4 import BeautifulSoup as soup # HTML 数据结构 from urllib.request import urlopen as uReq # Web 客户端
# URl to web scrape from.
# in this example we web scrape graphics cards from Newegg.com
page_url = "https://www.doordash.com/store/popeyes-toronto-254846/en-CA"
# opens the connection and downloads html page from url
uClient = uReq(page_url)
# parses html into a soup data structure to traverse html
# as if it were a json data type.
page_soup = soup(uClient.read(), "html.parser")
uClient.close()
page_soup.div'''
【问题讨论】:
-
请以文本而不是图像的形式提供代码。
-
嗨,M Z,感谢您的回复。当我复制它时,HTMl 似乎很长,所以我认为直接向您发送链接可能更有效。下面是我试图浏览的链接,我现在只想要餐厅名称,最后是餐厅的评级和类型。 doordash.com/store/popeyes-toronto-254846/en-CA
-
SO 不是编码服务。您必须先尝试一下,如果遇到困难,请发布您的代码并告诉我们您的问题出在哪里。见How do I ask a good question?
标签: python web-scraping beautifulsoup web-crawler