View Single Post
Old 02-24-2023, 02:54 PM   #8110
aleyx
Addict
aleyx can self-interpret dreams as they happen.aleyx can self-interpret dreams as they happen.aleyx can self-interpret dreams as they happen.aleyx can self-interpret dreams as they happen.aleyx can self-interpret dreams as they happen.aleyx can self-interpret dreams as they happen.aleyx can self-interpret dreams as they happen.aleyx can self-interpret dreams as they happen.aleyx can self-interpret dreams as they happen.aleyx can self-interpret dreams as they happen.aleyx can self-interpret dreams as they happen.
 
Posts: 250
Karma: 20386
Join Date: Sep 2010
Location: France
Device: Bookeen Diva, Kobo Clara BW
Quote:
Originally Posted by watani View Post
I'm guessing RoyalRoad has changed its website as of today? Every story I try to update returns the following:

'NoneType' object has no attribute 'text'

I'm using the latest test version of FFF.
As it happens, I'm looking into this myself.

Seems that adapter_royalroadcom.py looks for the chapter title with the selector '.fic-header h1[property=name]' (line 165), but the h1 now only has class and style, so the selector fails (if I understand correctly) (kind of weird, I dont remember selectors with that syntax, but oh well, it worked til now).

PHP Code:
title soup.select_one('.fic-header h1[property=name]').text 
The title is therefore "None", and None has no attribute 'text', thus the error message.

I was afraid at first, because the first few error messages I got were HTTP 403, "Client forbidden". Was afraid that RoyalRoad now excluded bots completely.

N.

EDIT: For reference, the traceback I got

Spoiler:
Code:
	Traceback (most recent call last):
	  File "calibre_plugins.fanficfare_plugin.jobs", line 250, in do_download_for_worker
	    story = adapter.getStoryMetadataOnly()
	  File "/home/aleyx/.var/app/com.calibre_ebook.calibre/config/calibre/plugins/FanFicFare.zip/fanficfare/adapters/base_adapter.py", line 327, in getStoryMetadataOnly
	    self.doExtractChapterUrlsAndMetadata(get_cover=get_cover)
	  File "/home/aleyx/.var/app/com.calibre_ebook.calibre/config/calibre/plugins/FanFicFare.zip/fanficfare/adapters/base_adapter.py", line 431, in doExtractChapterUrlsAndMetadata
	    return self.extractChapterUrlsAndMetadata()
	  File "/home/aleyx/.var/app/com.calibre_ebook.calibre/config/calibre/plugins/FanFicFare.zip/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'
	
	FFF: INFO: 2023-02-24 20:46:03,346: calibre_plugins.fanficfare_plugin.jobs(142): 
	Download Results:
	Error https://www.royalroad.com/fiction/41463 'NoneType' object has no attribute 'text'
	
	FFF: INFO: 2023-02-24 20:46:03,346: calibre_plugins.fanficfare_plugin.jobs(166): 
	Error
	https://www.royalroad.com/fiction/41463


EDIT:

So I've made two modifications to adapter_royalroad.py:

Spoiler:
Line 165: Changed to
Code:
        title = soup.select_one('.fic-header .fic-title h1').text
Line 194: Changed to
Code:
        description = soup.select_one('div.description .hidden-content')


I've successfully updated manually and from email. That was kind of field surgery though and I know nothing about BeautifulSoup, so the adapter's author should maybe check that those changes are in fact harmless.

Last edited by aleyx; 02-24-2023 at 03:39 PM.
aleyx is offline   Reply With Quote