试图产生"数字"或者可能得到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
答案 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