View Single Post
Old 08-07-2022, 11:46 AM   #7399
estherflails
Member
estherflails began at the beginning.
 
Posts: 23
Karma: 10
Join Date: Jul 2021
Device: none
Thank you for your suggestions.

Quote:
Originally Posted by JimmXinu View Post
BTW, doing both .text and stripHTML() is redundant. I prefer stripHTML() because it does some other stuff and definitely gets all sub tags.
I tried it with only stripHTML() but with that the metadata lacked spaces ("Inspired byTitlebyAuthor.") so I added the .text back.

Quote:
Originally Posted by JimmXinu View Post
I haven't tested it recently, but as I recall, it worked to populate a long text(HTML) custom column using yourentryHTML in custom_columns_settings.
I tried yourentryHTML but I couldn't get it to work, it ends up not fetching anything. Here are the relevant parts from my personal.ini:

Spoiler:
extra_valid_entries:inspired, seetheend, inspiredHTML

add_to_custom_columns_settings:
seetheend=>#inspired,r
inspiredHTML=>#inspired,r

I assume I'm doing something wrong here? 😅 I added the 'https://' + self.getSiteDomain() + alink['href'] part to the code too but it made no difference.

Code:
        inspired = metasoup.find('div',{'id':'children'})
        seetheend = metasoup.find('a',text='other works inspired by this one')
        if inspired:
            for alink in inspired.find_all('a'):
                if 'http' not in alink['href']:
                    alink['href']='https://' + self.getSiteDomain() + alink['href']
            self.story.setMetadata('inspired',stripHTML(inspired.text))
        elif seetheend:
            self.story.setMetadata('seetheend','See the end of the work for other works inspired by this one.')
estherflails is offline   Reply With Quote