diff --git a/package.json b/package.json index a302bfe88..49b17efb9 100644 --- a/package.json +++ b/package.json @@ -67,4 +67,4 @@ "lint-staged": { "**/*.{js,ts,jsx,tsx}": "prettier --write" } -} \ No newline at end of file +} diff --git a/scripts/multisrc/madara/generator.js b/scripts/multisrc/madara/generator.js index a57061904..cb3fa09c7 100644 --- a/scripts/multisrc/madara/generator.js +++ b/scripts/multisrc/madara/generator.js @@ -27,10 +27,7 @@ const generator = function generator(source) { }); const pluginScript = ` -${madaraTemplate.replace( - '// CustomJS HERE', - source.options?.customJs || '', -)} +${madaraTemplate.replace('// CustomJS HERE', source.options?.customJs || '')} const plugin = new MadaraPlugin(${JSON.stringify(source)}); export default plugin; `.trim(); diff --git a/src/plugins/english/novelupdates.ts b/src/plugins/english/novelupdates.ts index c8b4ca421..9a944d28e 100644 --- a/src/plugins/english/novelupdates.ts +++ b/src/plugins/english/novelupdates.ts @@ -6,7 +6,7 @@ import { Plugin } from '@typings/plugin'; class NovelUpdates implements Plugin.PluginBase { id = 'novelupdates'; name = 'Novel Updates'; - version = '0.7.16'; + version = '0.8.0'; icon = 'src/en/novelupdates/icon.png'; customCSS = 'src/en/novelupdates/customCSS.css'; site = 'https://www.novelupdates.com/'; @@ -144,6 +144,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')!; @@ -1004,7 +1012,7 @@ class NovelUpdates implements Plugin.PluginBase { ); searchTerm = longestSearchTerm.replace(/[‘’]/g, "'").replace(/\s+/g, '+'); - const url = `${this.site}series-finder/?sf=1&sh=${encodeURIComponent(searchTerm)}&sort=srank&order=asc&pg=${page}`; + const url = `${this.site}series-finder/?sf=1&sh=${searchTerm}&sort=srank&order=asc&pg=${page}`; const result = await fetchApi(url); const body = await result.text(); diff --git a/src/types/plugin.ts b/src/types/plugin.ts index 83d456ef5..477a01734 100644 --- a/src/types/plugin.ts +++ b/src/types/plugin.ts @@ -30,6 +30,8 @@ export namespace Plugin { author?: string; artist?: string; status?: string; + /** Rating out of 5 as float */ + rating?: number; chapters?: ChapterItem[]; } & NovelItem;