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.3 #101

Merged
merged 2 commits into from
Jul 30, 2024
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
14 changes: 6 additions & 8 deletions Site/Chyoa.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,15 +389,15 @@ def AddNextPage(self, args):
epubPrevLink=args[4]
currLink=args[5]
prevLinkId=args[6]

page = Common.RequestPageChyoa(url, headers={'User-Agent' : 'Mozilla/5.0 (Windows NT 6.1; Win64; x64)'})

if page is None:
print('Could not complete request for page: ' + url)
return None

soup=BeautifulSoup(page.content, 'html.parser')

try:
self.authors.append(soup.find('p', class_='meta').find('a').get_text())
except AttributeError:
Expand Down Expand Up @@ -438,7 +438,6 @@ def AddNextPage(self, args):
epubtemp=temp
for i in soup.find('div', attrs={'class':'question-content'}).find_all('a'):
if i.get_text().strip() != 'Add a new chapter':

link = i.get_text()
#Band aid fix for replaceable text in the next chapter links
for l in range(len(self.renames)):
Expand All @@ -454,7 +453,6 @@ def AddNextPage(self, args):
nextpagesdepth.append(j)
j+=1
temp+=prevLink

if any(x in ('epub', 'EPUB') for x in Common.opf):
epubtemp+=epubPrevLink
for j in epubnextpages:
Expand All @@ -481,9 +479,9 @@ def AddNextPage(self, args):
#Other check if current page is a link and doesn't continue if so
prevLinkCheck1=soup.find('span', attrs={'class':'controls-left'})
prevLinkCheck2=prevLinkCheck1.find_all('a')[0].get('href')
prevLinkId1=urllib.parse.urlparse(prevLinkCheck2)[2].split('.')[1]
prevLinkId1=urllib.parse.urlparse(prevLinkCheck2)[2].split('.')[2]

currLinkId=urllib.parse.urlparse(url)[2].split('.')[1]
currLinkId=urllib.parse.urlparse(url)[2].split('.')[2]
if prevLinkId is not None and prevLinkId1 != prevLinkId:
#print(prevLinkId1)
#print(prevLinkId)
Expand Down Expand Up @@ -670,9 +668,9 @@ def AddNextPage(self, url, depth):
#Other check if current page is a link and doesn't continue if so
prevLinkCheck1=soup.find('span', attrs={'class':'controls-left'})
prevLinkCheck2=prevLinkCheck1.find_all('a')[0].get('href')
prevLinkId=urllib.parse.urlparse(prevLinkCheck2)[2].split('.')[1]
prevLinkId=urllib.parse.urlparse(prevLinkCheck2)[2].split('.')[2]

currLinkId=urllib.parse.urlparse(url)[2].split('.')[1]
currLinkId=urllib.parse.urlparse(url)[2].split('.')[2]
if self.prevLinkId is not None and prevLinkId!=self.prevLinkId:
#print(self.prevLinkId)
#print(prevLinkId)
Expand Down