обход содержимого без извлечения данных - PullRequest
0 голосов
/ 29 февраля 2020

Я пытаюсь отсканировать отзывы от BestBuy, и это прекрасно, если код выполняется построчно на оболочке, но не через скрипт. Что не так?

class BestbuybotSpider(scrapy.Spider):
    name = 'bestbuybot'
    allowed_domains = ['https://www.bestbuy.com/site/amazon-echo-dot-3rd-gen-smart-speaker-with-alexa-charcoal/6287974.p?skuId=6287974']
    start_urls = ['http://https://www.bestbuy.com/site/amazon-echo-dot-3rd-gen-smart-speaker-with-alexa-charcoal/6287974.p?skuId=6287974/']


def parse(self, response):
        #Extracting the content using css selectors
        rating = response.css("div.c-ratings-reviews-v2.v-small p::text").extract()
        title = response.css(".review-title.c-section-title.heading-5.v-fw-medium  ::text").extract()

        #Give the extracted content row wise
        for item in zip(rating,title):
            #create a dictionary to store the scraped info
            scraped_info = {
                'rating' : item[0],
                'title' : item[1],
            }

            #yield or give the scraped info to scrapy
            yield scraped_info

введите описание изображения здесь

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...