1import scrapy
2
3class BlogSpider(scrapy.Spider):
4 name = 'blogspider'
5 start_urls = ['https://blog.scrapinghub.com']
6
7 def parse(self, response):
8 for title in response.css('.post-header>h2'):
9 yield {'title': title.css('a ::text').get()}
10
11 for next_page in response.css('a.next-posts-link'):
12 yield response.follow(next_page, self.parse)