Fix: indowebnovel url (#1042)

- fix url change
- added status
- commented out filter
This commit is contained in:
Justin COLLON
2024-07-12 18:31:41 +02:00
committed by GitHub
parent 31b1a4eddd
commit e6a98fbdb2
+92 -88
View File
@@ -1,14 +1,15 @@
import { CheerioAPI, load as parseHTML } from 'cheerio'; import { CheerioAPI, load as parseHTML } from 'cheerio';
import { fetchApi } from '@libs/fetch'; import { fetchApi } from '@libs/fetch';
import { Plugin } from '@typings/plugin'; import { Plugin } from '@typings/plugin';
import { NovelStatus } from '@libs/novelStatus';
import { Filters, FilterTypes } from '@libs/filterInputs'; import { Filters, FilterTypes } from '@libs/filterInputs';
class IndoWebNovel implements Plugin.PluginBase { class IndoWebNovel implements Plugin.PluginBase {
id = 'IDWN.id'; id = 'IDWN.id';
name = 'IndoWebNovel'; name = 'IndoWebNovel';
icon = 'src/id/indowebnovel/icon.png'; icon = 'src/id/indowebnovel/icon.png';
site = 'https://indowebnovel.id/id/'; site = 'https://indowebnovel.id/';
version = '1.2.2'; version = '1.2.3';
parseNovels(loadedCheerio: CheerioAPI) { parseNovels(loadedCheerio: CheerioAPI) {
const novels: Plugin.NovelItem[] = []; const novels: Plugin.NovelItem[] = [];
@@ -37,7 +38,7 @@ class IndoWebNovel implements Plugin.PluginBase {
async popularNovels( async popularNovels(
page = 1, page = 1,
{ filters }: Plugin.PopularNovelsOptions<typeof this.filters>, // { filters }: Plugin.PopularNovelsOptions<typeof this.filters>,
): Promise<Plugin.NovelItem[]> { ): Promise<Plugin.NovelItem[]> {
/* /*
let link = `${this.site}advanced-search/page/${page}/?title=&author=&yearx=`; let link = `${this.site}advanced-search/page/${page}/?title=&author=&yearx=`;
@@ -72,7 +73,10 @@ class IndoWebNovel implements Plugin.PluginBase {
author: loadedCheerio(".series-infolist li:contains('Author') span") author: loadedCheerio(".series-infolist li:contains('Author') span")
.text() .text()
.trim(), .trim(),
// status: loadedCheerio('.status').text().trim(), status:
loadedCheerio('.status').text().trim() === 'Completed'
? NovelStatus.Completed
: NovelStatus.Ongoing,
summary: loadedCheerio('.series-synops').text().trim(), summary: loadedCheerio('.series-synops').text().trim(),
chapters: [], chapters: [],
}; };
@@ -107,7 +111,7 @@ class IndoWebNovel implements Plugin.PluginBase {
const loadedCheerio = parseHTML(body); const loadedCheerio = parseHTML(body);
const chapterText = loadedCheerio('.readersss .text-left ').html() || ''; const chapterText = loadedCheerio('.adsads').html() || '';
return chapterText; return chapterText;
} }
@@ -131,89 +135,89 @@ class IndoWebNovel implements Plugin.PluginBase {
return this.parseNovels(loadedCheerio); return this.parseNovels(loadedCheerio);
} }
filters = { // filters = {
status: { // status: {
value: '', // value: '',
label: 'Status', // label: 'Status',
options: [ // options: [
{ label: 'All', value: '' }, // { label: 'All', value: '' },
{ label: 'Ongoing', value: 'ongoing' }, // { label: 'Ongoing', value: 'ongoing' },
{ label: 'Completed', value: 'completed' }, // { label: 'Completed', value: 'completed' },
], // ],
type: FilterTypes.Picker, // type: FilterTypes.Picker,
}, // },
type: { // type: {
value: '', // value: '',
label: 'Type', // label: 'Type',
options: [ // options: [
{ label: 'All', value: '' }, // { label: 'All', value: '' },
{ label: 'Web Novel', value: 'Web+Novel' }, // { label: 'Web Novel', value: 'Web+Novel' },
{ label: 'Light Novel', value: 'Light+Novel' }, // { label: 'Light Novel', value: 'Light+Novel' },
], // ],
type: FilterTypes.Picker, // type: FilterTypes.Picker,
}, // },
sort: { // sort: {
value: 'rating', // value: 'rating',
label: 'Order By', // label: 'Order By',
options: [ // options: [
{ label: 'A-Z', value: 'title' }, // { label: 'A-Z', value: 'title' },
{ label: 'Z-A', value: 'titlereverse' }, // { label: 'Z-A', value: 'titlereverse' },
{ label: 'Latest Update', value: 'update' }, // { label: 'Latest Update', value: 'update' },
{ label: 'Latest Added', value: 'latest' }, // { label: 'Latest Added', value: 'latest' },
{ label: 'Popular', value: 'popular' }, // { label: 'Popular', value: 'popular' },
{ label: 'Rating', value: 'rating' }, // { label: 'Rating', value: 'rating' },
], // ],
type: FilterTypes.Picker, // type: FilterTypes.Picker,
}, // },
lang: { // lang: {
value: ['china', 'jepang', 'korea', 'unknown'], // value: ['china', 'jepang', 'korea', 'unknown'],
label: 'Country', // label: 'Country',
options: [ // options: [
{ label: 'China', value: 'china' }, // { label: 'China', value: 'china' },
{ label: 'Jepang', value: 'jepang' }, // { label: 'Jepang', value: 'jepang' },
{ label: 'Korea', value: 'korea' }, // { label: 'Korea', value: 'korea' },
{ label: 'Unknown', value: 'unknown' }, // { label: 'Unknown', value: 'unknown' },
], // ],
type: FilterTypes.CheckboxGroup, // type: FilterTypes.CheckboxGroup,
}, // },
genre: { // genre: {
value: [], // value: [],
label: 'Genres', // label: 'Genres',
options: [ // options: [
{ label: 'Action', value: 'action' }, // { label: 'Action', value: 'action' },
{ label: 'Adult', value: 'adult' }, // { label: 'Adult', value: 'adult' },
{ label: 'Adventure', value: 'adventure' }, // { label: 'Adventure', value: 'adventure' },
{ label: 'Comedy', value: 'comedy' }, // { label: 'Comedy', value: 'comedy' },
{ label: 'Drama', value: 'drama' }, // { label: 'Drama', value: 'drama' },
{ label: 'Ecchi', value: 'ecchi' }, // { label: 'Ecchi', value: 'ecchi' },
{ label: 'Fantasy', value: 'fantasy' }, // { label: 'Fantasy', value: 'fantasy' },
{ label: 'Gender Bender', value: 'gender-bender' }, // { label: 'Gender Bender', value: 'gender-bender' },
{ label: 'Harem', value: 'harem' }, // { label: 'Harem', value: 'harem' },
{ label: 'Horror', value: 'horror' }, // { label: 'Horror', value: 'horror' },
{ label: 'Josei', value: 'josei' }, // { label: 'Josei', value: 'josei' },
{ label: 'Josei', value: 'josei' }, // { label: 'Josei', value: 'josei' },
{ label: 'Martial Arts', value: 'martial-arts' }, // { label: 'Martial Arts', value: 'martial-arts' },
{ label: 'Mature', value: 'mature' }, // { label: 'Mature', value: 'mature' },
{ label: 'Mecha', value: 'mecha' }, // { label: 'Mecha', value: 'mecha' },
{ label: 'Mystery', value: 'mystery' }, // { label: 'Mystery', value: 'mystery' },
{ label: 'Psychological', value: 'psychological' }, // { label: 'Psychological', value: 'psychological' },
{ label: 'Romance', value: 'romance' }, // { label: 'Romance', value: 'romance' },
{ label: 'School Life', value: 'school-life' }, // { label: 'School Life', value: 'school-life' },
{ label: 'Sci-fi', value: 'sci-fi' }, // { label: 'Sci-fi', value: 'sci-fi' },
{ label: 'Seinen', value: 'seinen' }, // { label: 'Seinen', value: 'seinen' },
{ label: 'Shoujo', value: 'shoujo' }, // { label: 'Shoujo', value: 'shoujo' },
{ label: 'Shounen', value: 'shounen' }, // { label: 'Shounen', value: 'shounen' },
{ label: 'Slice of Life', value: 'slice-of-life' }, // { label: 'Slice of Life', value: 'slice-of-life' },
{ label: 'Smut', value: 'smut' }, // { label: 'Smut', value: 'smut' },
{ label: 'Supernatural', value: 'supernatural' }, // { label: 'Supernatural', value: 'supernatural' },
{ label: 'Tragedy', value: 'tragedy' }, // { label: 'Tragedy', value: 'tragedy' },
{ label: 'Wuxia', value: 'wuxia' }, // { label: 'Wuxia', value: 'wuxia' },
{ label: 'Xianxia', value: 'xianxia' }, // { label: 'Xianxia', value: 'xianxia' },
{ label: 'Xuanhuan', value: 'xuanhuan' }, // { label: 'Xuanhuan', value: 'xuanhuan' },
], // ],
type: FilterTypes.CheckboxGroup, // type: FilterTypes.CheckboxGroup,
}, // },
} satisfies Filters; // } satisfies Filters;
} }
export default new IndoWebNovel(); export default new IndoWebNovel();