把起始URL放到Redis中去
2021-02-02 02:16
标签:lse 源码 span else pop isp ide als start 把起始URL放到Redis中去 标签:lse 源码 span else pop isp ide als start 原文地址:https://www.cnblogs.com/xiongfanyong/p/13173645.html把起始URL放到redis中去
from scrapy_redis.spiders import RedisSpider
# 继承RedisSpider
class ChoutiSpider(RedisSpider):
name = ‘chouti‘
allowed_domains = [‘chouti.com‘]
配置文件:
REDIS_START_URLS_KEY = ‘%(name)s:start_urls‘
REDIS_START_URLS_AS_SET = False
下面是源码
# use_set = self.settings.getbool(‘REDIS_START_URLS_AS_SET‘, defaults.START_URLS_AS_SET)
# fetch_one = self.server.spop if use_set else self.server.lpop
下一篇:CSS3动画