import scrapy


class QuotesSpider(scrapy.Spider):
    name = "quotes"
    start_urls = [
        'http://quotes.toscrape.com/',
    ]

    def parse(self, response):
        for quote in response.css('div.quote'):
            yield {
                'text': quote.css('small.author::text').getall(),
            }

        next_page = response.css('li.next a::attr(href)').get()
        if next_page is not None:
            next_page = response.urljoin(next_page)
            yield scrapy.Request(next_page, callback=self.parse)



        for cn in response.css('div.container'):
            yield {
                'ds': cn.css('div.author-description::text').getall(),
            }


        for a in response.css('div.quote span a'):
            yield response.follow(a, callback=self.parse)
