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

CHYOA script issues #92

Closed
sammywasi opened this issue Nov 2, 2023 · 5 comments
Closed

CHYOA script issues #92

sammywasi opened this issue Nov 2, 2023 · 5 comments

Comments

@sammywasi
Copy link

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
Copy link
Owner

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
Copy link

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
Copy link
Owner

@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
Copy link

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
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@theslavicbear @adwag-hue @sammywasi and others