网络抓取时'NoneType'对象没有属性'parent'

时间:2020-06-11 10:20:18

标签: python web web-scraping

source = requests.get(result_page).content
soup = BeautifulSoup(source,'lxml')
soup
product = soup.find('a', class_= '_2cLu-l').get('href')
product_url = website_url+product
product_url

运行良好。

source = requests.get(product_url).content
soup = BeautifulSoup(source, 'lxml')
reviews_url=soup.find('a',class_='swINJg _3nrCtb').parent.get('href')

此父级显示Nonetype错误

0 个答案:

没有答案