diff --git a/src/plugins/russian/novelOvh.ts b/src/plugins/russian/novelOvh.ts index 50f08d1..0024f34 100644 --- a/src/plugins/russian/novelOvh.ts +++ b/src/plugins/russian/novelOvh.ts @@ -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 { - 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 { - 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 = {}; + 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 += - '' + + '

' + (element.content ? this.jsonToHtml(element.content, image) : '
') + '

'; break; + case 'orderedList': + html += + '
    ' + + (element.content + ? this.jsonToHtml(element.content, image) + : '
    ') + + '
'; + break; + case 'listItem': + html += + '
  • ' + + (element.content + ? this.jsonToHtml(element.content, image) + : '
    ') + + '
  • '; + break; + case 'blockquote': + html += + '
    ' + + (element.content + ? this.jsonToHtml(element.content, image) + : '
    ') + + '
    '; + break; + case 'italic': + html += + '' + + (element.content + ? this.jsonToHtml(element.content, image) + : '
    ') + + '
    '; + break; + case 'bold': + html += + '' + + (element.content + ? this.jsonToHtml(element.content, image) + : '
    ') + + '
    '; + break; + case 'underline': + html += + '' + + (element.content + ? this.jsonToHtml(element.content, image) + : '
    ') + + '
    '; + break; + case 'heading': + html += + '

    ' + + (element.content + ? this.jsonToHtml(element.content, image) + : '
    ') + + '

    '; + 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: { diff --git a/src/plugins/russian/ranobelib.ts b/src/plugins/russian/ranobelib.ts index 2ae9102..1493eb8 100644 --- a/src/plugins/russian/ranobelib.ts +++ b/src/plugins/russian/ranobelib.ts @@ -126,7 +126,7 @@ class RLIB implements Plugin.PluginBase { novel.genres = genres.join(', '); } - const branch_name: Record = { 0: 'главная страница' }; + const branch_name: Record = { 0: 'Главная страница' }; if (data.teams.length) { data.teams.forEach( ({ name, details }) => (branch_name[details?.branch_id || '0'] = name), diff --git a/src/plugins/russian/renovels.ts b/src/plugins/russian/renovels.ts index 1eb7d7b..6f489fb 100644 --- a/src/plugins/russian/renovels.ts +++ b/src/plugins/russian/renovels.ts @@ -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 { - 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(