Skip to content

Commit

Permalink
add delay
Browse files Browse the repository at this point in the history
  • Loading branch information
K1ngfish3r committed Nov 12, 2023
1 parent 9c124e1 commit 670d2ec
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/sources/ch/linovelib.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ const parseNovelAndChapters = async novelUrl => {
const parseChapter = async (novelUrl, chapterUrl) => {
let chapterName, chapterText, hasNextPage, pageHasNextPage, pageText;
let pageNumber = 1;
const delay = ms => new Promise(res => setTimeout(res, ms));

/*
* TODO: Maybe there are other ways to get the translation table
Expand Down Expand Up @@ -251,6 +252,7 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const addPage = async pageCheerio => {
const formatPage = async () => {
// Remove JS
pageCheerio('.atitle').next().find('p:first').remove();
pageCheerio('.atitle').next().find('.cgo').remove();

// Load lazyloaded images
Expand Down Expand Up @@ -305,6 +307,7 @@ const parseChapter = async (novelUrl, chapterUrl) => {
let url = chapterUrl;
do {
const page = await loadPage(url);
await delay(1000);
hasNextPage = page.pageHasNextPage;
if (hasNextPage === true) {
pageNumber++;
Expand Down

0 comments on commit 670d2ec

Please sign in to comment.