JimmXinu / FanFicFare

FanFicFare is a tool for making eBooks from stories on fanfiction and other web sites.
Other
757 stars 162 forks source link

[bug] RoyalRoad downloading is broken #923

Closed trimeta closed 1 year ago

trimeta commented 1 year ago

This problem seems to be extremely new, I downloaded a story less than eight hours ago and it worked, but as of right now, when attempting to download stories from RoyalRoad (either updating existing stories or adding new ones), the log shows an error saying "NoneType' object has no attribute 'text'". I don't know if this is some transient issue with RoyalRoad's website which will soon be resolved, or a change in their format which needs to be worked around, but either way it's currently preventing downloads.

ValentinLeTallec commented 1 year ago

Hi, I have the same issue, to give a bit more info :

> fanficfare -v
Version: 4.19.0
> fanficfare --color --update-epub --update-cover primal_hunter.epub
/usr/lib/python3.10/site-packages/bs4/builder/__init__.py:545: XMLParsedAsHTMLWarning: It looks like you're parsing an XML document using an HTML parser. If this really is an HTML document (maybe it's XHTML?), you can ignore or filter this warning. If it's XML, you should know that using an XML parser will be more reliable. To parse this document as XML, make sure you have the lxml package installed, and pass the keyword argument `features="xml"` into the BeautifulSoup constructor.
  warnings.warn(
Updating primal_hunter.epub, URL: https://www.royalroad.com/fiction/36049
Traceback (most recent call last):
  File "/usr/bin/fanficfare", line 33, in <module>
    sys.exit(load_entry_point('FanFicFare==4.19.0', 'console_scripts', 'fanficfare')())
  File "/usr/lib/python3.10/site-packages/fanficfare/cli.py", line 344, in main
    dispatch(options, urls, passed_defaultsini, passed_personalini, warn, fail)
  File "/usr/lib/python3.10/site-packages/fanficfare/cli.py", line 320, in dispatch
    do_download(url,
  File "/usr/lib/python3.10/site-packages/fanficfare/cli.py", line 435, in do_download
    adapter.getStoryMetadataOnly()
  File "/usr/lib/python3.10/site-packages/fanficfare/adapters/base_adapter.py", line 320, in getStoryMetadataOnly
    self.doExtractChapterUrlsAndMetadata(get_cover=get_cover)
  File "/usr/lib/python3.10/site-packages/fanficfare/adapters/base_adapter.py", line 424, in doExtractChapterUrlsAndMetadata
    return self.extractChapterUrlsAndMetadata()
  File "/usr/lib/python3.10/site-packages/fanficfare/adapters/adapter_royalroadcom.py", line 165, in extractChapterUrlsAndMetadata
    title = soup.select_one('.fic-header h1[property=name]').text
AttributeError: 'NoneType' object has no attribute 'text'

It looks like RoyalRoad changed their css.

JimmXinu commented 1 year ago

Test versions with fix up in the usual places. Needed changes for title, description and genre.

Let me know if there's anything else broken.

JimmXinu commented 1 year ago

Reopening purely for better visibility. See #925 #926 #927 #929

JimmXinu commented 1 year ago

FYI, new release including this fix is out. Still going to leave this open for now.

natrys commented 1 year ago

Would be nice to bump PyPI version (still at 4.20.0)

JimmXinu commented 1 year ago

My bad. Version up.