From 25cd2d956d7db63d5748ee2c54c0e640c451bdf9 Mon Sep 17 00:00:00 2001 From: "Skylar \"The Cobra\" Widulski" Date: Wed, 11 Jan 2023 21:35:12 -0500 Subject: [PATCH] Fix page title of some lists Signed-off-by: Skylar "The Cobra" Widulski --- main.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 6874881..910dfd2 100644 --- a/main.py +++ b/main.py @@ -24,6 +24,11 @@ def secondary_list(path): article_type = soup.find(attrs={"class": ["section_title"]}) if (article_type.find("svg") != None): article_type.find("svg").decompose() + head = article_type.find("span") + if head != None: + head = head.text + else: + head = article_type.text article_type_head = soup.find(attrs={"class": ["img_title_wrap"]}) description = soup.find(attrs={"class": ["desc_cont_wrap"]}).text @@ -52,7 +57,7 @@ def secondary_list(path): next_button = buttons[1] pagenumber = soup.find(attrs={"class": ["pagenumber"]}).text - return [article_type, description, article_list, prev_button, next_button, pagenumber, tags, article_type.text] + return [article_type, description, article_list, prev_button, next_button, pagenumber, tags, head] else: return data.status_code @@ -75,6 +80,11 @@ def article_list(path): # Header article_type = soup.find(attrs={"class": ["section_title"]}) article_type.find("svg").decompose() + head = article_type.find("span") + if head != None: + head = head.text + else: + head = article_type.text article_type_head = soup.find(attrs={"class": ["img_title_wrap"]}) description = soup.find(attrs={"class": ["page_desc_wrapper"]}).text @@ -99,7 +109,7 @@ def article_list(path): next_button = buttons[1] pagenumber = soup.find(attrs={"class": ["pagenumber"]}).text - return [article_type, description, article_list, prev_button, next_button, pagenumber, tags, article_type.text] + return [article_type, description, article_list, prev_button, next_button, pagenumber, tags, head] else: return data.status_code