Debt to GDP ratio by country

So your job is to scrape the national debt to GDP for each country listed in this website 'http://worldpopulationreview.com/countries/countries-by-national-debt/'.

The population is not required to be scraped, however if you want to scrape it that's fine.

Now since this will be your first exercise, I'm gonna list below the steps you need to follow:

  1. First thing first please scaffold a new project called 'national_debt' and then generate a spider within that same project called "gdp_debt"

  2. The website does use the "http" protocol by default so there is no need to modify that in the 'start_urls' since by default Scrapy will use "http"

  3. Next inside the parse method make sure to iterate(loop) through all rows and yield two keys 'country_name' and 'gdp_debt'

  4. Finally make sure to execute the spider

A sample of the output:

If you get stuck feel free to reach me out in the Q&A section.

Solution source code can be downloaded from this link 'https://www.dropbox.com/sh/7etr8cmrc9av5mr/AAB0QmO4Cdcg2dpqBHlTXbDta?dl=0' please don't check it out unless you've done the exercise and you want to see my solution.

Good luck,

Ahmed.