diff --git a/src/plugins/english/novelupdates.ts b/src/plugins/english/novelupdates.ts index 167390092..73da31a9a 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.2'; + version = '0.7.3'; icon = 'src/en/novelupdates/icon.png'; customCSS = 'src/en/novelupdates/customCSS.css'; site = 'https://www.novelupdates.com/'; @@ -48,45 +48,59 @@ class NovelUpdates implements Plugin.PluginBase { filters?.novelType.value.length || filters?.genres.value.include?.length || filters?.genres.value.exclude?.length || + filters?.reading_lists.value.length || filters?.storyStatus.value !== '' ) { link += 'series-finder/?sf=1'; - } else if (showLatestNovels) { - link += 'latest-series/?st=1'; - } else { - link += 'series-ranking/?rank=week'; - } - if (filters?.language.value.length) - link += '&org=' + filters.language.value.join(','); + if (filters?.language.value.length) { + link += '&org=' + filters.language.value.join(','); + } - if (filters?.novelType.value.length) - link += '&nt=' + filters.novelType.value.join(','); + if (filters?.novelType.value.length) { + link += '&nt=' + filters.novelType.value.join(','); + } - if (filters?.genres.value.include?.length) - link += '&gi=' + filters.genres.value.include.join(','); + if (filters?.genres.value.include?.length) { + link += '&gi=' + filters.genres.value.include.join(','); + } - if (filters?.genres.value.exclude?.length) - link += '&ge=' + filters.genres.value.exclude.join(','); + if (filters?.genres.value.exclude?.length) { + link += '&ge=' + filters.genres.value.exclude.join(','); + } - if ( - filters?.genres.value.include?.length || - filters?.genres.value.exclude?.length - ) - link += '&mgi=' + filters.genre_operator.value; + if ( + filters?.genres.value.include?.length || + filters?.genres.value.exclude?.length + ) { + link += '&mgi=' + filters.genre_operator.value; + } - if (filters?.storyStatus.value.length) - link += '&ss=' + filters.storyStatus.value; + if (filters?.reading_lists.value.length) { + link += '&hd=' + filters?.reading_lists.value.join(','); + link += '&mRLi=' + filters?.reading_list_operator.value; + } + + if (filters?.storyStatus.value.length) { + link += '&ss=' + filters.storyStatus.value; + } - link += '&sort=' + filters?.sort.value; + link += '&sort=' + filters?.sort.value; - link += '&order=' + filters?.order.value; + link += '&order=' + filters?.order.value; + } else if (showLatestNovels) { + link += 'latest-series/?st=1'; + } else { + link += 'series-ranking/?rank=week'; + } link += '&pg=' + page; - const body = await fetchApi(link).then(result => result.text()); + const result = await fetchApi(link); + const body = await result.text(); const loadedCheerio = parseHTML(body); + return this.parseNovels(loadedCheerio); } @@ -551,6 +565,18 @@ class NovelUpdates implements Plugin.PluginBase { chapterText = `

${chapterTitle}



${chapterContent}`; } break; + case 'wetriedtls': + const scriptContent_wetried = + loadedCheerio('script:contains("p dir=")').html() || + loadedCheerio('script:contains("u003c")').html(); + if (scriptContent_wetried) { + const jsonString_wetried = scriptContent_wetried.slice( + scriptContent_wetried.indexOf('.push(') + '.push('.length, + scriptContent_wetried.lastIndexOf(')'), + ); + chapterText = JSON.parse(jsonString_wetried)[1]; + } + break; case 'wuxiaworld': bloatClasses = ['.MuiLink-root']; bloatClasses.map(tag => loadedCheerio(tag).remove()); @@ -565,6 +591,7 @@ class NovelUpdates implements Plugin.PluginBase { const link_yoru = `https://pxp-main-531j.onrender.com/api/v1/book_chapters/${chapterId_yoru}/content`; const json_yoru = await fetchApi(link_yoru).then(r => r.json()); chapterText = await fetchApi(json_yoru).then(r => r.text()); + break; case 'zetrotranslation': bloatClasses = ['hr', 'p:contains("\u00a0")']; bloatClasses.map(tag => loadedCheerio(tag).remove()); @@ -824,7 +851,9 @@ class NovelUpdates implements Plugin.PluginBase { 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(); + const loadedCheerio = parseHTML(body); + return this.parseNovels(loadedCheerio); } @@ -890,6 +919,15 @@ class NovelUpdates implements Plugin.PluginBase { ], type: FilterTypes.CheckboxGroup, }, + genre_operator: { + label: 'Genre (And/Or)', + value: 'and', + options: [ + { label: 'And', value: 'and' }, + { label: 'Or', value: 'or' }, + ], + type: FilterTypes.Picker, + }, genres: { label: 'Genres', type: FilterTypes.ExcludableCheckboxGroup, @@ -935,15 +973,21 @@ class NovelUpdates implements Plugin.PluginBase { { label: 'Yuri', value: '922' }, ], }, - genre_operator: { - label: 'Genre (AND/OR)', - value: 'and', + reading_list_operator: { + label: 'Reading List (Include/Exclude)', + value: 'include', options: [ - { label: 'AND', value: 'and' }, - { label: 'OR', value: 'or' }, + { label: 'Include', value: 'include' }, + { label: 'Exclude', value: 'exclude' }, ], type: FilterTypes.Picker, }, + reading_lists: { + label: 'Reading Lists', + value: [], + options: [{ label: 'All Reading Lists', value: '-1' }], + type: FilterTypes.CheckboxGroup, + }, } satisfies Filters; }