i have write code like below but it give me error like image ....
from ctypes.wintypes import FLOAT
import scrapy
import time
from random import randint
list_ean =["8710439263427","0088381683951","8712008018575"]
class QuofiSpider(scrapy.Spider):
name = 'Quofi'
allowed_domains = ['www.quofi.nl']
start_urls = ['https://www.quofi.nl/zoekresultaten?k={}'.format(list_ean[i]) for i in range(len(list_ean))]
# start_urls = ['http://www.quofi.nl/']
def parse(self, response,):
time.sleep(randint(1, 2))
data = {}
title = response.xpath('.//div/a/h3/text()').getall()
ean = response.xpath('//*[@id="searchBox"]/@value').getall()
En = response.xpath('.//div/p/text()').getall()
price = str(response.xpath('.//span[@class="price price--large"]/text()').getall())
price = price.replace(']', '')
price = price.replace('[', '')
price = price.replace('€ ', '')
price = price.replace('"', '')
price = price.replace("'", "")
data['Name'] = title
data['EAN'] = ean
data['Price'] = (price *0.79)
yield data
dhruv parmar
i have write code like below but it give me error like image ....
from ctypes.wintypes import FLOAT
import scrapy
import time
from random import randint
list_ean =["8710439263427","0088381683951","8712008018575"]
class QuofiSpider(scrapy.Spider):
name = 'Quofi'
allowed_domains = ['www.quofi.nl']
start_urls = ['https://www.quofi.nl/zoekresultaten?k={}'.format(list_ean[i]) for i in range(len(list_ean))]
# start_urls = ['http://www.quofi.nl/']
def parse(self, response,):
time.sleep(randint(1, 2))
data = {}
title = response.xpath('.//div/a/h3/text()').getall()
ean = response.xpath('//*[@id="searchBox"]/@value').getall()
En = response.xpath('.//div/p/text()').getall()
price = str(response.xpath('.//span[@class="price price--large"]/text()').getall())
price = price.replace(']', '')
price = price.replace('[', '')
price = price.replace('€ ', '')
price = price.replace('"', '')
price = price.replace("'", "")
data['Name'] = title
data['EAN'] = ean
data['Price'] = (price *0.79)
yield data