scrapyダイナミックパラメータ
824 ワード
scrapy crawl baidu-a taskname="台北"-a bound="{"left":116.2292032777476964,"right":116.318":39.7100072717141,"bottom":39.7488012939301}-a seed="136.2,36.44"
class QiubaiSpider(scrapy.Spider):
name = 'baidu'
allowed_domains = ['www.baidu.com']
start_urls = ['https://www.baidu.com/']
task_name = "ooo"
bound = {}
seed = []
def __init__(self, taskname=None, bound=None, seed=None, *args, **kwargs):
super(QiubaiSpider, self).__init__(*args, **kwargs)
# self.start_urls = ['http://www.example.com/categories/%s' % category]
self.task_name = taskname
self.bound = json.loads(bound)
self.seed =[float(i) for i in seed.split(',')]
def parse(self, response):
pass