@@ -9,14 +9,14 @@ class novelOvh implements Plugin.PluginBase {
|
||||
name = 'НовелОВХ';
|
||||
site = 'https://novel.ovh';
|
||||
apiSite = 'https://api.novel.ovh/v2/';
|
||||
version = '1.0.2';
|
||||
version = '1.0.3';
|
||||
icon = 'src/ru/novelovh/icon.png';
|
||||
|
||||
async popularNovels(
|
||||
pageNo: number,
|
||||
{ showLatestNovels, filters }: Plugin.PopularNovelsOptions,
|
||||
): Promise<Plugin.NovelItem[]> {
|
||||
let url = this.site + '/content?page=' + (pageNo - 1);
|
||||
let url = this.apiSite + 'books?page=' + (pageNo - 1);
|
||||
url +=
|
||||
'&sort=' +
|
||||
(showLatestNovels
|
||||
@@ -24,9 +24,7 @@ class novelOvh implements Plugin.PluginBase {
|
||||
: filters?.sort?.value || 'averageRating') +
|
||||
',desc';
|
||||
|
||||
const { books }: { books: BooksEntity[] } = await fetchApi(
|
||||
url + '&_data=routes/reader/book/index',
|
||||
).then(res => res.json());
|
||||
const books: BooksEntity[] = await fetchApi(url).then(res => res.json());
|
||||
|
||||
const novels: Plugin.NovelItem[] = [];
|
||||
books.forEach(novel =>
|
||||
@@ -41,7 +39,7 @@ class novelOvh implements Plugin.PluginBase {
|
||||
}
|
||||
|
||||
async parseNovel(novelPath: string): Promise<Plugin.SourceNovel> {
|
||||
const { book, chapters }: responseNovel = await fetchApi(
|
||||
const { book, branches, chapters }: responseNovel = await fetchApi(
|
||||
this.site +
|
||||
'/content/' +
|
||||
novelPath +
|
||||
@@ -69,8 +67,15 @@ class novelOvh implements Plugin.PluginBase {
|
||||
}
|
||||
});
|
||||
|
||||
const chaptersRes: Plugin.ChapterItem[] = [];
|
||||
const branch_name: Record<string, string> = {};
|
||||
if (branches.length) {
|
||||
branches.forEach(({ id, publishers }) => {
|
||||
if (id && publishers?.length)
|
||||
branch_name[id] = publishers[0].name || 'Неизвестный';
|
||||
});
|
||||
}
|
||||
|
||||
const chaptersRes: Plugin.ChapterItem[] = [];
|
||||
chapters.forEach((chapter, chapterIndex) =>
|
||||
chaptersRes.push({
|
||||
name:
|
||||
@@ -80,9 +85,10 @@ class novelOvh implements Plugin.PluginBase {
|
||||
' ' +
|
||||
(chapter.name ||
|
||||
'Глава ' + (chapter.number || chapters.length - chapterIndex)),
|
||||
path: novelPath + '/' + chapter.id + '/0',
|
||||
path: novelPath + '/' + chapter.id,
|
||||
releaseTime: dayjs(chapter.createdAt).format('LLL'),
|
||||
chapterNumber: chapters.length - chapterIndex,
|
||||
page: branch_name[chapter.branchId] || 'Главная страница',
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -140,16 +146,68 @@ class novelOvh implements Plugin.PluginBase {
|
||||
break;
|
||||
case 'paragraph':
|
||||
html +=
|
||||
'<p' +
|
||||
(element?.attrs?.textAlign
|
||||
? ` style="text-align: ${element.attrs.textAlign}"`
|
||||
: '') +
|
||||
'>' +
|
||||
'<p>' +
|
||||
(element.content
|
||||
? this.jsonToHtml(element.content, image)
|
||||
: '<br>') +
|
||||
'</p>';
|
||||
break;
|
||||
case 'orderedList':
|
||||
html +=
|
||||
'<ol>' +
|
||||
(element.content
|
||||
? this.jsonToHtml(element.content, image)
|
||||
: '<br>') +
|
||||
'</ol>';
|
||||
break;
|
||||
case 'listItem':
|
||||
html +=
|
||||
'<li>' +
|
||||
(element.content
|
||||
? this.jsonToHtml(element.content, image)
|
||||
: '<br>') +
|
||||
'</li>';
|
||||
break;
|
||||
case 'blockquote':
|
||||
html +=
|
||||
'<blockquote>' +
|
||||
(element.content
|
||||
? this.jsonToHtml(element.content, image)
|
||||
: '<br>') +
|
||||
'</blockquote>';
|
||||
break;
|
||||
case 'italic':
|
||||
html +=
|
||||
'<i>' +
|
||||
(element.content
|
||||
? this.jsonToHtml(element.content, image)
|
||||
: '<br>') +
|
||||
'</i>';
|
||||
break;
|
||||
case 'bold':
|
||||
html +=
|
||||
'<b>' +
|
||||
(element.content
|
||||
? this.jsonToHtml(element.content, image)
|
||||
: '<br>') +
|
||||
'</b>';
|
||||
break;
|
||||
case 'underline':
|
||||
html +=
|
||||
'<u>' +
|
||||
(element.content
|
||||
? this.jsonToHtml(element.content, image)
|
||||
: '<br>') +
|
||||
'</u>';
|
||||
break;
|
||||
case 'heading':
|
||||
html +=
|
||||
'<h2>' +
|
||||
(element.content
|
||||
? this.jsonToHtml(element.content, image)
|
||||
: '<br>') +
|
||||
'</h2>';
|
||||
break;
|
||||
case 'text':
|
||||
html += element.text;
|
||||
break;
|
||||
@@ -161,7 +219,7 @@ class novelOvh implements Plugin.PluginBase {
|
||||
return html;
|
||||
};
|
||||
|
||||
resolveUrl = (path: string) => this.site + '/novel/' + path;
|
||||
resolveUrl = (path: string) => this.site + '/content/' + path;
|
||||
|
||||
filters = {
|
||||
sort: {
|
||||
|
||||
@@ -126,7 +126,7 @@ class RLIB implements Plugin.PluginBase {
|
||||
novel.genres = genres.join(', ');
|
||||
}
|
||||
|
||||
const branch_name: Record<number, string> = { 0: 'главная страница' };
|
||||
const branch_name: Record<number, string> = { 0: 'Главная страница' };
|
||||
if (data.teams.length) {
|
||||
data.teams.forEach(
|
||||
({ name, details }) => (branch_name[details?.branch_id || '0'] = name),
|
||||
|
||||
@@ -11,7 +11,7 @@ class ReN implements Plugin.PluginBase {
|
||||
name = 'Renovels';
|
||||
icon = 'src/ru/renovels/icon.png';
|
||||
site = 'https://renovels.org';
|
||||
version = '1.0.1';
|
||||
version = '1.0.2';
|
||||
|
||||
async popularNovels(
|
||||
pageNo: number,
|
||||
@@ -80,7 +80,7 @@ class ReN implements Plugin.PluginBase {
|
||||
}
|
||||
|
||||
const totalPages =
|
||||
(content.branches?.[0]?.count_chapters || content.count_chapters) / 100;
|
||||
(content.branches?.[0]?.count_chapters || content.count_chapters) / 50;
|
||||
const branch_id = content.branches?.[0]?.id || content.id;
|
||||
const chapters: Plugin.ChapterItem[] = [];
|
||||
|
||||
@@ -92,9 +92,10 @@ class ReN implements Plugin.PluginBase {
|
||||
this.site +
|
||||
'/api/titles/chapters/?branch_id=' +
|
||||
branch_id +
|
||||
'&count=100&page=' +
|
||||
'&ordering=index&user_data=1&count=50&page=' +
|
||||
(page + 1),
|
||||
).then(res => res.json());
|
||||
let skip = false;
|
||||
|
||||
volumes.content.forEach(chapter => {
|
||||
if (!chapter.is_paid || chapter.is_bought) {
|
||||
@@ -109,21 +110,23 @@ class ReN implements Plugin.PluginBase {
|
||||
releaseTime: dayjs(chapter.upload_date).format('LLL'),
|
||||
chapterNumber: chapter.index,
|
||||
});
|
||||
} else {
|
||||
skip = true;
|
||||
}
|
||||
});
|
||||
if (skip) break;
|
||||
}
|
||||
|
||||
novel.chapters = chapters.reverse();
|
||||
novel.chapters = chapters;
|
||||
return novel;
|
||||
}
|
||||
|
||||
async parseChapter(chapterPath: string): Promise<string> {
|
||||
const url = this.site + '/api/titles/chapters/' + chapterPath.split('/')[1];
|
||||
const result: { content: responseСhapter } = await fetchApi(url).then(res =>
|
||||
res.json(),
|
||||
);
|
||||
const url =
|
||||
this.site + '/api/v2/titles/chapters/' + chapterPath.split('/')[1];
|
||||
const result: responseСhapter = await fetchApi(url).then(res => res.json());
|
||||
|
||||
return result.content.content || '';
|
||||
return result.content || '';
|
||||
}
|
||||
|
||||
async searchNovels(
|
||||
|
||||
Reference in New Issue
Block a user