【发布时间】:2023-03-27 00:14:01
【问题描述】:
我正在尝试使用 Python->Beautiful Soup 解析网页,加载大约 2 秒后的文本仅出现: [1]Here is the Image about the HTML about the extract
我正在尝试提取突出显示(已售罄)的内容。
price = soup.find('button', attrs={'class':'ncss-btn-primary-dark'})
但是我有一个错误代码
price = soup.find('button', attrs={'class':'ncss-btn-primary-dark btn-lg btn-lg disabled'}).text AttributeError: 'NoneType' object has no attribute 'text'
我怎样才能从上面显示的图像中获取文本 Sold Out?还是我需要一些东西来等待文本显示才能找到它?
【问题讨论】:
-
检查这个答案 -> stackoverflow.com/a/22284921/8150371
-
网址是什么?
标签: python beautifulsoup find extract error-code