theslavicbear / Ebook-Publisher

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

CHYOA script issues #92

Closed sammywasi closed 3 months ago

sammywasi commented 11 months ago

Seem to be getting this error most times I try to pull a story with login details added.

Traceback (most recent call last):
  File "J:\CHYOAscrape\Ebook-Publisher.py", line 339, in <module>
    clas=MakeClass(i)
         ^^^^^^^^^^^^
  File "J:\CHYOAscrape\Ebook-Publisher.py", line 202, in MakeClass
    site=sites[domain](url)
         ^^^^^^^^^^^^^^^^^^
  File "J:\CHYOAscrape\Ebook-Publisher.py", line 21, in <lambda>
    'chyoa.com':lambda x:Chyoa.Chyoa(x),
                         ^^^^^^^^^^^^^^
  File "J:\CHYOAscrape\Site\Chyoa.py", line 67, in __init__
    self.title=soup.find('h3').get_text()
               ^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get_text'

When trying without login details, stories can eventually error out with something like these two, though this seems to be dependent on either story category (ie, the restricted/hidden categories are/were Power Play/Mind Control/Family but it's nigh impossible to get a clear answer from site staff as to what the actual issue is for restrictions since they aren't on patreon anymore) or some other issue (perhaps relating to the word filter implemented when you're not logged in?)

Those categories can be reached via direct URL like so: https://chyoa.com/search?type=story&category=power-play https://chyoa.com/search?type=story&category=family https://chyoa.com/search?type=story&category=mind-control


    clas=MakeClass(i)
         ^^^^^^^^^^^^
  File "J:\CHYOAscrape\Ebook-Publisher.py", line 202, in MakeClass
    site=sites[domain](url)
         ^^^^^^^^^^^^^^^^^^
  File "J:\CHYOAscrape\Ebook-Publisher.py", line 21, in <lambda>
    'chyoa.com':lambda x:Chyoa.Chyoa(x),
                         ^^^^^^^^^^^^^^
  File "J:\CHYOAscrape\Site\Chyoa.py", line 235, in __init__
    self.AddNextPage(self.pageQueue.pop(0))
  File "J:\CHYOAscrape\Site\Chyoa.py", line 396, in AddNextPage
    self.authors.append(soup.find('p', class_='meta').find('a').get_text())
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get_text'```

```Traceback (most recent call last):
  File "J:\CHYOAscrape\Ebook-Publisher.py", line 339, in <module>
    clas=MakeClass(i)
         ^^^^^^^^^^^^
  File "J:\CHYOAscrape\Ebook-Publisher.py", line 202, in MakeClass
    site=sites[domain](url)
         ^^^^^^^^^^^^^^^^^^
  File "J:\CHYOAscrape\Ebook-Publisher.py", line 21, in <lambda>
    'chyoa.com':lambda x:Chyoa.Chyoa(x),
                         ^^^^^^^^^^^^^^
  File "J:\CHYOAscrape\Site\Chyoa.py", line 101, in __init__
    self.summary=soup.find('p', attrs={'class': 'synopsis'}).get_text()
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get_text'```
theslavicbear commented 10 months ago

Seems like I made a fix for this but never pushed it. Request you grab the latest from the master branch and try running these again.

adwag-hue commented 8 months ago

Sorry to bother you but I'm very new to using coding and github. but I'm having the same issue as OP and some CHYOA stories I'm able to download easily but others i just can't and get the same error message as op. What steps should i take exactly to use to fix this issues.

theslavicbear commented 7 months ago

@adwag-hue can you provide the story URLs that you are having trouble with? Having the full command you are running and the traceback error will also be helpful for me to reproduce the error you are seeing.

Also make sure you are using the latest release or have cloned the master/main branch (hard to confirm because I did not update the version variable for the v3.3.1 release) (you can run git pull to get the latest, then git checkout master to make sure you are running the latest branch.)

Also if possible, open a new issue so it's easier for me to track :)

p.s. I don't check github very often, sorry for the late reply and if it takes a while for me to work on the issue you are having.

adwag-hue commented 4 months ago

I managed to fix that probelm by adding in my usr name and password. Only question i have is im having trouble adding images. i just cant get it to work. for this story i can only get the heading image https://chyoa.com/chapter/Introduction.817852 and for these stories https://chyoa.com/chapter/Introduction.332890 https://chyoa.com/chapter/Introduction.522981 i get this Traceback (most recent call last): File "C:\Users\Hp\Documents\Ebook-Publisher-master\Ebook-Publisher-master\Ebook-Publisher.py", line 343, in formatsft File "C:\Users\Hp\Documents\Ebook-Publisher-master\Ebook-Publisher-master\Ebook-Publisher.py", line 30, in 'HTML':lambda x:MakeHTML(x), File "C:\Users\Hp\Documents\Ebook-Publisher-master\Ebook-Publisher-master\Ebook-Publisher.py", line 48, in MakeHTML published=open(wd+title_stripped+'/'+site.title+'.html', 'w', encoding="utf-8") FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\Hp\Documents\Ebook-Publisher-master\Ebook-Publisher-master\./Idius Halfhwit and the Aegis of Probability/Idius Halfhwit and the Aegis of Probability.html' PS C:\Users\Hp\Documents\Ebook-Publisher-master\Ebook-Publisher-master>

theslavicbear commented 3 months ago

Closing this now. @adwag-hue please see #96 as opened a new issue.