所以我想做一个刮刀和刮痧玩蒸汽游戏。我不知道为什么有些游戏没有显示在结果csv/json中。我想是因为年龄验证表。在
我真的想知道问题出在哪里。。。但一切似乎都应该奏效。有人能帮忙吗?在
我注意到回调将返回相同的agecheck链接,dupefilter将删除该链接。所以这场比赛永远不会被淘汰。在
示例游戏:盗墓贼的崛起,厄运。在
代码如下:
def parse_product(self, response):
# Circumvent age selection form.
if '/agecheck/app' in response.url:
logger.debug(f"Form-type age check triggered for {response.url}.")
form = response.css('#agegate_box form')
action = form.xpath('@action').extract_first()
name = form.xpath('input/@name').extract_first()
value = form.xpath('input/@value').extract_first()
formdata = {
name: value,
'ageDay': '21',
'ageMonth': '5',
'ageYear': '1975'
}
yield FormRequest(
url=action,
method='POST',
formdata=formdata,
callback=self.parse_product
)
else:
yield load_product(response)
Steam将提交此表单的结果存储在
lastagecheckage
和birthtime
,cookies中,因此您可能需要在scrapy项目上启用cookie,或者在使用cookies属性创建Request
或FormRequest
时将其作为自定义值传递。在您可以阅读有关如何发送cookies的更多信息on the scrapy documentation
相关问题 更多 >
编程相关推荐