View Single Post
Old 10-30-2021, 12:14 PM   #6617
junni
Member
junni began at the beginning.
 
Posts: 20
Karma: 10
Join Date: Oct 2021
Device: kobo libra 2
Quote:
Originally Posted by JimmXinu View Post
New Site? readnovelfull.com



For a first attempt, this is remarkably good.

In fact, the only obvious flaw I found was with status processing; it didn't work with 'Ongoing' stories and FFF standardizes status to Completed and In-Progress. (Some sites do also have additional states.)

I changed it to:
Code:
        if soup.find("a", href=re.compile("/completed-novel"), class_="text-primary"):
            self.story.setMetadata("status", "Completed")
        else:
            self.story.setMetadata("status", "In-Progress")
Hi JimmXinu, with further testing i noticed that there was a bug in this code, because the website changes the HREF tag based on completed or ongoing novel . so i made a slight change which made it work. I should have tested further , but i was just too excited to post my accomplishment. .

Code:
try:
            status = soup.find("a", href=re.compile("/completed-novel"), class_="text-primary").text
        except:
            status = soup.find("a", href=re.compile("/ongoing-novel"), class_="text-primary").text		
		
        if status == "Completed":
            self.story.setMetadata("status", "Completed")
        else:
            self.story.setMetadata("status", "In-Progress")
junni is offline   Reply With Quote