我有蜘蛛,但它不起作用。
我的蜘蛛只从一些链接中删除了信息。
Here scraping all data,但是Here nothing
我尝试使用不同的方法进行报废,但结果仍然相同
我的错误在哪里?这是我目前的代码:
更新:解决问题集DOWNLOAD_DELAY = 3
import scrapy
from NotebookDB.items import NotebookDB
class NotebookDBSpider(scrapy.Spider):
name = "notebookDB"
allowed_domains = ["price.ua"]
start_urls = [
"http://price.ua/catc839t14.html",
]
def parse(self, response):
sites = response.xpath('//*[@id="list-grid"]//div[@class="info-wrap"]/a/@href').extract()
for site in sites:
yield scrapy.Request(site, callback=self.parse_notebook, dont_filter=True)
def parse_notebook(sels, response):
item = NotebookDB()
item['url'] = response.url
item['brand'] = response.xpath('//div[@id="page-title"]/h1//span[@itemprop="brand"]/text()').extract()
item['title'] = response.xpath('//div[@id="page-title"]/h1/span[1]/span[2]/text()').extract()#response.xpath('//div[@id="page-title"]/h1//span[@itemprop="model"]/text()').extract()
item['image'] = response.xpath('//a[@id="model-big-photo"]//@href').extract()
item['price'] = str(response.xpath('//div[@class="price-diapazon"]/span/text()').extract_first()).replace("\u00a0","")
item['properties'] = response.xpath('//div[@class="relative-wrap"]/text()').extract()[2:-2]
yield item
答案 0 :(得分:0)
python脚本调用的浏览器引擎与您打开的浏览器不同。
您可能需要提供: 1)饼干 2)通过机器人测试(如果你不在乌克兰) 3)其他一些信息(如果他们要求您登录)
您可以尝试使用硒,您将了解其中的差异。