From d51e803baf62cf99345ab1c29465f342819c91e4 Mon Sep 17 00:00:00 2001 From: Daniel Tomlinson Date: Sat, 25 Jun 2022 17:17:00 +0100 Subject: [PATCH] chore: dont set file url if anthem is missing --- .../wikipedia_country_scraper/spiders/anthems.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/01_scrapy/wikipedia_country_scraper/wikipedia_country_scraper/spiders/anthems.py b/01_scrapy/wikipedia_country_scraper/wikipedia_country_scraper/spiders/anthems.py index c4cdedf..6fc9fa2 100644 --- a/01_scrapy/wikipedia_country_scraper/wikipedia_country_scraper/spiders/anthems.py +++ b/01_scrapy/wikipedia_country_scraper/wikipedia_country_scraper/spiders/anthems.py @@ -60,6 +60,7 @@ class AnthemsSpider(scrapy.Spider): anthem_item["country_name"] = country_name anthem_item["native_anthem_title"] = native_anthem_title anthem_item["english_title"] = english_title - anthem_item["file_urls"] = [f"https://en.wikipedia.org{anthem_url}" if anthem_url is not None else None] + if anthem_url is not None: + anthem_item["file_urls"] = [f"https://en.wikipedia.org{anthem_url}"] yield anthem_item