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

Patch 3.3.2 #97

Merged
merged 4 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Ebook-Publisher.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
Version = '3.3.0'
Version = '3.3.2'

import sys
from Site import *
Expand Down
38 changes: 29 additions & 9 deletions Site/Chyoa.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,22 +397,33 @@ def AddNextPage(self, args):
return None

soup=BeautifulSoup(page.content, 'html.parser')
self.authors.append(soup.find('p', class_='meta').find('a').get_text())

try:
self.authors.append(soup.find('p', class_='meta').find('a').get_text())
except AttributeError:
self.authors.append('Unknown')

self.chapters.append(soup.find('h1').get_text())

epubCurrLink='\n<a href="'+str(depth)+'.xhtml">'+'Previous Chapter'+'</a>\n<br />'

if Common.images:
if soup.find('div', attrs={'class': 'chapter-content'}).find('img'):
for simg in soup.find('div', attrs={'class': 'chapter-content'}).find_all('img'):
self.images.append(simg.get('src'))
simg['src']='img'+str(len(self.images))+'.jpg'
imgtemp=simg.get('src')
simg['src']='img'+str(len(Common.urlDict[self.ogUrl])+1)+'.jpg'
Common.urlDict[self.ogUrl][len(Common.urlDict[self.ogUrl])]=imgtemp
self.hasimages = True

temp2 = soup.find('div', attrs={'class': 'chapter-content'})
self.depth.append(str(depth))
temp='<div id="'+str(depth)+'">'+str(temp2)
self.questions.append(soup.find('header', attrs={'class':"question-header"}).get_text())
temp='<div id="'+str(depth)+'">'+str(temp2)

try:
self.questions.append(soup.find('header', attrs={'class':"question-header"}).get_text())
except AttributeError:
self.questions.append('What\'s next?')

temp+='<h2>'+self.questions[-1]+'</h2>\n</div>'
if self.partial:
Common.prnt(str(depth))
Expand Down Expand Up @@ -568,15 +579,19 @@ def AddNextPage(self, url, depth):
return None

soup=BeautifulSoup(page.content, 'html.parser')
self.author=(soup.find('p', class_='meta').find('a').get_text())

try:
self.author=(soup.find('p', class_='meta').find('a').get_text())
except AttributeError:
self.author='Unknown'

self.chapter=(soup.find('h1').get_text())


if Common.images:
if soup.find('div', attrs={'class': 'chapter-content'}).find('img'):
with lock2:
for simg in soup.find('div', attrs={'class': 'chapter-content'}).find_all('img'):

imgtemp=simg.get('src')
simg['src']='img'+str(len(Common.urlDict[self.ogUrl])+1)+'.jpg'
Common.urlDict[self.ogUrl][len(Common.urlDict[self.ogUrl])]=imgtemp
Expand All @@ -585,8 +600,13 @@ def AddNextPage(self, url, depth):
temp2 = soup.find('div', attrs={'class': 'chapter-content'})
#self.depth+=(str(depth))
Common.prnt(str(depth))
temp='<div id="'+str(depth)+'">'+str(temp2)
self.questions.append(soup.find('header', attrs={'class':"question-header"}).get_text())
temp='<div id="'+str(depth)+'">'+str(temp2)

try:
self.questions.append(soup.find('header', attrs={'class':"question-header"}).get_text())
except AttributeError:
self.questions.append('What\'s next?')

temp+='<h2>'+self.questions[-1]+'</h2>\n</div>'
#Common.prnt(str(depth))
j = 1
Expand Down