import scrapy
from scrapy.selector import Selector
from scrapy.contrib.spiders import CrawlSpider
from scrapy.selector import HtmlXPathSelector
from scrapy.http import Request
class NextlinkSpider(scrapy.Spider):
name = 'nextlink'
allowed_domains = ['www.shanazrafiq.com/']
start_urls = ['https://www.shanazrafiq.com/']
def parse(self, response):
yield Request(url='https://www.shanazrafiq.com/p/recipes.html',callback = self.parse_dir_contents)
Error :AttributeError: 'NextlinkSpider' object has no attribute 'parse_dir_contents'
trying to crawl to another url from base url
I wanted to get the recipes page tag content by navigating from first page but unable to call the callback function which say me attribute not found error while doing so. Help me in fixing this . Thanks in advance
def parse_dir_contents(self, response): # second function to be called.
sel = Selector(response)
title_name=sel.css("div.widget HTML h2::text").extract()
print title_name