我正在抓取一个网站链接“https://homeshopping.pk/search.php?q=samsung%20phones”。我发现很难进入 div 课程之一。我认为它的格式不正确。问这个问题的原因是为了确认它是否格式不正确或者我做错了什么。
截图是:
from bs4 import BeautifulSoup as soup # HTML data structure
from urllib.request import urlopen as uReq # Web client
page_url = "https://homeshopping.pk/search.php?q=samsung%20phones"
uClient = uReq(page_url)
page_soup = soup(uClient.read(), "html.parser")
uClient.close()
print(page_soup)
# finds each product from the store page
container1 = page_soup.find_all("div", {"class": "findify-container findify-search findify-widget-2"})
len(container1)
print(container1)
相关分类