抓取网络抓取页面

时间:2018-07-10 22:13:07

标签: python scrapy

我正在尝试从Amazon上的某个网址中刮除SSD的价格,但该刮除器仅返回部分价格。请说明我出了错的地方,我是新手。

import scrapy
from scrapy import Spider

class SSDSpider(scrapy.Spider):
   name = "SSD_spider"
   start_urls = ['https://www.amazon.ca/s/ref=nb_sb_noss_2?url=search- 
   alias%3Daps&field-keywords=ssd']

   def parse(self, response):
       for ssd in response.css('.
            NAME_SELECTOR = '//span[contains(@class,"a-size-base a- 
            color-price s-price a-text-bold")]/text()'
            yield {
                'price': response.xpath(NAME_SELECTOR).extract()
            }

0 个答案:

没有答案