beautifulsoup - 检查一个按钮是否被 Beautifulsoup 禁用?
问题描述
有没有办法检查一个按钮是否被漂亮的汤禁用。我正在尝试抓取 Airbnb 页面,我想检查是否有下一页。我试过了 :
def findNextPage(soupPage):
''' Finds the next page with listings if it exists '''
if not(soupPage.find("div", {"class": "_jro6t0"}).find("button", {"class": "_za9j7e"}, attrs={"disabled"})):
return "https://airbnb.com" + soupPage.find("div", {"class": "_jro6t0"}).find("a")["href"]
else:
return "no next page"
解决方案
推荐阅读
- php - Wordpress/PHP:设置 cookie 不起作用
- deep-learning - 如何在 Pytorch 中批量调用函数
- mysql - 给定“从 t 中选择 a,b,c”形式的 SQL 语句及其输出,你能确定表 t 中的列数吗?
- function - 如何重新执行 Rust 主函数?
- spring-boot - 未使用 springboot 在 Cassandra db 中创建的表
- python - 如何让 Python 只接受用户提示的列表的特定条目。
- java - 加载一个实现另一个类的类 - Java
- kubernetes - 带有 gcloud sql postgres 的 GKE:sidecar 代理设置不起作用
- php - laravel 查询不会在本地和生产上返回相同的结果
- f# - 管还是不管?