Fix page title of some lists

Signed-off-by: Skylar "The Cobra" Widulski <cobra@vern.cc>
This commit is contained in:
Skylar "The Cobra" Widulski 2023-01-11 21:35:12 -05:00
parent 9bc38b7291
commit 25cd2d956d
Signed by: cobra
GPG Key ID: 4FD8F812083FF6F9
1 changed files with 12 additions and 2 deletions

14
main.py
View File

@ -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