Last active
September 5, 2021 03:27
-
-
Save thepycoach/9c95d71d49f41ec5ffedd6f036426740 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import scrapy | |
| class WorldometersSpider(scrapy.Spider): | |
| name = 'worldometers' | |
| allowed_domains = ['www.worldometers.info'] | |
| start_urls = ['https://www.worldometers.info/world-population/population-by-country/'] | |
| def parse(self, response): | |
| # Getting all the rows of the table | |
| rows = response.xpath('//tr') | |
| for row in rows: | |
| # Extracting country names and population |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment