May 2017
Beginner to intermediate
220 pages
5h 2m
English
By default, example/items.py contains the following code:
# -*- coding: utf-8 -*- # Define here the models for your scraped items## See documentation in:# http://doc.scrapy.org/en/latest/topics/items.htmlimport scrapy class ExampleItem(scrapy.Item): # define the fields for your item here like: # name = scrapy.Field() pass
The ExampleItem class is a template which needs to be replaced with the details we'd like to extract from the example country page. For now, we will just scrape the country name and population, rather than all the country details. Here is an updated model to support this:
class CountryItem(scrapy.Item): name = scrapy.Field() population = scrapy.Field()
Read now
Unlock full access