Scrapy框架: 使用cookies登录网站
import scrapy class LoginSpider(scrapy.Spider): name = 'login' allowed_domains = ['xxx.com'] start_urls = ['https://www.xxx.com/xx/'] cookies = "" def start_requests(self): for url in self.start_urls: yield scrapy.Request(url, cookies=self.cookies, callback=self.parse) def parse(self, response): with open("01login.html", "wb") as f: f.write(response.body)
相关推荐
Catastrophe 2020-05-30
ALiDan 2020-06-11
BlueSkyUSC 2020-03-08
zhujuyu 2020-02-12
gongruitao 2020-01-23
aweilark 2020-01-09
tiankele0 2020-01-05
四叶草 2020-01-04
xiaoyezihanghui 2019-12-25
四叶草 2019-12-25
似水流年梦 2019-12-19
xiaoxiaoniaoer 2019-12-01
ITxiaobaibai 2019-11-25
张艳秋 2019-11-18
xiyouiOS 2015-06-02
Qimingweikun 2019-11-04
StevenSun空间 2019-10-22