Feat: ImageRequestInit (#979)

* add ImageRequestInit & fix Hako

* remove multisrc fetchFile

* remove plugins fetchFile

* update docs and template file
This commit is contained in:
nyagami
2024-06-08 20:09:33 +07:00
committed by GitHub
parent 6062f51460
commit 60d95fb8d2
85 changed files with 441 additions and 692 deletions
-2
View File
@@ -180,8 +180,6 @@ class Shu69 implements Plugin.PluginBase {
return novels;
}
fetchImage = fetchFile;
filters = {
rank: {
label: '排行榜',
-2
View File
@@ -181,8 +181,6 @@ class XinShu69 implements Plugin.PluginBase {
return novels;
}
fetchImage = fetchFile;
filters = {
class: {
label: '分类',
-7
View File
@@ -521,13 +521,6 @@ class Linovelib implements Plugin.PluginBase {
return novels;
}
async fetchImage(url: string): Promise<string | undefined> {
const headers = new Headers({
'Referer': `${this.site}/`,
});
return await fetchFile(url, { headers });
}
filters = {
rank: {
label: '排行榜',
-2
View File
@@ -148,8 +148,6 @@ class LibReadPlugin implements Plugin.PluginBase {
return this.parseNovels(loadedCheerio);
}
fetchImage = fetchFile;
filters = {
type_genre: {
type: FilterTypes.Picker,
-4
View File
@@ -146,10 +146,6 @@ class NovelsOnline implements Plugin.PluginBase {
.filter(sr => sr !== null);
}
async fetchImage(url: string): Promise<string | undefined> {
return fetchFile(url);
}
filters = {
sort: {
value: 'top_rated',
-3
View File
@@ -156,9 +156,6 @@ class StorySeedlingPlugin implements Plugin.PluginBase {
return novels;
}
async fetchImage(url: string): Promise<string | undefined> {
return fetchFile(url);
}
}
export default new StorySeedlingPlugin();
-4
View File
@@ -148,10 +148,6 @@ class AllNovelFullPlugin implements Plugin.PluginBase {
return this.parseNovels(loadedCheerio);
}
async fetchImage(url: string): Promise<string | undefined> {
return await fetchFile(url);
}
filters = {
order: {
value: '/most-popular',
-4
View File
@@ -169,10 +169,6 @@ class BLN implements Plugin.PluginBase {
return this.parseNovels(loadedCheerio);
}
async fetchImage(url: string): Promise<string | undefined> {
return await fetchFile(url);
}
filters = {
status: {
label: 'Status',
-4
View File
@@ -157,10 +157,6 @@ class ComradeMaoPlugin implements Plugin.PluginBase {
return this.parseNovels(loadedCheerio);
}
async fetchImage(url: string): Promise<string | undefined> {
return await fetchFile(url);
}
filters = {
category: {
value: '',
-4
View File
@@ -128,10 +128,6 @@ class DDLPlugin implements Plugin.PluginBase {
const loadedCheerio = parseHTML(body);
return this.parseNovels(loadedCheerio, searchTerm);
}
async fetchImage(url: string): Promise<string | undefined> {
return await fetchFile(url);
}
}
export default new DDLPlugin();
-4
View File
@@ -139,10 +139,6 @@ class EarlyNovelPlugin implements Plugin.PagePlugin {
return this.parseNovels(loadedCheerio);
}
async fetchImage(url: string): Promise<string | undefined> {
return await fetchFile(url);
}
filters = {
order: {
value: '/most-popular',
-2
View File
@@ -161,8 +161,6 @@ class FaqWikiUs implements Plugin.PluginBase {
return this.parseNovels(loadedCheerio, searchTerm);
}
fetchImage = fetchFile;
}
export default new FaqWikiUs();
-2
View File
@@ -144,8 +144,6 @@ class FreeWebNovel implements Plugin.PluginBase {
return this.parseNovels(loadedCheerio);
}
fetchImage = fetchFile;
filters = {
genres: {
type: FilterTypes.Picker,
+110 -108
View File
@@ -19,33 +19,33 @@ class LightNovelPub implements Plugin.PagePlugin {
const novels: Plugin.NovelItem[] = [];
let tempNovel = {} as Plugin.NovelItem;
let isParsingNovel = false;
const parser = new Parser ({
onopentag(name, attribs){
if (isParsingNovel){
if (name === 'a'){
const parser = new Parser({
onopentag(name, attribs) {
if (isParsingNovel) {
if (name === 'a') {
tempNovel.path = attribs['href'].slice(1);
tempNovel.name = attribs['title'];
}
if (name === 'img'){
if (name === 'img') {
tempNovel.cover = attribs['data-src'] || attribs['src'];
}
if (tempNovel.path && tempNovel.cover){
if (tempNovel.path && tempNovel.cover) {
novels.push(tempNovel);
tempNovel = {} as Plugin.NovelItem;
}
}
},
onattribute(name, value){
if (name === 'class' && value === 'novel-item'){
onattribute(name, value) {
if (name === 'class' && value === 'novel-item') {
isParsingNovel = true;
}
},
onclosetag(name){
if(name === 'li'){
onclosetag(name) {
if (name === 'li') {
isParsingNovel = false;
}
}
})
},
});
parser.write(html);
parser.end();
return novels;
@@ -76,7 +76,7 @@ class LightNovelPub implements Plugin.PagePlugin {
summary: '',
totalPages: 1,
chapters: [],
}
};
let isHeaderStats = false;
let isStatus = false;
let isTotalChapters = false;
@@ -85,95 +85,95 @@ class LightNovelPub implements Plugin.PagePlugin {
let isSummary = false;
let isGenres = false;
let isTags = false;
let genreArray: string[] = []
let genreArray: string[] = [];
let isCover = false;
const parser = new Parser({
onopentag(name, attribs){
if(name === 'h1' && attribs['class']?.includes('novel-title')){
onopentag(name, attribs) {
if (name === 'h1' && attribs['class']?.includes('novel-title')) {
isNovelName = true;
}
if(name === 'div' && attribs['class']?.includes('content')){
if (name === 'div' && attribs['class']?.includes('content')) {
isSummary = true;
}
if(name === 'figure' && attribs['class'] === 'cover'){
if (name === 'figure' && attribs['class'] === 'cover') {
isCover = true;
}
if(isCover){
if(name === 'img'){
if (isCover) {
if (name === 'img') {
novel.cover = attribs['data-src'] || attribs['src'];
}
}
},
onopentagname(name){
if (isHeaderStats && name === 'strong'){
onopentagname(name) {
if (isHeaderStats && name === 'strong') {
isStatus = true;
}
if (isSummary && name === 'br'){
if (isSummary && name === 'br') {
novel.summary += '\n';
}
if (isGenres && name === 'a'){
if (isGenres && name === 'a') {
isTags = true;
}
},
onattribute(name,value){
if (name === 'class' && value === 'header-stats'){
onattribute(name, value) {
if (name === 'class' && value === 'header-stats') {
isTotalChapters = true;
isHeaderStats = true;
}
if (name === 'itemprop' && value === 'author'){
if (name === 'itemprop' && value === 'author') {
isAuthorName = true;
}
if (name === 'class' && value === 'categories'){
if (name === 'class' && value === 'categories') {
isGenres = true;
}
},
ontext(data){
if(isTotalChapters){
ontext(data) {
if (isTotalChapters) {
novel.totalPages = Math.ceil(parseInt(data, 10) / 100);
}
if(isStatus){
if (isStatus) {
novel.status = data.trim();
}
if(isNovelName){
if (isNovelName) {
novel.name += data.trim();
}
if(isAuthorName){
if (isAuthorName) {
novel.author = data;
}
if(isSummary){
if (isSummary) {
novel.summary += data;
}
if(isTags){
if (isTags) {
genreArray.push(data);
}
},
onclosetag(name){
if(name === 'strong'){
onclosetag(name) {
if (name === 'strong') {
isTotalChapters = false;
isStatus = false;
}
if(name === 'i'){
if (name === 'i') {
isStatus = false;
}
if(name === 'h1'){
if (name === 'h1') {
isNovelName = false;
}
if(name === 'span'){
if (name === 'span') {
isAuthorName = false;
}
if(name === 'div'){
if (name === 'div') {
isHeaderStats = false;
isSummary = false;
isGenres = false;
}
if(name === 'a'){
if (name === 'a') {
isTags = false;
}
if(name === 'figure'){
if (name === 'figure') {
isCover = false;
}
}
})
},
});
parser.write(body);
parser.end();
novel.genres = genreArray.join(', ');
@@ -184,48 +184,51 @@ class LightNovelPub implements Plugin.PagePlugin {
const url = this.site + novelPath + '/chapters/page-' + page;
const body = await fetchApi(url).then(res => res.text());
const chapter: Plugin.ChapterItem[] = [];
let tempChapter = {} as Plugin.ChapterItem;
let tempChapter = {} as Plugin.ChapterItem;
let isChapterItem = false;
let isChapterList = false;
const parser = new Parser ({
onopentag(name, attribs){
if(isChapterList){
if (name === 'li'){
const parser = new Parser({
onopentag(name, attribs) {
if (isChapterList) {
if (name === 'li') {
isChapterItem = true;
tempChapter.chapterNumber = Number(attribs['data-orderno']);
}
if (isChapterItem){
if (name === 'a'){
if (isChapterItem) {
if (name === 'a') {
tempChapter.name = attribs['title'];
tempChapter.path = attribs['href'].slice(1);
}
if (name === 'time'){
tempChapter.releaseTime = dayjs(attribs['datetime']).toISOString();
if (name === 'time') {
tempChapter.releaseTime = dayjs(
attribs['datetime'],
).toISOString();
}
if (
tempChapter.chapterNumber &&
tempChapter.path &&
tempChapter.releaseTime){
chapter.push(tempChapter);
tempChapter = {} as Plugin.ChapterItem;
tempChapter.chapterNumber &&
tempChapter.path &&
tempChapter.releaseTime
) {
chapter.push(tempChapter);
tempChapter = {} as Plugin.ChapterItem;
}
}
}
},
onattribute(name, value){
if (name === 'class' && value === 'chapter-list'){
onattribute(name, value) {
if (name === 'class' && value === 'chapter-list') {
isChapterList = true;
}
},
onclosetag(name){
if (name === 'a'){
onclosetag(name) {
if (name === 'a') {
isChapterItem = false;
}
if (name === 'ul'){
if (name === 'ul') {
isChapterList = false;
}
}
})
},
});
parser.write(body);
parser.end();
const chapters = chapter;
@@ -240,92 +243,92 @@ class LightNovelPub implements Plugin.PagePlugin {
let isPtag = false;
let isStyleText = false;
const parser = new Parser({
onopentag(name,attribs){
if (isChapter && name === 'div'){
let stylediv = attribs['style']
if(stylediv){
chapterText += `<div style="${stylediv}">`
onopentag(name, attribs) {
if (isChapter && name === 'div') {
let stylediv = attribs['style'];
if (stylediv) {
chapterText += `<div style="${stylediv}">`;
isStyleText = true;
} else {
chapterText += `<div>`
chapterText += `<div>`;
}
}
if (isChapter && name === 'table'){
if (isChapter && name === 'table') {
let w = attribs['width'];
if(w) {
if (w) {
chapterText += `<table width="${w}">`;
} else {
chapterText += `<table>`;
}
}
if (isChapter && name === 'tbody'){
if (isChapter && name === 'tbody') {
chapterText += `<tbody>`;
}
if (isChapter && name === 'tr'){
if (isChapter && name === 'tr') {
chapterText += `<tr>`;
}
if (isChapter && name === 'td'){
if (isChapter && name === 'td') {
let w1 = attribs['width'];
if(w1) {
if (w1) {
chapterText += `<td width="${w1}">`;
} else {
chapterText += `<td>`;
}
}
},
onattribute(name, value){
if (name === 'id' && value === 'chapter-container'){
onattribute(name, value) {
if (name === 'id' && value === 'chapter-container') {
isChapter = true;
}
if (name === 'class' && value?.includes('chapternav')){
if (name === 'class' && value?.includes('chapternav')) {
isChapter = false;
isPtag = false;
}
},
onopentagname(name){
if (isChapter && name === 'p'){
onopentagname(name) {
if (isChapter && name === 'p') {
chapterText += '<p>';
isPtag = true;
if(isStyleText){
if (isStyleText) {
isStyleText = false;
}
}
if (isChapter && name === 'br'){
if (isChapter && name === 'br') {
chapterText += `<br>`;
}
},
ontext(data){
if(isPtag){
ontext(data) {
if (isPtag) {
chapterText += data;
}
if(isStyleText){
if (isStyleText) {
chapterText += data;
}
},
onclosetag(name){
if (name === 'p'){
onclosetag(name) {
if (name === 'p') {
isPtag = false;
chapterText += '</p>'
chapterText += '</p>';
}
if (isChapter && name === 'td'){
if (isChapter && name === 'td') {
chapterText += `</td>`;
}
if (isChapter && name === 'tr'){
if (isChapter && name === 'tr') {
chapterText += `</tr>`;
}
if (isChapter && name === 'tbody'){
if (isChapter && name === 'tbody') {
chapterText += `</tbody>`;
}
if (isChapter && name === 'table'){
if (isChapter && name === 'table') {
chapterText += `</table>`;
}
if (isChapter && name === 'div'){
if (isChapter && name === 'div') {
isStyleText = false;
chapterText += `</div>`
chapterText += `</div>`;
}
}
})
parser.write(body)
},
});
parser.write(body);
parser.end();
return chapterText;
@@ -339,13 +342,16 @@ class LightNovelPub implements Plugin.PagePlugin {
const link = `${this.site}search`;
const response = await fetchApi(link).then(r => r.text());
let verifytoken = '';
const parser = new Parser ({
const parser = new Parser({
onopentag(name, attribs) {
if (name === 'input' && attribs['name']?.includes('LNRequestVerifyToken')){
if (
name === 'input' &&
attribs['name']?.includes('LNRequestVerifyToken')
) {
verifytoken = attribs['value'];
}
},
})
});
parser.write(response);
parser.end();
@@ -358,11 +364,7 @@ class LightNovelPub implements Plugin.PagePlugin {
body: formData,
}).then(r => r.json());
return this.parseNovels(body.resultview)
}
async fetchImage(url: string): Promise<string | undefined> {
return fetchFile(url, { headers: this.headers });
return this.parseNovels(body.resultview);
}
filters = {
+70 -71
View File
@@ -28,15 +28,15 @@ class LnMTLPlugin implements Plugin.PagePlugin {
const html = await body.text();
const baseUrl = this.site;
let isParsingNovel = false;
let tempNovel = {} as Plugin.NovelItem;
let tempNovel = {} as Plugin.NovelItem;
const novels: Plugin.NovelItem[] = [];
const parser = new Parser ({
const parser = new Parser({
onopentag(name, attribs) {
if (attribs['class']?.includes('media-left')) {
isParsingNovel = true;
}
if (isParsingNovel) {
switch (name){
switch (name) {
case 'a':
tempNovel.path = attribs['href'].slice(baseUrl.length);
break;
@@ -45,14 +45,14 @@ class LnMTLPlugin implements Plugin.PagePlugin {
tempNovel.cover = attribs['src'];
break;
}
if (tempNovel.path && tempNovel.name){
if (tempNovel.path && tempNovel.name) {
novels.push(tempNovel);
tempNovel = {} as Plugin.NovelItem;
}
}
},
onclosetag(name){
if (name === 'div'){
onclosetag(name) {
if (name === 'div') {
isParsingNovel = false;
}
},
@@ -83,59 +83,59 @@ class LnMTLPlugin implements Plugin.PagePlugin {
let isSource = false;
let isPanelKey = false;
let isPanelValue = 0;
let isAuthorKey = false
let isStatusKey = false
let isAuthorKey = false;
let isStatusKey = false;
let isList = 0;
let isGenres = false;
let genreArray: string[] = []
let genreArray: string[] = [];
const parser = new Parser({
onopentag(name,attribs) {
if (name === 'img' && attribs['class']?.includes('img-rounded')){
onopentag(name, attribs) {
if (name === 'img' && attribs['class']?.includes('img-rounded')) {
novel.name = attribs['title'];
novel.cover = attribs['src'];
}
if (name === 'ul' && attribs['class']?.includes('list-inline')){
if (name === 'ul' && attribs['class']?.includes('list-inline')) {
isList++;
}
},
onopentagname(name){
if (name === 'dt'){
onopentagname(name) {
if (name === 'dt') {
isPanelKey = true;
}
if (name === 'dd'){
if (name === 'dd') {
isPanelValue++;
}
if (isList === 1 && name === 'li'){
if (isList === 1 && name === 'li') {
isGenres = true;
}
},
onattribute(name, value){
if (name === 'class' && value === 'description'){
onattribute(name, value) {
if (name === 'class' && value === 'description') {
isDescription = true;
}
if (name === 'class' && value === 'source'){
if (name === 'class' && value === 'source') {
isDescription = false;
isSource = true;
}
if (name === 'class' && value === 'progress'){
if (name === 'class' && value === 'progress') {
isSource = false;
}
},
ontext(data){
if(isScript){
ontext(data) {
if (isScript) {
const volume = JSON.parse(
data.match(/lnmtl.volumes = (.+])(?=;)/)![1] || ''
data.match(/lnmtl.volumes = (.+])(?=;)/)![1] || '',
);
novel.totalPages = volume.length;
}
if(isDescription){
if (isDescription) {
novel.summary += data.trim() + '\n\n';
}
if(isSource){
if (isSource) {
novel.summary += data;
}
if(isPanelKey){
switch(data){
if (isPanelKey) {
switch (data) {
case 'Authors':
isAuthorKey = true;
break;
@@ -144,32 +144,32 @@ class LnMTLPlugin implements Plugin.PagePlugin {
break;
}
}
if(isAuthorKey && isPanelValue === 1){
if (isAuthorKey && isPanelValue === 1) {
novel.author += data.trim();
isAuthorKey = false;
}
if(isStatusKey && isPanelValue === 2){
if (isStatusKey && isPanelValue === 2) {
novel.status += data.trim();
isStatusKey = false;
}
if(isGenres){
if (isGenres) {
genreArray.push(data.trim());
novel.genres = genreArray.join(', ');
}
},
onclosetag(name){
if (name === 'ul'){
onclosetag(name) {
if (name === 'ul') {
isGenres = false;
}
if(name === 'main'){
if (name === 'main') {
isPanelKey = false;
isScript = true;
}
if (name === 'script'){
if (name === 'script') {
isScript = false;
}
},
})
});
parser.write(html);
parser.end();
return novel;
@@ -182,25 +182,25 @@ class LnMTLPlugin implements Plugin.PagePlugin {
let volume: VolumeEntry = {
id: '',
title: '',
}
};
const parser = new Parser({
ontext(data){
if(isScript){
ontext(data) {
if (isScript) {
const volumes = JSON.parse(
data.match(/lnmtl.volumes = (.+])(?=;)/)![1] || ''
data.match(/lnmtl.volumes = (.+])(?=;)/)![1] || '',
);
volume = volumes[+page-1]
volume = volumes[+page - 1];
}
},
onclosetag(name){
if(name === 'main'){
onclosetag(name) {
if (name === 'main') {
isScript = true;
}
if (name === 'script'){
if (name === 'script') {
isScript = false;
}
},
})
});
parser.write(html);
parser.end();
@@ -243,29 +243,29 @@ class LnMTLPlugin implements Plugin.PagePlugin {
let isText = false;
let chapterText = '';
const parser = new Parser({
onopentag(name,attribs){
if(name === 'sentence' && attribs['class']?.includes('translated')){
onopentag(name, attribs) {
if (name === 'sentence' && attribs['class']?.includes('translated')) {
isText = true;
chapterText += '<p>'
chapterText += '<p>';
}
},
onopentagname(name){
if(name === 'nav'){
onopentagname(name) {
if (name === 'nav') {
isText = false;
}
},
ontext(data){
if(isText){
ontext(data) {
if (isText) {
chapterText += data;
}
},
onclosetag(name){
if (name === 'sentence'){
chapterText += '</p>'
onclosetag(name) {
if (name === 'sentence') {
chapterText += '</p>';
isText = false;
}
}
})
},
});
parser.write(html);
parser.end();
@@ -281,31 +281,34 @@ class LnMTLPlugin implements Plugin.PagePlugin {
.then(r => r.replace(/>\s+</g, '><'));
let isScript = false;
let isFooter = false;
let list = ''
let list = '';
const parser = new Parser({
onopentag(name, attribs) {
if(isFooter && name === 'script' &&
attribs['type']?.includes('application/javascript')){
if (
isFooter &&
name === 'script' &&
attribs['type']?.includes('application/javascript')
) {
isScript = true;
}
},
ontext(data){
if (isScript){
ontext(data) {
if (isScript) {
list = data.match(/prefetch: '\/(.*json)/)![1];
}
},
onclosetag(name){
if (name === 'footer'){
onclosetag(name) {
if (name === 'footer') {
isFooter = true;
}
if (name === 'script'){
if (name === 'script') {
isScript = false;
}
if (name === 'body'){
if (name === 'body') {
isFooter = false;
}
}
})
},
});
parser.write(html);
parser.end();
@@ -332,10 +335,6 @@ class LnMTLPlugin implements Plugin.PagePlugin {
return novels;
}
async fetchImage(url: string): Promise<string | undefined> {
return await fetchFile(url);
}
filters = {
order: {
value: 'favourites',
-5
View File
@@ -145,11 +145,6 @@ class MTLNovel implements Plugin.PluginBase {
return novels;
}
async fetchImage(url: string): Promise<string | undefined> {
const headers = new Headers();
headers.append('Alt-Used', 'www.mtlnovel.com');
return fetchFile(url, { headers });
}
filters = {
order: {
-4
View File
@@ -103,9 +103,5 @@ class MTLReader implements Plugin.PluginBase {
const loadedCheerio = parseHTML(seacrhBody);
return this.parseNovels(loadedCheerio);
}
async fetchImage(url: string): Promise<string | undefined> {
return fetchFile(url);
}
}
export default new MTLReader();
+5 -8
View File
@@ -9,6 +9,11 @@ class NovelBin implements Plugin.PluginBase {
icon = 'src/en/novelbin/icon.png';
site = 'https://binnovel.com/';
version = '1.0.1';
imageRequestInit?: Plugin.ImageRequestInit | undefined = {
headers: {
'referrer': this.site,
},
};
parseNovels(loadedCheerio: CheerioAPI) {
const novels: Plugin.NovelItem[] = [];
@@ -143,14 +148,6 @@ class NovelBin implements Plugin.PluginBase {
return this.parseNovels(loadedCheerio);
}
async fetchImage(url: string): Promise<string | undefined> {
return fetchFile(url, {
headers: {
'referrer': this.site,
},
});
}
filters = {
sort: {
value: 'popular-novels',
-4
View File
@@ -169,10 +169,6 @@ class NovelBuddy implements Plugin.PluginBase {
const loadedCheerio = parseHTML(body);
return this.parseNovels(loadedCheerio);
}
async fetchImage(url: string): Promise<string | undefined> {
return fetchFile(url);
}
}
export default new NovelBuddy();
-4
View File
@@ -135,10 +135,6 @@ class NovelFull implements Plugin.PluginBase {
return this.parseNovels(loadedCheerio);
}
async fetchImage(url: string): Promise<string | undefined> {
return fetchFile(url);
}
filters = {
sort: {
value: 'most-popular',
-3
View File
@@ -126,9 +126,6 @@ class NovelHall implements Plugin.PluginBase {
return novels;
}
async fetchImage(url: string): Promise<string | undefined> {
return fetchFile(url);
}
}
export default new NovelHall();
-4
View File
@@ -713,10 +713,6 @@ class NovelUpdates implements Plugin.PluginBase {
return this.parseNovels(loadedCheerio);
}
fetchImage(url: string): Promise<string | undefined> {
return fetchFile(url);
}
filters = {
sort: {
label: 'Sort Results By',
-4
View File
@@ -137,10 +137,6 @@ class PawRead implements Plugin.PluginBase {
return this.parseNovels(loadedCheerio);
}
async fetchImage(url: string): Promise<string | undefined> {
return fetchFile(url);
}
filters = {
status: {
value: '',
+108 -119
View File
@@ -19,49 +19,51 @@ class RanobesPlugin implements Plugin.PagePlugin {
const novels: Plugin.NovelItem[] = [];
let tempNovel = {} as Plugin.NovelItem;
tempNovel.name = '';
const baseUrl = this.site
const baseUrl = this.site;
let isParsingNovel = false;
let isTitleTag = false;
let isNovelName = false;
const parser = new Parser({
onopentag(name, attribs) {
if (attribs['class']?.includes('short-cont')){
if (attribs['class']?.includes('short-cont')) {
isParsingNovel = true;
}
if (isParsingNovel){
if (name === 'h2' && attribs['class']?.includes('title')){
if (isParsingNovel) {
if (name === 'h2' && attribs['class']?.includes('title')) {
isTitleTag = true;
}
if (isTitleTag && name === 'a'){
if (isTitleTag && name === 'a') {
tempNovel.path = attribs['href'].slice(baseUrl.length);
isNovelName = true;
}
if (name === 'figure'){
tempNovel.cover = attribs['style']
.replace(/.*url\((.*?)\)./g, '$1');
if (name === 'figure') {
tempNovel.cover = attribs['style'].replace(
/.*url\((.*?)\)./g,
'$1',
);
}
if (tempNovel.path && tempNovel.cover){
if (tempNovel.path && tempNovel.cover) {
novels.push(tempNovel);
tempNovel = {} as Plugin.NovelItem;
tempNovel.name = '';
}
}
},
ontext(data){
if(isNovelName){
ontext(data) {
if (isNovelName) {
tempNovel.name += data;
}
},
onclosetag(name){
if(name === 'h2'){
onclosetag(name) {
if (name === 'h2') {
isNovelName = false;
isTitleTag = false;
}
if(name === 'figure'){
if (name === 'figure') {
isParsingNovel = false;
}
}
})
},
});
parser.write(html);
parser.end();
return novels;
@@ -104,7 +106,7 @@ class RanobesPlugin implements Plugin.PagePlugin {
summary: '',
chapters: [],
totalPages: 1,
}
};
let baseUrl = this.site;
let isCover = false;
let isAuthor = false;
@@ -113,108 +115,102 @@ class RanobesPlugin implements Plugin.PagePlugin {
let isStatusText = false;
let isGenres = false;
let isGenresText = false;
let genreArray: string[] = []
let genreArray: string[] = [];
let novelId = '';
const parser = new Parser ({
onopentag(name,attribs){
if (attribs['class'] === 'poster'){
const parser = new Parser({
onopentag(name, attribs) {
if (attribs['class'] === 'poster') {
isCover = true;
}
if (isCover && name === 'img'){
if (isCover && name === 'img') {
novel.name = attribs['alt'];
novel.cover = baseUrl + attribs['src'];
}
if (name === 'div' && attribs['class'] === 'moreless'){
if (name === 'div' && attribs['class'] === 'moreless') {
isSummary = true;
}
if (name === 'li' && attribs['title']?.includes('Original status')){
if (name === 'li' && attribs['title']?.includes('Original status')) {
isStatus = true;
}
if (name === 'input' && attribs['name'] === 'newsid'){
novelId = attribs['value']
if (name === 'input' && attribs['name'] === 'newsid') {
novelId = attribs['value'];
}
},
onopentagname(name){
if (isSummary && name === 'br'){
onopentagname(name) {
if (isSummary && name === 'br') {
novel.summary += `/n`;
}
if (isStatus && name === 'a'){
if (isStatus && name === 'a') {
isStatusText = true;
}
if (isGenres && name === 'a'){
if (isGenres && name === 'a') {
isGenresText = true;
}
},
onattribute(name,value){
if (name === 'itemprop' && value === 'creator'){
onattribute(name, value) {
if (name === 'itemprop' && value === 'creator') {
isAuthor = true;
}
if (name === 'id' && value === 'mc-fs-genre'){
if (name === 'id' && value === 'mc-fs-genre') {
isGenres = true;
}
},
ontext(data){
if(isAuthor){
ontext(data) {
if (isAuthor) {
novel.author = data;
}
if(isSummary){
if (isSummary) {
novel.summary += data;
}
if(isStatusText){
novel.status = data === 'Ongoing'
? 'Ongoing'
: 'Completed';
if (isStatusText) {
novel.status = data === 'Ongoing' ? 'Ongoing' : 'Completed';
}
if(isGenresText){
if (isGenresText) {
genreArray.push(data);
}
},
onclosetag(name){
if(name === 'a'){
onclosetag(name) {
if (name === 'a') {
isCover = false;
isAuthor = false;
isStatusText = false;
isGenresText = false;
isStatus = false;
}
if(name === 'div'){
if (name === 'div') {
isSummary = false;
isGenres = false;
}
}
})
},
});
parser.write(html);
parser.end();
novel.genres = genreArray.join(', ');
const chapterListUrl = this.site + '/chapters/' + novelId + '/';
const chaptersHtml = await fetchApi(chapterListUrl).then(r =>
r.text(),
);
let dataJson: {
pages_count: string,
chapters: ChapterEntry[]
} = { pages_count: '', chapters : [] };
const chaptersHtml = await fetchApi(chapterListUrl).then(r => r.text());
let dataJson: {
pages_count: string;
chapters: ChapterEntry[];
} = { pages_count: '', chapters: [] };
let isScript = false;
const parser2 = new Parser ({
ontext(data){
if(isScript){
if (data.includes('window.__DATA__ =')){
dataJson = JSON.parse(
data.replace('window.__DATA__ =', '')
);
const parser2 = new Parser({
ontext(data) {
if (isScript) {
if (data.includes('window.__DATA__ =')) {
dataJson = JSON.parse(data.replace('window.__DATA__ =', ''));
}
}
},
onclosetag(name){
if(name === 'main'){
onclosetag(name) {
if (name === 'main') {
isScript = true;
}
if (name === 'script'){
if (name === 'script') {
isScript = false;
}
},
})
});
parser2.write(chaptersHtml);
parser2.end();
@@ -241,29 +237,27 @@ class RanobesPlugin implements Plugin.PagePlugin {
const pageUrl = firstUrl + '/page/' + page;
const pageBody = await fetchApi(pageUrl).then(r => r.text());
let isScript = false;
let dataJson: {
pages_count: string,
chapters: ChapterEntry[]
} = { pages_count: '', chapters : [] };
let dataJson: {
pages_count: string;
chapters: ChapterEntry[];
} = { pages_count: '', chapters: [] };
const parser = new Parser({
ontext(data){
if(isScript){
if (data.includes('window.__DATA__ =')){
dataJson = JSON.parse(
data.replace('window.__DATA__ =', '')
);
ontext(data) {
if (isScript) {
if (data.includes('window.__DATA__ =')) {
dataJson = JSON.parse(data.replace('window.__DATA__ =', ''));
}
}
},
onclosetag(name){
if(name === 'main'){
onclosetag(name) {
if (name === 'main') {
isScript = true;
}
if (name === 'script'){
if (name === 'script') {
isScript = false;
}
}
})
},
});
parser.write(pageBody);
parser.end();
const chapters = this.parseChapters(dataJson);
@@ -280,92 +274,92 @@ class RanobesPlugin implements Plugin.PagePlugin {
let isPtag = false;
let isStyleText = false;
const parser = new Parser({
onopentag(name,attribs){
if (isChapter && name === 'div'){
let stylediv = attribs['style']
if(stylediv){
chapterText += `<div style="${stylediv}">`
onopentag(name, attribs) {
if (isChapter && name === 'div') {
let stylediv = attribs['style'];
if (stylediv) {
chapterText += `<div style="${stylediv}">`;
isStyleText = true;
} else {
chapterText += `<div>`
chapterText += `<div>`;
}
}
if (isChapter && name === 'table'){
if (isChapter && name === 'table') {
let w = attribs['width'];
if(w) {
if (w) {
chapterText += `<table width="${w}">`;
} else {
chapterText += `<table>`;
}
}
if (isChapter && name === 'tbody'){
if (isChapter && name === 'tbody') {
chapterText += `<tbody>`;
}
if (isChapter && name === 'tr'){
if (isChapter && name === 'tr') {
chapterText += `<tr>`;
}
if (isChapter && name === 'td'){
if (isChapter && name === 'td') {
let w1 = attribs['width'];
if(w1) {
if (w1) {
chapterText += `<td width="${w1}">`;
} else {
chapterText += `<td>`;
}
}
},
onattribute(name, value){
if (name === 'id' && value === 'arrticle'){
onattribute(name, value) {
if (name === 'id' && value === 'arrticle') {
isChapter = true;
}
if (name === 'class' && value === 'category grey ellipses'){
if (name === 'class' && value === 'category grey ellipses') {
isChapter = false;
isPtag = false;
}
},
onopentagname(name){
if (isChapter && name === 'p'){
onopentagname(name) {
if (isChapter && name === 'p') {
chapterText += '<p>';
isPtag = true;
if(isStyleText){
if (isStyleText) {
isStyleText = false;
}
}
if (isChapter && name === 'br'){
if (isChapter && name === 'br') {
chapterText += `<br>`;
}
},
ontext(data){
if(isPtag){
ontext(data) {
if (isPtag) {
chapterText += data;
}
if(isStyleText){
if (isStyleText) {
chapterText += data;
}
},
onclosetag(name){
if (name === 'p'){
onclosetag(name) {
if (name === 'p') {
isPtag = false;
chapterText += '</p>'
chapterText += '</p>';
}
if (isChapter && name === 'td'){
if (isChapter && name === 'td') {
chapterText += `</td>`;
}
if (isChapter && name === 'tr'){
if (isChapter && name === 'tr') {
chapterText += `</tr>`;
}
if (isChapter && name === 'tbody'){
if (isChapter && name === 'tbody') {
chapterText += `</tbody>`;
}
if (isChapter && name === 'table'){
if (isChapter && name === 'table') {
chapterText += `</table>`;
}
if (isChapter && name === 'div'){
if (isChapter && name === 'div') {
isStyleText = false;
chapterText += `</div>`
chapterText += `</div>`;
}
}
})
parser.write(html)
},
});
parser.write(html);
parser.end();
return chapterText;
@@ -380,11 +374,6 @@ class RanobesPlugin implements Plugin.PagePlugin {
return this.parseNovels(body);
}
async fetchImage(url: string): Promise<string | undefined> {
return await fetchFile(url);
}
}
export default new RanobesPlugin();
@@ -393,4 +382,4 @@ interface ChapterEntry {
title: string;
date: string;
link: string;
}
}
-4
View File
@@ -174,10 +174,6 @@ class ReadLiteNovel implements Plugin.PluginBase {
return novels;
}
async fetchImage(url: string): Promise<string | undefined> {
return fetchFile(url);
}
filters = {
order: {
value: 'top-rated',
-4
View File
@@ -382,10 +382,6 @@ class ReLibraryPlugin implements Plugin.PluginBase {
this.searchFunc.setHaystack(novels);
return this.searchFunc.search(searchTerm);
}
async fetchImage(url: string): Promise<string | undefined> {
return fetchFile(url, { headers: { referer: this.site } });
}
}
export default new ReLibraryPlugin();
+91 -95
View File
@@ -18,37 +18,37 @@ class RoyalRoad implements Plugin.PluginBase {
let isParsingNovel = false;
let isNovelName = false;
const parser = new Parser({
onopentag(name, attribs){
if (attribs['class']?.includes('fiction-list-item')){
onopentag(name, attribs) {
if (attribs['class']?.includes('fiction-list-item')) {
isParsingNovel = true;
}
if (isParsingNovel){
if (name === 'a' && attribs['class']?.includes('bold')){
if (isParsingNovel) {
if (name === 'a' && attribs['class']?.includes('bold')) {
tempNovel.path = attribs['href'].slice(1);
isNovelName = true;
}
if (name === 'img'){
if (name === 'img') {
tempNovel.cover = attribs['src'];
}
if (tempNovel.path && tempNovel.name){
if (tempNovel.path && tempNovel.name) {
novels.push(tempNovel);
tempNovel = {} as Plugin.NovelItem;
tempNovel.name = '';
}
}
},
ontext(data){
if(isNovelName){
ontext(data) {
if (isNovelName) {
tempNovel.name += data;
}
},
onclosetag(name){
if(name === 'h2'){
onclosetag(name) {
if (name === 'h2') {
isNovelName = false;
isParsingNovel = false;
}
}
})
},
});
parser.write(html);
parser.end();
return novels;
@@ -64,9 +64,9 @@ class RoyalRoad implements Plugin.PluginBase {
link += `?page=${page}`;
if (filters.genre.value !== '') link += `&genre=${filters.genre.value}`;
const body = await fetchApi(link).then(r => r.text());
return this.parseNovels(body);
}
@@ -78,110 +78,110 @@ class RoyalRoad implements Plugin.PluginBase {
name: '',
summary: '',
chapters: [],
}
};
let isNovelName = false;
let isAuthorName = false;
let isDescription = false;
let isH4 = false;
let isSpan = 0
let isSpan = 0;
let isTags = false;
let isGenres = false;
let genreArray: string[] = []
let genreArray: string[] = [];
let isFooter = false;
let isScript = false;
let chapterJson: ChapterEntry[] = [];
let volumeJson: VolumeEntry[] = [];
const parser = new Parser ({
onopentag(name,attribs){
if (name === 'img' && attribs['class']?.includes('thumbnail')){
const parser = new Parser({
onopentag(name, attribs) {
if (name === 'img' && attribs['class']?.includes('thumbnail')) {
novel.cover = attribs['src'];
}
if (name === 'span' && attribs['class']?.includes('label-sm')){
if (name === 'span' && attribs['class']?.includes('label-sm')) {
isSpan++;
}
if (name === 'span' && attribs['class']?.includes('tags')){
if (name === 'span' && attribs['class']?.includes('tags')) {
isTags = true;
}
},
onopentagname(name){
if (name === 'h1'){
onopentagname(name) {
if (name === 'h1') {
isNovelName = true;
}
if (isH4 && name === 'a'){
if (isH4 && name === 'a') {
isAuthorName = true;
}
if(isTags && name === 'a'){
if (isTags && name === 'a') {
isGenres = true;
}
if (name === 'label'){
if (name === 'label') {
isDescription = false;
isTags = false;
}
if (isFooter && name === 'script'){
if (isFooter && name === 'script') {
isScript = true;
}
},
onattribute(name,value){
if (name === 'class' && value === 'description'){
onattribute(name, value) {
if (name === 'class' && value === 'description') {
isDescription = true;
}
if (name === 'class' && value === 'page-footer footer'){
if (name === 'class' && value === 'page-footer footer') {
isFooter = true;
}
},
ontext(data){
if (isNovelName){
ontext(data) {
if (isNovelName) {
novel.name = data;
}
if (isAuthorName){
if (isAuthorName) {
novel.author = data;
isAuthorName = false;
}
if (isDescription){
if (isDescription) {
novel.summary += data;
}
if (isSpan === 2){
if (isSpan === 2) {
novel.status = data.trim();
isSpan++;
}
if (isGenres){
if (isGenres) {
genreArray.push(data);
}
if (isScript){
if (data.includes('window.chapters =')){
if (isScript) {
if (data.includes('window.chapters =')) {
chapterJson = JSON.parse(
data.match(/window.chapters = (.+])(?=;)/)![1]
)
data.match(/window.chapters = (.+])(?=;)/)![1],
);
volumeJson = JSON.parse(
data.match(/window.volumes = (.+])(?=;)/)![1]
)
data.match(/window.volumes = (.+])(?=;)/)![1],
);
}
}
},
onclosetag(name){
if (name === 'h1'){
onclosetag(name) {
if (name === 'h1') {
isNovelName = false;
isH4 = true;
}
if (name === 'h4'){
if (name === 'h4') {
isH4 = false;
}
if (name === 'a'){
if (name === 'a') {
isGenres = false;
}
if (name === 'script'){
if (name === 'script') {
isScript = false;
}
if (name === 'body'){
if (name === 'body') {
isFooter = false;
}
}
})
},
});
parser.write(html);
parser.end();
novel.summary = novel.summary?.trim();
novel.genres = genreArray.join(', ');
switch(novel.status){
switch (novel.status) {
case 'ONGOING':
novel.status = NovelStatus.Ongoing;
break;
@@ -224,106 +224,106 @@ class RoyalRoad implements Plugin.PluginBase {
let isStyleText = false;
let styles = '';
const parser = new Parser({
onopentag(name,attribs){
if (isChapter && name === 'div'){
let stylediv = attribs['style']
if(stylediv){
chapterText += `<div style="${stylediv}">`
onopentag(name, attribs) {
if (isChapter && name === 'div') {
let stylediv = attribs['style'];
if (stylediv) {
chapterText += `<div style="${stylediv}">`;
isStyleText = true;
} else {
chapterText += `<div>`
chapterText += `<div>`;
}
}
if (isChapter && name === 'table'){
if (isChapter && name === 'table') {
let w = attribs['width'];
if(w) {
if (w) {
chapterText += `<table width="${w}">`;
} else {
chapterText += `<table>`;
}
}
if (isChapter && name === 'tbody'){
if (isChapter && name === 'tbody') {
chapterText += `<tbody>`;
}
if (isChapter && name === 'tr'){
if (isChapter && name === 'tr') {
chapterText += `<tr>`;
}
if (isChapter && name === 'td'){
if (isChapter && name === 'td') {
let w1 = attribs['width'];
if(w1) {
if (w1) {
chapterText += `<td width="${w1}">`;
} else {
chapterText += `<td>`;
}
}
},
onattribute(name, value){
if (name === 'class' && value === 'chapter-inner chapter-content'){
onattribute(name, value) {
if (name === 'class' && value === 'chapter-inner chapter-content') {
isChapter = true;
}
if (name === 'class' && value === 'portlet light t-center-3'){
if (name === 'class' && value === 'portlet light t-center-3') {
isChapter = false;
isPtag = false;
}
if (name === 'class' && value === styles){
if (name === 'class' && value === styles) {
isPtag = false;
}
},
onopentagname(name){
if (isChapter && name === 'p'){
onopentagname(name) {
if (isChapter && name === 'p') {
chapterText += '<p>';
isPtag = true;
if(isStyleText){
if (isStyleText) {
isStyleText = false;
}
}
if (name === 'style'){
if (name === 'style') {
isStyle = true;
}
if (isChapter && name === 'br'){
if (isChapter && name === 'br') {
chapterText += `<br>`;
}
},
ontext(data){
if(isPtag){
ontext(data) {
if (isPtag) {
chapterText += data;
}
if(isStyleText){
if (isStyleText) {
chapterText += data;
}
if (isStyle){
if (data.includes('display: none;')){
if (isStyle) {
if (data.includes('display: none;')) {
styles = data.match(/\.(.*)\{/)![1];
}
}
},
onclosetag(name){
if (name === 'p'){
onclosetag(name) {
if (name === 'p') {
isPtag = false;
chapterText += '</p>'
chapterText += '</p>';
}
if (name === 'style'){
if (name === 'style') {
isStyle = false;
}
if (isChapter && name === 'td'){
if (isChapter && name === 'td') {
chapterText += `</td>`;
}
if (isChapter && name === 'tr'){
if (isChapter && name === 'tr') {
chapterText += `</tr>`;
}
if (isChapter && name === 'tbody'){
if (isChapter && name === 'tbody') {
chapterText += `</tbody>`;
}
if (isChapter && name === 'table'){
if (isChapter && name === 'table') {
chapterText += `</table>`;
}
if (isChapter && name === 'div'){
if (isChapter && name === 'div') {
isStyleText = false;
chapterText += `</div>`
chapterText += `</div>`;
}
}
})
parser.write(html)
},
});
parser.write(html);
parser.end();
return chapterText;
@@ -339,10 +339,6 @@ class RoyalRoad implements Plugin.PluginBase {
return this.parseNovels(body);
}
async fetchImage(url: string): Promise<string | undefined> {
return fetchFile(url);
}
filters = {
order: {
value: 'weekly-popular',
-4
View File
@@ -185,10 +185,6 @@ class ScribbleHubPlugin implements Plugin.PluginBase {
return this.parseNovels(loadedCheerio);
}
async fetchImage(url: string): Promise<string | undefined> {
return await fetchFile(url);
}
filters = {
sort: {
label: 'Sort Results By',
-1
View File
@@ -170,7 +170,6 @@ class WTRLAB implements Plugin.PluginBase {
return novels;
}
fetchImage = fetchFile;
filters = {
order: {
value: 'chapter',
-4
View File
@@ -285,10 +285,6 @@ class WuxiaWorld implements Plugin.PluginBase {
return this.parseNovels(data);
}
fetchImage(url: string): Promise<string | undefined> {
return fetchFile(url);
}
proto = `
syntax = "proto3";
option optimize_for = CODE_SIZE;
-2
View File
@@ -250,8 +250,6 @@ class ChireadsPlugin implements Plugin.PluginBase {
return novels;
}
fetchImage = fetchFile;
filters = {
tag: {
type: FilterTypes.Picker,
-6
View File
@@ -173,12 +173,6 @@ class HarkenEliwoodPlugin implements Plugin.PluginBase {
return novels;
}
async fetchImage(url: string): Promise<string | undefined> {
// if your plugin has images and they won't load
// this is the function to fiddle with
return fetchFile(url);
}
}
export default new HarkenEliwoodPlugin();
-2
View File
@@ -292,8 +292,6 @@ class NovelDeGlacePlugin implements Plugin.PluginBase {
return novels;
}
fetchImage = fetchFile;
filters = {
categorie_genre: {
type: FilterTypes.Picker,
-6
View File
@@ -202,12 +202,6 @@ class NovhellPlugin implements Plugin.PluginBase {
return novels;
}
async fetchImage(url: string): Promise<string | undefined> {
// if your plugin has images and they won't load
// this is the function to fiddle with
return fetchFile(url);
}
}
export default new NovhellPlugin();
-7
View File
@@ -172,13 +172,6 @@ class PhenixScansTradPlugin implements Plugin.PluginBase {
return novels;
}
async fetchImage(url: string): Promise<string | undefined> {
const headers = new Headers({
'Referer': `${this.site}`,
});
return await fetchFile(url, { headers });
}
filters = {
genre: {
type: FilterTypes.CheckboxGroup,
-6
View File
@@ -193,12 +193,6 @@ class WarriorLegendTradPlugin implements Plugin.PluginBase {
return novels;
}
async fetchImage(url: string): Promise<string | undefined> {
// if your plugin has images and they won't load
// this is the function to fiddle with
return fetchFile(url);
}
}
export default new WarriorLegendTradPlugin();
-6
View File
@@ -211,12 +211,6 @@ class WuxialnscantradPlugin implements Plugin.PluginBase {
return novels;
}
async fetchImage(url: string): Promise<string | undefined> {
// if your plugin has images and they won't load
// this is the function to fiddle with
return fetchFile(url);
}
}
export default new WuxialnscantradPlugin();
-6
View File
@@ -293,12 +293,6 @@ class XiaowazPlugin implements Plugin.PluginBase {
return await this.getNovelsCovers(novels);
}
async fetchImage(url: string): Promise<string | undefined> {
// if your plugin has images and they won't load
// this is the function to fiddle with
return fetchFile(url);
}
}
export default new XiaowazPlugin();
-4
View File
@@ -131,10 +131,6 @@ class IndoWebNovel implements Plugin.PluginBase {
return this.parseNovels(loadedCheerio);
}
async fetchImage(url: string): Promise<string | undefined> {
return fetchFile(url);
}
filters = {
status: {
value: '',
-4
View File
@@ -140,10 +140,6 @@ class NovelRingan implements Plugin.PluginBase {
return this.parseNovels(loadedCheerio);
}
async fetchImage(url: string): Promise<string | undefined> {
return fetchFile(url);
}
filters = {
status: {
value: '',
-4
View File
@@ -159,10 +159,6 @@ class SakuraNovel implements Plugin.PluginBase {
return this.parseNovels(loadedCheerio);
}
async fetchImage(url: string): Promise<string | undefined> {
return fetchFile(url);
}
filters = {
status: {
value: '',
+1 -3
View File
@@ -217,9 +217,7 @@ class Syosetu implements Plugin.PluginBase {
// respond with novels!
return novels;
}
async fetchImage(url: string): Promise<string | undefined> {
return fetchFile(url);
}
resolveUrl(path: string, isNovel?: boolean | undefined): string {
return this.novelPrefix + path;
}
-1
View File
@@ -155,7 +155,6 @@ class Agitoon implements Plugin.PluginBase {
return novels;
}
fetchImage = fetchFile;
resolveUrl = (path: string, isNovel?: boolean) =>
this.site + (isNovel ? '/novel/list/' : '/novel/view/') + path;
}
+1 -5
View File
@@ -165,11 +165,7 @@ class NovelkiPL implements Plugin.PluginBase {
return novels;
}
async fetchImage(url: string): Promise<string | undefined> {
// if your plugin has images and they won't load
// this is the function to fiddle with
return fetchFile(url);
}
filters = {
genres: {
value: '',
-2
View File
@@ -151,8 +151,6 @@ class freedlit implements Plugin.PluginBase {
return dateString || null;
};
fetchImage = fetchFile;
filters = {
sort: {
label: 'Сортировка:',
-1
View File
@@ -175,7 +175,6 @@ class AuthorToday implements Plugin.PluginBase {
return novels;
}
fetchImage = fetchFile;
resolveUrl = (path: string, isNovel?: boolean) =>
isNovel ? this.site + '/work/' + path : this.site + '/reader/' + path;
-1
View File
@@ -138,7 +138,6 @@ class Bookriver implements Plugin.PluginBase {
return novels;
}
fetchImage = fetchFile;
resolveUrl = (path: string, isNovel?: boolean) =>
this.site + (isNovel ? '/book/' : '/reader/') + path;
-2
View File
@@ -197,8 +197,6 @@ class ficbook implements Plugin.PluginBase {
return dateString || null;
};
fetchImage = fetchFile;
filters = {
sort: {
label: 'Сортировка:',
-2
View File
@@ -193,8 +193,6 @@ class Jaomix implements Plugin.PluginBase {
return dateString || null;
};
fetchImage = fetchFile;
filters = {
sortby: {
label: 'Сортировка:',
-1
View File
@@ -143,7 +143,6 @@ class Neobook implements Plugin.PluginBase {
return chapterText;
}
fetchImage = fetchFile;
resolveUrl = (path: string, isNovel?: boolean) =>
this.site + (isNovel ? '/book/' : '/reader/') + path;
-1
View File
@@ -158,7 +158,6 @@ class novelOvh implements Plugin.PluginBase {
return html;
};
fetchImage = fetchFile;
resolveUrl = (path: string, isNovel?: boolean) =>
this.site + '/novel/' + path;
-1
View File
@@ -195,7 +195,6 @@ class TL implements Plugin.PluginBase {
return chapterText;
}
fetchImage = fetchFile;
resolveUrl = (path: string, isNovel?: boolean) => 'https://' + path;
filters = {
-1
View File
@@ -164,7 +164,6 @@ class RNBH implements Plugin.PluginBase {
return novels;
}
fetchImage = fetchFile;
resolveUrl = (path: string, isNovel?: boolean) =>
this.site + '/ranobe/' + path;
-1
View File
@@ -216,7 +216,6 @@ class RLIB implements Plugin.PluginBase {
return novels;
}
fetchImage = fetchFile;
resolveUrl = (path: string, isNovel?: boolean) => {
const ui = this.user?.ui ? 'ui=' + this.user.ui : '';
-2
View File
@@ -134,8 +134,6 @@ class RNRF implements Plugin.PluginBase {
return novels;
}
fetchImage = fetchFile;
filters = {
sort: {
label: 'Сортировка',
-1
View File
@@ -147,7 +147,6 @@ class ReN implements Plugin.PluginBase {
return novels;
}
fetchImage = fetchFile;
resolveUrl = (path: string, isNovel?: boolean) =>
this.site + '/novel/' + path;
-1
View File
@@ -190,7 +190,6 @@ class Zelluloza implements Plugin.PluginBase {
return null;
};
fetchImage = fetchFile;
resolveUrl = (path: string, isNovel?: boolean) =>
this.site + '/books/' + path;
-3
View File
@@ -136,9 +136,6 @@ class HasulTL implements Plugin.PluginBase {
return novels;
}
async fetchImage(url: string): Promise<string | undefined> {
return fetchFile(url);
}
}
export default new HasulTL();
-3
View File
@@ -176,9 +176,6 @@ class Ligera implements Plugin.PluginBase {
return novels;
}
async fetchImage(url: string): Promise<string | undefined> {
return fetchFile(url);
}
}
export default new Ligera();
-3
View File
@@ -199,9 +199,6 @@ class ReinoWuxia implements Plugin.PluginBase {
return novels;
}
async fetchImage(url: string): Promise<string | undefined> {
return fetchFile(url);
}
}
export default new ReinoWuxia();
-3
View File
@@ -161,9 +161,6 @@ class Oasis implements Plugin.PluginBase {
return novels;
}
async fetchImage(url: string): Promise<string | undefined> {
return fetchFile(url);
}
}
export default new Oasis();
-3
View File
@@ -128,9 +128,6 @@ class SkyNovels implements Plugin.PluginBase {
return novels;
}
async fetchImage(url: string): Promise<string | undefined> {
return fetchFile(url);
}
}
export default new SkyNovels();
-4
View File
@@ -182,10 +182,6 @@ class TuNovelaLigera implements Plugin.PagePlugin {
return novels;
}
async fetchImage(url: string): Promise<string | undefined> {
return await fetchFile(url);
}
filters = {
order: {
value: 'rating',
-3
View File
@@ -179,9 +179,6 @@ class Yuuki implements Plugin.PluginBase {
return novels;
}
fetchImage(url: string): Promise<string | undefined> {
return fetchFile(url);
}
}
export default new Yuuki();
-3
View File
@@ -159,9 +159,6 @@ class EpikNovel implements Plugin.PluginBase {
return novels;
}
fetchImage(url: string): Promise<string | undefined> {
return fetchFile(url);
}
}
export default new EpikNovel();
-3
View File
@@ -166,9 +166,6 @@ class LSHNovel implements Plugin.PluginBase {
return novels;
}
async fetchImage(url: string): Promise<string | undefined> {
return await fetchFile(url);
}
filters = {
order: {
-2
View File
@@ -113,8 +113,6 @@ class Smakolykytl implements Plugin.PluginBase {
);
return novels;
}
fetchImage = fetchFile;
}
export default new Smakolykytl();
+6 -6
View File
@@ -1,5 +1,4 @@
import { Parser } from 'htmlparser2';
import { fetchFile } from '@libs/fetch';
import { HTMLParser2Util, Plugin } from '@typings/plugin';
import { NovelStatus } from '@libs/novelStatus';
import { FilterTypes, Filters } from '@libs/filterInputs';
@@ -395,6 +394,8 @@ class HakoPlugin implements Plugin.PluginBase {
novel.status = NovelStatus.Unknown;
}
novel.genres = novel.genres?.replace(/,*\s*$/, '');
novel.name = novel.name.trim();
novel.summary = novel.summary?.trim();
return novel;
});
}
@@ -416,12 +417,11 @@ class HakoPlugin implements Plugin.PluginBase {
this.site + '/tim-kiem?keywords=' + searchTerm + '&page=' + pageNo;
return this.parseNovels(url);
}
fetchImage(url: string): Promise<string | undefined> {
const headers = {
imageRequestInit: Plugin.ImageRequestInit = {
headers: {
Referer: 'https://ln.hako.vn',
};
return fetchFile(url, { headers: headers });
}
},
};
filters = {
alphabet: {
type: FilterTypes.Picker,
+1 -3
View File
@@ -247,9 +247,7 @@ class TruyenConect implements Plugin.PagePlugin {
return novels;
}
async fetchImage(url: string): Promise<string | undefined> {
return fetchFile(url);
}
filters = {
category: {
label: 'Lọc theo',
-3
View File
@@ -170,9 +170,6 @@ class LightNovelVN implements Plugin.PagePlugin {
}) || [];
return novels;
}
async fetchImage(url: string): Promise<string | undefined> {
return fetchFile(url);
}
}
export default new LightNovelVN();
-3
View File
@@ -119,8 +119,5 @@ class Nettruyen implements Plugin.PagePlugin {
): Promise<Plugin.NovelItem[]> {
throw new Error('Method not implemented.');
}
async fetchImage(url: string): Promise<string | undefined> {
return fetchFile(url);
}
}
export default new Nettruyen();
-3
View File
@@ -151,9 +151,6 @@ class TruyenFull implements Plugin.PagePlugin {
const loadedCheerio = parseHTML(body);
return this.parseNovels(loadedCheerio);
}
async fetchImage(url: string): Promise<string | undefined> {
return fetchFile(url);
}
}
export default new TruyenFull();
-3
View File
@@ -142,9 +142,6 @@ class TruyenFull implements Plugin.PagePlugin {
const loadedCheerio = parseHTML(body);
return this.parseNovels(loadedCheerio);
}
async fetchImage(url: string): Promise<string | undefined> {
return fetchFile(url);
}
}
export default new TruyenFull();