feat(source): Add Liebe Schnee Hiver Novel (Closes LNReader/lnreader-sources#232)
This commit is contained in:
@@ -2,6 +2,13 @@ import WPMangaStreamScraper from './WPMangaStreamScraper';
|
||||
|
||||
export const KolNovelScraper = new WPMangaStreamScraper(
|
||||
53,
|
||||
'https://alightnovel.com/',
|
||||
'https://kolnovel.com/',
|
||||
'KolNovel',
|
||||
);
|
||||
|
||||
export const LiebeSchneeHiverNovelScraper = new WPMangaStreamScraper(
|
||||
123,
|
||||
'https://lshnovel.com/',
|
||||
'Liebe Schnee Hiver Novel',
|
||||
{ totalPages: 1 },
|
||||
);
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
import * as cheerio from 'cheerio';
|
||||
class WPMangaStreamScraper {
|
||||
constructor(sourceId, baseUrl, sourceName) {
|
||||
constructor(sourceId, baseUrl, sourceName, options) {
|
||||
this.sourceId = sourceId;
|
||||
this.baseUrl = baseUrl;
|
||||
this.sourceName = sourceName;
|
||||
this.language = options?.language;
|
||||
this.totalPages = options?.totalPages;
|
||||
}
|
||||
|
||||
async popularNovels(page) {
|
||||
let totalPages = 100;
|
||||
let totalPages = this.totalPages;
|
||||
let url = this.baseUrl + 'series/?page=' + page + '&status=&order=popular';
|
||||
let sourceId = this.sourceId;
|
||||
|
||||
@@ -23,7 +25,7 @@ class WPMangaStreamScraper {
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('src');
|
||||
|
||||
let novelUrl = loadedCheerio(this).find('a').attr('href').split('/')[4];
|
||||
const novelUrl = loadedCheerio(this).find('a').attr('href');
|
||||
|
||||
const novel = {
|
||||
sourceId,
|
||||
@@ -39,7 +41,7 @@ class WPMangaStreamScraper {
|
||||
}
|
||||
|
||||
async parseNovelAndChapters(novelUrl) {
|
||||
const url = `${this.baseUrl}series/${novelUrl}/`;
|
||||
const url = novelUrl;
|
||||
|
||||
const result = await fetch(url);
|
||||
const body = await result.text();
|
||||
@@ -64,19 +66,20 @@ class WPMangaStreamScraper {
|
||||
const detailName = loadedCheerio(this).find('b').text().trim();
|
||||
const detail = loadedCheerio(this).find('b').next().text().trim();
|
||||
|
||||
if (loadedCheerio(this).text().includes('الحالة:')) {
|
||||
novel.status = loadedCheerio(this).text().replace('الحالة: ', '');
|
||||
}
|
||||
|
||||
switch (detailName) {
|
||||
case 'المؤلف:':
|
||||
novel.auhtor = detail;
|
||||
case 'Yazar:':
|
||||
novel.author = detail;
|
||||
break;
|
||||
case 'Seviye:':
|
||||
novel.status = detail;
|
||||
break;
|
||||
case 'Tür:':
|
||||
novel.genre = detail?.replace(/\s/g, ',');
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
novel.genre = loadedCheerio('.genxed').text().replace(/\s/g, ',');
|
||||
|
||||
novel.summary = loadedCheerio('div[itemprop="description"]').text().trim();
|
||||
|
||||
let novelChapters = [];
|
||||
@@ -91,15 +94,12 @@ class WPMangaStreamScraper {
|
||||
|
||||
const releaseDate = loadedCheerio(this).find('.epl-date').text().trim();
|
||||
|
||||
const chapterUrl = loadedCheerio(this)
|
||||
.find('a')
|
||||
.attr('href')
|
||||
.split('/')[3];
|
||||
const chapterUrl = loadedCheerio(this).find('a').attr('href');
|
||||
|
||||
novelChapters.push({ chapterName, releaseDate, chapterUrl });
|
||||
});
|
||||
|
||||
novel.chapters = novelChapters.reverse();
|
||||
novel.chapters = novelChapters;
|
||||
|
||||
return novel;
|
||||
}
|
||||
@@ -107,7 +107,7 @@ class WPMangaStreamScraper {
|
||||
async parseChapter(novelUrl, chapterUrl) {
|
||||
let sourceId = this.sourceId;
|
||||
|
||||
const url = `${this.baseUrl}${chapterUrl}`;
|
||||
const url = chapterUrl;
|
||||
|
||||
const result = await fetch(url);
|
||||
const body = await result.text();
|
||||
@@ -141,10 +141,8 @@ class WPMangaStreamScraper {
|
||||
|
||||
loadedCheerio('article.bs').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.ntitle').text().trim();
|
||||
let image = loadedCheerio(this).find('img');
|
||||
const novelCover = image.attr('src');
|
||||
|
||||
let novelUrl = loadedCheerio(this).find('a').attr('href').split('/')[4];
|
||||
const novelCover = loadedCheerio(this).find('img').attr('src');
|
||||
const novelUrl = loadedCheerio(this).find('a').attr('href');
|
||||
|
||||
const novel = {
|
||||
sourceId,
|
||||
|
||||
@@ -73,7 +73,10 @@ import WuxiaCityScraper from './en/wuxiacity';
|
||||
import NovelUpdatesScraper from './en/novelupdates';
|
||||
import RanobesScraper from './en/ranobes';
|
||||
import YushuboScraper from './ch/yushubo';
|
||||
import { KolNovelScraper } from './multisrc/wpmangastream/WPMangaStreamGenerator';
|
||||
import {
|
||||
KolNovelScraper,
|
||||
LiebeSchneeHiverNovelScraper,
|
||||
} from './multisrc/wpmangastream/WPMangaStreamGenerator';
|
||||
import WLNUpdatesScraper from './en/wlnupdates';
|
||||
import ReaperScansScraper from './en/reaperscans';
|
||||
import JaomixScraper from './ru/jaomix';
|
||||
@@ -266,6 +269,7 @@ export const sourceManager = (sourceId: number): Scraper => {
|
||||
120: MTNovelScraper,
|
||||
121: SonicMTLScraper,
|
||||
122: MTLNovelDotClubScraper,
|
||||
123: LiebeSchneeHiverNovelScraper,
|
||||
};
|
||||
|
||||
return scrapers[sourceId];
|
||||
|
||||
@@ -817,5 +817,12 @@
|
||||
"icon": "https://github.com/LNReader/lnreader-sources/blob/master/icons/multisrc/madara/icons/mtlnovel.club.png?raw=true",
|
||||
"url": "https://mtlnovel.club/",
|
||||
"lang": "English"
|
||||
},
|
||||
{
|
||||
"sourceId": 123,
|
||||
"sourceName": "Liebe Schnee Hiver Novel",
|
||||
"url": "https://lshnovel.com/",
|
||||
"icon": "https://github.com/LNReader/lnreader-sources/blob/master/icons/multisrc/wpmangastream/icons/lshnovel.png?raw=true",
|
||||
"lang": "Turkish"
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user