为scrapy选择正确的CSS标签

时间:2017-08-08 00:38:51

标签: python html css scrapy screen-scraping

我想在这里抓这个页面: http://www.a1lockerrental.com/self-storage/mo/st-louis/4427-meramec-bottom-rd-facility/unit-sizes-prices#/units?category=all

这是我的代码:

import scrapy
from scrapy.selector import Selector
from testtest.items import TesttestItem
import datetime

class MySpider(scrapy.Spider):
    name = "A1storage"

    allowed_domains = ['https://www.a1lockerrental.com']
    start_urls = ['http://www.a1lockerrental.com/self-storage/mo/st-
        louis/4427-meramec-bottom-rd-facility/unit-sizes-prices#/units?
        category=all']

    def parse(self, response):
        info = response.css('buttons')

        for i in info:

            yield {


                "special": i.css(".special-text").extract_first(),
                "rate": i.css(".active .cat-price").extract(),
                "size": i.css(".sss-unit-size::text").extract(),
                "types": i.css(".sss-unit-amenitie 
                       span::text").extract_first()

               }

无论我将选择器更改为响应变量,我都不返回任何内容。我认为网站本身的HTML有问题,但我不够熟悉它。

0 个答案:

没有答案