ArmindoFlores / ao3_api

An unofficial archiveofourown.org (AO3) API for python
MIT License
166 stars 64 forks source link

AO3 search not able to create AO3.Work object for SOME restricted works #91

Open shiguresouma opened 1 year ago

shiguresouma commented 1 year ago

after creating an ao3 session and instantiating ao3 search with it, i am able to see the proper search.total_results for both public and restricted works. however, it does not appear to grab ALL restricted works, but only some.

this ao3 link is not able to generate a work object: https://archiveofourown.org/works/11544936/chapters/25923954

work = AO3.Work(25923954)

File "/usr/local/lib/python3.9/site-packages/AO3/works.py", line 37, in init self.reload(load_chapters) File "/usr/local/lib/python3.9/site-packages/AO3/threadable.py", line 13, in new return func(*args, **kwargs) File "/usr/local/lib/python3.9/site-packages/AO3/works.py", line 81, in reload if "Error 404" in self._soup.find("h2", {"class", "heading"}).text: AttributeError: 'NoneType' object has no attribute 'text'

but for other private works, it is able to work https://archiveofourown.org/works/45878941