1、声明Request
from scrapy.http import Request
1、设置Request的headers
yield Request(url,headers={'User-Agent': "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36"})
2、设置Request的cookie
yield Request(url, meta={'item': i}, callback=self.parse_inner, dont_filter=True,cookies={})
网友评论