【发布时间】:2019-10-28 15:28:18
【问题描述】:
我需要在 if 语句中使用 if 语句,我已经必须确定我的抓取程序何时单击下一个按钮,以便一旦发生这种情况我就可以做一些事情。当前的 if 语句只是确定页面上是否有下一步按钮。但我不知道如何确定下一个按钮何时被实际点击。
# Finds next page button
priority = response.meta['priority']
next_page = response.xpath('//a[contains(., "- Next>>")]/@href').get()
# If it exists and there is a next page enter if statement
if next_page is not None:
# Go to next page
yield response.follow(next_page, self.parse, priority=priority, meta={'priority': priority})
【问题讨论】:
标签: python web-scraping scrapy splash-screen