fix: Source Fixes (#272)

* updated link

* small correction

* Bypass

* Update renovels.js
This commit is contained in:
Rider21
2022-05-27 02:44:17 +03:00
committed by GitHub
parent 9f6f9e71ca
commit 5436bf8aaf
3 changed files with 37 additions and 11 deletions
+3 -3
View File
@@ -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 });
}
});
+8 -5
View File
@@ -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);
+26 -3
View File
@@ -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);