diff --git a/01_scrapy/wikipedia_country_scraper/wikipedia_country_scraper/spiders/countrydownloader.py b/01_scrapy/wikipedia_country_scraper/wikipedia_country_scraper/spiders/countrydownloader.py index 0e711d5..f9271d9 100644 --- a/01_scrapy/wikipedia_country_scraper/wikipedia_country_scraper/spiders/countrydownloader.py +++ b/01_scrapy/wikipedia_country_scraper/wikipedia_country_scraper/spiders/countrydownloader.py @@ -50,8 +50,8 @@ class CountrydownloaderSpider(scrapy.Spider): "//table[contains(@class, 'infobox')]/tbody/tr[2]/td/div/div[1]/div[1]/a/@href" ).get() flag_description_url = response.xpath( - "//table[contains(@class, 'infobox')]/tbody/tr[2]/td/div/div[1]/div[2]/a/@href" - ).get() + "//table[contains(@class, 'infobox')]/tbody/tr[2]/td/div/div[1]/div/a/@href" + ).getall()[-1] country_item = { **country_item, @@ -100,6 +100,6 @@ class CountrydownloaderSpider(scrapy.Spider): country_scrapy_item["short_country_name"] = country_item["short_country_name"] country_scrapy_item["country_html"] = country_item["country_html"] country_scrapy_item["flag_html"] = country_item["flag_html"] - country_scrapy_item["file_urls"] = [country_item["flag_image_url"]] + country_scrapy_item["file_urls"] = [flag_image_xpath] yield country_scrapy_item