Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed showing announcement only issue #31 #32

Merged
merged 1 commit into from
Nov 13, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions getify.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
def find_between(file):
f = open(file, "r", encoding = "utf8")
soup = BeautifulSoup(f, 'html.parser')
return soup.title
return soup.title.string


"""Downloads web page from Wuxiaworld and saves it into the folder where the programm is located"""
Expand All @@ -37,14 +37,15 @@ def clean(file_name_in, file_name_out, start):
raw = open(file_name_in, "r", encoding = "utf8")
soup = BeautifulSoup(raw, 'lxml')
chapter_title = soup.find(class_="caption clearfix")
content = chapter_title.find_next_sibling(class_="fr-view")
chapter_title = chapter_title.find("h4")
if chapter_title.attrs["class"][0] == "text-spoiler":
has_spoiler = chapter_title.text
chapter_title = "Chapter name hidden due to potential spoilers"
else:
chapter_title = chapter_title.text
soup = soup.find(class_="fr-view")
for a in soup.find_all("a"):

for a in content.find_all("a"):
a.decompose()
raw.close()
file = open(file_name_out + ".xhtml", "w", encoding = "utf8")
Expand All @@ -54,7 +55,7 @@ def clean(file_name_in, file_name_out, start):
file.write("\n</head>")
file.write("\n<body>")
file.write("\n<h1>" + chapter_title + "</h1>")
file.write(str(soup))
file.write(str(content))
if has_spoiler != None:
file.write("<strong>The chapter name is: " + has_spoiler + "</strong>")
file.write("\n</body>")
Expand Down