Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: [Novel Updates]: Rating #1169

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lnreader-plugins",
"version": "3.0.0",
"version": "3.1.0",
"description": "Plugins repo for LNReader",
"main": "index.js",
"type": "module",
Expand Down
10 changes: 9 additions & 1 deletion src/plugins/english/novelupdates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Plugin } from '@typings/plugin';
class NovelUpdates implements Plugin.PluginBase {
id = 'novelupdates';
name = 'Novel Updates';
version = '0.7.11';
version = '0.8.0';
icon = 'src/en/novelupdates/icon.png';
customCSS = 'src/en/novelupdates/customCSS.css';
site = 'https://www.novelupdates.com/';
Expand Down Expand Up @@ -139,6 +139,14 @@ class NovelUpdates implements Plugin.PluginBase {

novel.summary = summary + `\n\nType: ${type}`;

const rating = loadedCheerio('.seriesother .uvotes')
.text()
.match(/(\d+\.\d+) \/ \d+\.\d+/)?.[1];

if (rating) {
novel.rating = parseFloat(rating);
}

const chapter: Plugin.ChapterItem[] = [];

const novelId = loadedCheerio('input#mypostid').attr('value')!;
Expand Down
2 changes: 2 additions & 0 deletions src/types/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ export namespace Plugin {
author?: string;
artist?: string;
status?: string;
/** Rating out of 5 as float */
rating?: number;
chapters?: ChapterItem[];
} & NovelItem;

Expand Down