Fix(plugins): novelovh, zelluloza (#943)

* fix

* xd
This commit is contained in:
Rider21
2024-05-21 09:41:11 +03:00
committed by GitHub
parent 74d81b2ff2
commit 89d4d2471f
8 changed files with 37 additions and 52 deletions
+8 -11
View File
@@ -8,14 +8,14 @@ class novelOvh implements Plugin.PluginBase {
id = 'novelovh';
name = 'НовелОВХ';
site = 'https://novel.ovh';
version = '1.0.1';
version = '1.0.2';
icon = 'src/ru/novelovh/icon.png';
async popularNovels(
pageNo: number,
{ showLatestNovels, filters }: Plugin.PopularNovelsOptions,
): Promise<Plugin.NovelItem[]> {
let url = this.site + '/novel?page=' + (pageNo - 1);
let url = this.site + '/content?page=' + (pageNo - 1);
url +=
'&sort=' +
(showLatestNovels
@@ -41,7 +41,9 @@ class novelOvh implements Plugin.PluginBase {
async parseNovel(novelPath: string): Promise<Plugin.SourceNovel> {
const { book, chapters }: responseNovel = await fetchApi(
this.resolveUrl(novelPath, true) +
this.site +
'/content/' +
novelPath +
'?_data=routes/reader/book/$slug/index',
).then(res => res.json());
@@ -98,14 +100,9 @@ class novelOvh implements Plugin.PluginBase {
return chapterText;
}
async searchNovels(
searchTerm: string,
page: number | undefined = 1,
): Promise<Plugin.NovelItem[]> {
const url = `${this.site}/novel?search=${searchTerm}&page=${page - 1}`;
const { books }: { books: BooksEntity[] } = await fetchApi(
url + '&_data=routes/reader/book/index',
).then(res => res.json());
async searchNovels(searchTerm: string): Promise<Plugin.NovelItem[]> {
const url = `https://api.novel.ovh/v2/books?type=NOVEL&search=${searchTerm}`;
const books: BooksEntity[] = await fetchApi(url).then(res => res.json());
const novels: Plugin.NovelItem[] = [];
books.forEach(novel =>
+6 -8
View File
@@ -10,7 +10,7 @@ class Zelluloza implements Plugin.PluginBase {
id = 'zelluloza';
name = 'Целлюлоза';
site = 'https://zelluloza.ru';
version = '1.0.0';
version = '1.0.1';
icon = 'src/ru/zelluloza/icon.png';
async popularNovels(
@@ -40,15 +40,14 @@ class Zelluloza implements Plugin.PluginBase {
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = [];
loadedCheerio('div[style="display: flex"]').each((index, element) => {
loadedCheerio('div[style="display: flex;"]').each((index, element) => {
novels.push({
name: loadedCheerio(element).find('span[itemprop="name"]').text() || '',
cover:
this.site +
loadedCheerio(element).find('img[class="shadow"]').attr('src'),
path: (
loadedCheerio(element).find('img[class="shadow"]').attr('onclick') ||
''
loadedCheerio(element).find('a[class="txt"]').attr('href') || ''
).replace(/\D/g, ''),
});
});
@@ -64,7 +63,7 @@ class Zelluloza implements Plugin.PluginBase {
const novel: Plugin.SourceNovel = {
path: novelPath,
name: loadedCheerio('span[itemprop="name"]').text(),
name: loadedCheerio('h2[class="bookname"]').text().trim(),
cover: this.site + loadedCheerio('img[class="shadow"]').attr('src'),
genres: loadedCheerio('.gnres').text()?.split?.(': ')?.[1],
summary:
@@ -163,15 +162,14 @@ class Zelluloza implements Plugin.PluginBase {
const loadedCheerio = parseHTML(body);
const novels: Plugin.NovelItem[] = [];
loadedCheerio('div[style="display: flex"]').each((index, element) => {
loadedCheerio('div[style="display: flex;"]').each((index, element) => {
novels.push({
name: loadedCheerio(element).find('span[itemprop="name"]').text() || '',
cover:
this.site +
loadedCheerio(element).find('img[class="shadow"]').attr('src'),
path: (
loadedCheerio(element).find('img[class="shadow"]').attr('onclick') ||
''
loadedCheerio(element).find('a[class="txt"]').attr('href') || ''
).replace(/\D/g, ''),
});
});