From 06676385d281080ec01ff4c2cd94b9810fc7018c Mon Sep 17 00:00:00 2001 From: Jake Zukowski Date: Fri, 5 Apr 2024 04:27:00 -0700 Subject: [PATCH] Update article.py Due to formatting changes on the Wikipedia, the example doesn't work as intended. (The titles returned are all "None"). This is to reflect the proper markup on the Wikipedia. --- Chapter08_Scrapy/wikiSpider/wikiSpider/spiders/article.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Chapter08_Scrapy/wikiSpider/wikiSpider/spiders/article.py b/Chapter08_Scrapy/wikiSpider/wikiSpider/spiders/article.py index a793863..7e97f19 100644 --- a/Chapter08_Scrapy/wikiSpider/wikiSpider/spiders/article.py +++ b/Chapter08_Scrapy/wikiSpider/wikiSpider/spiders/article.py @@ -12,7 +12,7 @@ def start_requests(self): def parse(self, response): url = response.url - title = response.css('h1::text').extract_first() + title = response.css('h1 .mw-page-title-main::text').extract_first() print('URL is: {}'.format(url)) print('Title is: {}'.format(title))