Python Scrapy在start_url中打印start_url或变量

时间:2017-02-17 21:05:42

标签: python python-2.7 scrapy

试图产生"数字"或者可能得到start_url然后解析start_url以获得数字:

class EbaypriceSpider(Spider):
    name = "ebayprice"
    allowed_domains = ["www.ebay.com"]
    start_urls = []
    with open('Numbers.csv', 'rb') as omcan_numbers:
        number_list = csv.reader(omcan_numbers)
        for number in number_list: 
            start_urls.append('http://www.ebay.com/sch/Omcan' + str(number))


    def parse(self, response):
        # DO stuff then call parse_page2


    def parse_page2(self, response):
        print number
        # I want to get get start url or number

1 个答案:

答案 0 :(得分:2)

而不是 removedNames = []; add(selection): void { console.log("nameForm", this.nameForm); let selectedName = this.names.find(el => el.code === selection).name; console.log("adding: ", selectedName, " to ", this.people) if (this.people.findIndex(person => person.name === selectedName) < 0) { this.people.push({name: selectedName}); } this.nameForm = ''; this.removedNames.push(this.names.find(el => el.code === selection)); this.names.splice(this.names.findIndex(el => el.code === selection), 1); } remove(chip) { let name = chip.target.innerText; let index = this.people.findIndex(el => el.name === name); this.people.splice(index, 1); this.names.push(this.removedNames.find(el => el.name === name)); this.removedNames.splice(this.removedNames.findIndex(el => el.name === name), 1); } 使用start_urls方法:

start_requests