get" attributeError:'nontype'对象没有属性'find_all'"试图通过python代码刮擦时"。
from bs4 import BeautifulSoup
import requests
page = requests.get("https://deathtimeline.com/")
soup = BeautifulSoup(page.content, 'html.parser')
deaths_list = soup.find(id="main-list")
deaths = deaths_list.find_all(class_="episode-deaths")
episode1 = deaths[0]
print(episode1.prettify())
您没有获得主列表的原因是因为网站(" https://deathtimeline.com/"( 已加载JavaScript。如果您检查页面的内容。包含或查看网站的来源,则只能看到JS代码。
Beautifutsoup不执行JavaScript,因此提供的任何数据或 如果您与 美丽的小组。
您可以尝试使用 Selenium 获取JS加载页