Skip to content

Commit

Permalink
Merge pull request #97 from theslavicbear/patch-3.3.2
Browse files Browse the repository at this point in the history
Patch 3.3.2
  • Loading branch information
theslavicbear authored Jun 12, 2024
2 parents 39f1362 + ecdb681 commit 0882e0a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 10 deletions.
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

0 comments on commit 0882e0a

Please sign in to comment.