摘要: pip install scrapy-redisscrapy genspider -t crawl xxx www.xxx.com class ChoutiSpider(RedisCrawlSpider): name = 'chouti' # allowed_domains = ['www.chouti.com'] # start_urls = ['http://www.ch... 阅读全文
posted @ 2019-05-16 21:36 Mr_Smith 阅读(172) 评论(0) 推荐(0)
摘要: 1.创建scrapy工程:scrapy startproject projectName 2.创建爬虫文件:scrapy genspider -t crawl spiderName www.xxx.com # -*- coding: utf-8 -*- import scrapy from scra 阅读全文
posted @ 2019-05-16 13:11 Mr_Smith 阅读(619) 评论(0) 推荐(0)
摘要: class MovieSpider(scrapy.Spider): name = 'movie' allowed_domains = ['www.id97.com'] start_urls = ['http://www.id97.com/'] def parse(self, response): div_list = response.xpath... 阅读全文
posted @ 2019-05-16 11:24 Mr_Smith 阅读(882) 评论(0) 推荐(0)
摘要: 增加并发: 默认scrapy开启的并发线程为32个,可以适当进行增加。在settings配置文件中修改CONCURRENT_REQUESTS = 100值为100,并发设置成了为100。 降低日志级别: 在运行scrapy时,会有大量日志信息的输出,为了减少CPU的使用率。可以设置log输出信息为INFO或者ERROR即可。在配置文件中编写:LOG_LEVEL = ‘INFO’... 阅读全文
posted @ 2019-05-16 11:18 Mr_Smith 阅读(191) 评论(0) 推荐(0)