Cookie的使用
import scrapy
class CookieSpider(scrapy.Spider):
name = "爬虫名"
allowed_domains = ["域名.com"]
start_urls = ["url地址"]
def start_requests(self):
for url in self.start_urls:
cookie = {
将cookie转换成字典
}
yield scrapy.Request(url, cookies=cookie)
def parse(self, response):
price = response.xpath('//span[@class="price_em2"]/text()').get()
print('----------------------------')
print(price)
print('----------------------------')
标签:self,Request,scrapy,start,Scrapy,Cookie,print,price From: https://www.cnblogs.com/jiangjiayun/p/17503128.html