(src update) novel bin (#859)

* quick novel bin fix

* 200 89
This commit is contained in:
K1ngfish3r
2024-03-26 19:27:21 +08:00
committed by GitHub
parent 113c5a1f97
commit 39523ac032
+10 -4
View File
@@ -8,13 +8,15 @@ class NovelBin implements Plugin.PluginBase {
name = 'Novel Bin'; name = 'Novel Bin';
icon = 'src/en/novelbin/icon.png'; icon = 'src/en/novelbin/icon.png';
site = 'https://binnovel.com/'; site = 'https://binnovel.com/';
version = '1.0.0'; version = '1.0.1';
parseNovels(loadedCheerio: CheerioAPI) { parseNovels(loadedCheerio: CheerioAPI) {
const novels: Plugin.NovelItem[] = []; const novels: Plugin.NovelItem[] = [];
loadedCheerio('.col-novel-main .list-novel .row').each((i, el) => { loadedCheerio('.col-novel-main .list-novel .row').each((i, el) => {
const novelName = loadedCheerio(el).find('h3.novel-title > a').text(); const novelName = loadedCheerio(el).find('h3.novel-title > a').text();
const novelCover = loadedCheerio(el).find('img.cover').attr('src'); const novelCover = loadedCheerio(el).find('img.cover')
.attr('data-src')
?.replace('_200_89', '');
const novelUrl = loadedCheerio(el) const novelUrl = loadedCheerio(el)
.find('h3.novel-title > a') .find('h3.novel-title > a')
.attr('href'); .attr('href');
@@ -59,7 +61,7 @@ class NovelBin implements Plugin.PluginBase {
const novel: Plugin.SourceNovel = { const novel: Plugin.SourceNovel = {
path: novelPath, path: novelPath,
name: loadedCheerio('div.book > img').attr('alt') || 'Untitled', name: loadedCheerio('div.book > img').attr('alt') || 'Untitled',
cover: loadedCheerio('div.book > img').attr('src'), cover: loadedCheerio('div.book > img').attr('data-src'),
summary: loadedCheerio('div.desc-text').text().trim(), summary: loadedCheerio('div.desc-text').text().trim(),
chapters: [], chapters: [],
}; };
@@ -141,7 +143,11 @@ class NovelBin implements Plugin.PluginBase {
} }
async fetchImage(url: string): Promise<string | undefined> { async fetchImage(url: string): Promise<string | undefined> {
return fetchFile(url); return fetchFile(url, {
headers: {
'referrer': this.site,
}
});
} }
filters = { filters = {