Skip to content Skip to sidebar Skip to footer

Scrapy Is Showing NotImplementedError And I Don't Know Why

My Scrapy code doesn't work and I am not sure why. My spider is a test to crawl the Game of Throne subreddit on Reddit. Here is my code: import scrapy class Redditbot2Spider(scr

Solution 1:

Your code has an indentation problem, the parse method is in the same level as the class is, so the interpreter doesn't realize that it is a member of the class. You have to make an indent in the parse method:

class Redditbot2Spider(scrapy.Spider): 
    name = 'redditbot2'
    allowed_domains = ['www.reddit.com']
    start_urls = ['https://www.reddit.com/r/gameofthrones/']
    def parse(self, response): 
        titles = response.selector.xpath('//h2/text()').extract()
        #etc.

Post a Comment for "Scrapy Is Showing NotImplementedError And I Don't Know Why"