简体   繁体   中英

Cannot concatenate 'str' and 'NoneType' objects using Scrapy

I am trying to scrape information from this website https://www.gumtree.co.za , however I am not sure how to get the URL of the property.

This is what I have:

class GumtreeSpider(scrapy.Spider):
    name = "gumtree"
    start_urls = ['https://www.gumtree.co.za/s-house-rentals-flat-rentals-offered/cape-town/v1c9071l3100006p1',
                  'https://www.gumtree.co.za/s-houses-flats-for-sale/cape-town/v1c9074l3100006p1']

    def parse(self, response):

        for prop in response.css('div.tileV1'):
            link = 'https://www.gumtree.co.za' + prop.css('div.title  a.tile-title-text::attr(href)').get()

I have tried multiple combinations however I cannot seem to get it right. Any suggestions? Thank you!

What are you trying to scrape exactly in the page? The ad list in the carousel in the top?

If yes, you need to look at the Javascript XHR requests, they are loaded dynamically so you have to inspect the different requests to find what you want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM