diff --git a/src/sources/ru/ranoberf.js b/src/sources/ru/ranoberf.js index 4e74af82..569006b3 100644 --- a/src/sources/ru/ranoberf.js +++ b/src/sources/ru/ranoberf.js @@ -8,8 +8,7 @@ const sourceName = 'РанобэРФ'; const baseUrl = 'https://ранобэ.рф'; const popularNovels = async page => { - const totalPages = 9; - const result = await fetch(baseUrl + '/?page=' + page); + const result = await fetch(baseUrl + '/books?order=popular&page=' + page); const body = await result.text(); const loadedCheerio = cheerio.load(body); @@ -24,6 +23,7 @@ const popularNovels = async page => { novels.push({ sourceId, novelName, novelCover, novelUrl }); }); + let totalPages = json.props.pageProps.totalData.pagesData.pageCount; return { totalPages, novels }; }; @@ -57,7 +57,7 @@ const parseNovelAndChapters = async novelUrl => { const releaseDate = item.publishedAt; const chapterUrl = baseUrl + item.url; - if (!item.isDonate) { + if (!item.isDonate || item.isUserPaid) { chapters.push({ chapterName, releaseDate, chapterUrl }); } }); diff --git a/src/sources/ru/renovels.js b/src/sources/ru/renovels.js index f42a62a1..756c0086 100644 --- a/src/sources/ru/renovels.js +++ b/src/sources/ru/renovels.js @@ -7,8 +7,10 @@ const sourceName = 'Renovels'; const baseUrl = 'https://renovels.org'; const popularNovels = async page => { - const totalPages = 20; - const url = baseUrl + '/api/titles/last-chapters/?&count=20&page=' + page; + const url = + baseUrl + + '/api/search/catalog/?count=30&ordering=-chapter_date&page=' + + page; const result = await fetch(url); let body = await result.json(); @@ -16,11 +18,12 @@ const popularNovels = async page => { body.content.map(item => { const novelName = item.rus_name; - const novelCover = baseUrl + item.img.mid; + const novelCover = baseUrl + (item.img?.high || item.img.low); const novelUrl = item.dir; novels.push({ sourceId, novelName, novelCover, novelUrl }); }); + let totalPages = body.props.total_pages; return { totalPages, novels }; }; @@ -69,7 +72,7 @@ const parseNovelAndChapters = async novelUrl => { const releaseDate = item.upload_date; const chapterUrl = baseUrl + '/api/titles/chapters/' + item.id + '/'; - if (!item.is_paid) { + if (!item.is_paid || item.is_bought) { chapters.push({ chapterName, releaseDate, chapterUrl }); } }); @@ -102,7 +105,7 @@ const searchNovels = async searchTerm => { body.content.map(item => { const novelName = item.rus_name; - const novelCover = baseUrl + item.img.mid; + const novelCover = baseUrl + (item.img?.high || item.img.low); const novelUrl = item.dir; const novel = { sourceId, novelName, novelCover, novelUrl }; novels.push(novel); diff --git a/src/sources/ru/rulate.js b/src/sources/ru/rulate.js index e2f3e71d..3c21fe9b 100644 --- a/src/sources/ru/rulate.js +++ b/src/sources/ru/rulate.js @@ -9,7 +9,6 @@ const baseUrl = 'https://tl.rulate.ru'; const popularNovels = async page => { const result = await fetch(baseUrl + '/site/login?page=' + page); const body = await result.text(); - const loadedCheerio = cheerio.load(body); const totalPages = parseInt( loadedCheerio('li[class="last"] > a').attr('href')?.replace(/[^\d]/g, '') || @@ -32,7 +31,19 @@ const popularNovels = async page => { }; const parseNovelAndChapters = async novelUrl => { - const result = await fetch(baseUrl + novelUrl); + let result = await fetch(baseUrl + novelUrl); + if (result.url.includes('mature?path=')) { + const formData = new FormData(); + formData.append('path', novelUrl); + formData.append('ok', 'Да'); + + await fetch(result.url, { + method: 'POST', + body: formData, + }); + + result = await fetch(baseUrl + novelUrl); + } const body = await result.text(); const loadedCheerio = cheerio.load(body); @@ -107,7 +118,19 @@ const parseNovelAndChapters = async novelUrl => { }; const parseChapter = async (novelUrl, chapterUrl) => { - const result = await fetch(baseUrl + chapterUrl); + let result = await fetch(baseUrl + chapterUrl); + if (result.url.includes('mature?path=')) { + const formData = new FormData(); + formData.append('path', novelUrl); + formData.append('ok', 'Да'); + + await fetch(result.url, { + method: 'POST', + body: formData, + }); + + result = await fetch(baseUrl + chapterUrl); + } const body = await result.text(); const loadedCheerio = cheerio.load(body);