theslavicbear / Ebook-Publisher

A Python tool for converting online stories into portable formats
MIT License
32 stars 2 forks source link

Script is unable to complete download #95

Open Nekokaburi0 opened 4 months ago

Nekokaburi0 commented 4 months ago

I saw a previous past where someone had the same issue, so they added the following block of code to the chyoa file:

    soup=BeautifulSoup(page.content, 'html.parser')
    try:
        self.authors.append(soup.find('p', class_='meta').find('a').get_text())
    except:
        self.authors.append("Anon")
    self.chapters.append(soup.find('h1').get_text())

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

It seemes to have fixed part of the problem as it gets to about 80% complete before throwing this error

1434/1750 81%Traceback (most recent call last): File "C:\Users---\Desktop\Ebook-Publisher\Ebook-Publisher.py", line 339, in clas=MakeClass(i) ^^^^^^^^^^^^ File "C:\Users---\Desktop\Ebook-Publisher\Ebook-Publisher.py", line 202, in MakeClass site=sitesdomain ^^^^^^^^^^^^^^^^^^ File "C:\Users---\Desktop\Ebook-Publisher\Ebook-Publisher.py", line 21, in 'chyoa.com':lambda x:Chyoa.Chyoa(x), ^^^^^^^^^^^^^^ File "C:\Users---\Desktop\Ebook-Publisher\Site\Chyoa.py", line 239, in init self.AddNextPage(self.pageQueue.pop(0)) File "C:\Users---\Desktop\Ebook-Publisher\Site\Chyoa.py", line 418, in AddNextPage self.questions.append(soup.find('header', attrs={'class':"question-header"}).get_text()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'get_text'

theslavicbear commented 3 months ago

Can you provide the URL to the story you are trying to download? Based on the error, I'm guessing it failed on a chapter that doesn't have an end question, which I thought was impossible. Chyoa normally inserts "What's next?" as the end question if it's left blank.

theslavicbear commented 3 months ago

This should be fixed with latest release, 3.3.2

I wasn't able to test this without a sample link, so please check and let me know @Nekokaburi0