diff --git a/.eslintrc.js b/.eslintrc.js
index ed658eb7..8edf54e9 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -3,5 +3,6 @@ module.exports = {
extends: '@react-native-community',
rules: {
'react-native/no-inline-styles': 'off',
+ 'no-console': 'warn',
},
};
diff --git a/.gitignore b/.gitignore
index 3f4f305a..302ba138 100644
--- a/.gitignore
+++ b/.gitignore
@@ -70,4 +70,6 @@ buck-out/
.expo/
web-build/
-# @end expo-cli
\ No newline at end of file
+# @end expo-cli
+
+.vscode/
\ No newline at end of file
diff --git a/android/gradlew b/android/gradlew
old mode 100644
new mode 100755
diff --git a/src/components/ColorPickerModal.js b/src/components/ColorPickerModal.js
index 35f241be..abdea713 100644
--- a/src/components/ColorPickerModal.js
+++ b/src/components/ColorPickerModal.js
@@ -21,7 +21,7 @@ const ColorPickerModal = ({
setError();
};
- const onChangeText = text => setText(text);
+ const onChangeText = txt => setText(txt);
const onSubmitEditing = () => {
const re = /^#([0-9a-f]{6}|[0-9a-f]{3})$/i;
diff --git a/src/components/Common/CrossFadeView.js b/src/components/Common/CrossFadeView.js
index b4c48687..43d7263f 100644
--- a/src/components/Common/CrossFadeView.js
+++ b/src/components/Common/CrossFadeView.js
@@ -1,3 +1,5 @@
+/* eslint-disable no-bitwise */
+
import PropTypes from 'prop-types';
import React, {PureComponent, Children} from 'react';
import {View, Animated, StyleSheet} from 'react-native';
diff --git a/src/components/Dialog/Dialog.js b/src/components/Dialog/Dialog.js
index f4742ed3..52225271 100644
--- a/src/components/Dialog/Dialog.js
+++ b/src/components/Dialog/Dialog.js
@@ -1,3 +1,5 @@
+/* eslint-disable no-unused-vars */
+
import React from 'react';
import {StyleSheet} from 'react-native';
diff --git a/src/components/ErrorView.js b/src/components/ErrorView.js
index e3984c98..46f9f0d5 100644
--- a/src/components/ErrorView.js
+++ b/src/components/ErrorView.js
@@ -2,7 +2,7 @@ import React from 'react';
import {Text, View} from 'react-native';
import {IconButton} from 'react-native-paper';
-import {Row} from './Common';
+// import {Row} from './Common';
import EmptyView from './EmptyView';
diff --git a/src/components/ErrorView/ErrorView.js b/src/components/ErrorView/ErrorView.js
index 73908e3d..86999a41 100644
--- a/src/components/ErrorView/ErrorView.js
+++ b/src/components/ErrorView/ErrorView.js
@@ -2,7 +2,7 @@ import React from 'react';
import {Pressable, StyleSheet, Text, View} from 'react-native';
import {IconButton} from 'react-native-paper';
-const icons = ['(・o・;)', 'Σ(ಠ_ಠ)', 'ಥ_ಥ', '(˘・_・˘)', '(; ̄Д ̄)', '(・Д・。'];
+// const icons = ['(・o・;)', 'Σ(ಠ_ಠ)', 'ಥ_ಥ', '(˘・_・˘)', '(; ̄Д ̄)', '(・Д・。'];
export const ErrorView = ({errorName, actions, theme}) => (
diff --git a/src/components/NovelCover.js b/src/components/NovelCover.js
index 8335981e..6589ad72 100644
--- a/src/components/NovelCover.js
+++ b/src/components/NovelCover.js
@@ -12,7 +12,7 @@ import FastImage from 'react-native-fast-image';
import ListView from './ListView';
-import {getDeviceOrientation} from '../services/utils/helpers';
+import {useDeviceOrientation} from '../services/utils/helpers';
import {useSettings} from '../hooks/reduxHooks';
import {defaultCoverUri} from '../sources/helpers/constants';
@@ -30,7 +30,7 @@ const NovelCover = ({
const window = useWindowDimensions();
- const orientation = getDeviceOrientation();
+ const orientation = useDeviceOrientation();
const getNovelsPerRow = () =>
orientation === 'landscape' ? 6 : novelsPerRow;
diff --git a/src/components/NovelList.js b/src/components/NovelList.js
index 0e9e0ff7..9f281f67 100644
--- a/src/components/NovelList.js
+++ b/src/components/NovelList.js
@@ -2,7 +2,7 @@ import React, {useCallback} from 'react';
import {StyleSheet, FlatList} from 'react-native';
import {useSettings} from '../hooks/reduxHooks';
-import {getDeviceOrientation} from '../services/utils/helpers';
+import {useDeviceOrientation} from '../services/utils/helpers';
const NovelList = ({
data,
@@ -15,7 +15,7 @@ const NovelList = ({
}) => {
const {displayMode, novelsPerRow} = useSettings();
- const orientation = getDeviceOrientation();
+ const orientation = useDeviceOrientation();
const getNovelsPerRow = () => {
if (displayMode === 2) {
diff --git a/src/components/ThemePicker/ThemePicker.js b/src/components/ThemePicker/ThemePicker.js
index 89357bc6..744a6d22 100644
--- a/src/components/ThemePicker/ThemePicker.js
+++ b/src/components/ThemePicker/ThemePicker.js
@@ -1,5 +1,5 @@
import React from 'react';
-import {View, Text, StyleSheet, Pressable} from 'react-native';
+import {View, Text, /* StyleSheet, */ Pressable} from 'react-native';
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
export const ThemePicker = ({theme, currentTheme, onPress}) => (
@@ -15,7 +15,7 @@ export const ThemePicker = ({theme, currentTheme, onPress}) => (
backgroundColor: theme.colorPrimaryDark,
borderWidth: 3.6,
borderColor:
- currentTheme.id == theme.id
+ currentTheme.id === theme.id
? theme.colorAccent
: currentTheme.colorPrimaryDark,
width: 95,
@@ -26,7 +26,7 @@ export const ThemePicker = ({theme, currentTheme, onPress}) => (
}}
>
- {currentTheme.id == theme.id && (
+ {currentTheme.id === theme.id && (
(
);
-const styles = StyleSheet.create({});
+// const styles = StyleSheet.create({});
diff --git a/src/database/DBHelper.js b/src/database/DBHelper.js
index 7bf92e82..29bcda0e 100644
--- a/src/database/DBHelper.js
+++ b/src/database/DBHelper.js
@@ -16,7 +16,7 @@ import {
import {createDownloadTableQuery} from './tables/DownloadTable';
import {
createUpdatesTableQuery,
- updatesSeedDataQuery,
+ // updatesSeedDataQuery,
} from './tables/UpdateTable';
/**
diff --git a/src/database/queries/ChapterQueries.js b/src/database/queries/ChapterQueries.js
index 95b81290..e994c38b 100644
--- a/src/database/queries/ChapterQueries.js
+++ b/src/database/queries/ChapterQueries.js
@@ -2,7 +2,8 @@ import * as SQLite from 'expo-sqlite';
import {getSource} from '../../sources/sources';
const db = SQLite.openDatabase('lnreader.db');
-const insertChaptersQuery = `INSERT INTO chapters (chapterUrl, chapterName, releaseDate, novelId) values (?, ?, ?, ?)`;
+const insertChaptersQuery =
+ 'INSERT INTO chapters (chapterUrl, chapterName, releaseDate, novelId) values (?, ?, ?, ?)';
export const insertChapters = async (novelId, chapters) => {
db.transaction(tx => {
@@ -53,7 +54,7 @@ export const getChapters = (novelId, sort, filter) => {
);
};
-const getChapterQuery = `SELECT * FROM downloads WHERE downloadChapterId = ?`;
+const getChapterQuery = 'SELECT * FROM downloads WHERE downloadChapterId = ?';
export const getChapterFromDB = async chapterId => {
return new Promise((resolve, reject) =>
@@ -61,7 +62,7 @@ export const getChapterFromDB = async chapterId => {
tx.executeSql(
getChapterQuery,
[chapterId],
- (tx, results) => {
+ (txObj, results) => {
resolve(results.rows.item(0));
},
(txObj, error) => console.log('Error ', error),
@@ -74,9 +75,9 @@ export const getNextChapterFromDB = async (novelId, chapterId) => {
return new Promise((resolve, reject) =>
db.transaction(tx => {
tx.executeSql(
- `SELECT * FROM chapters WHERE novelId = ? AND chapterId > ?`,
+ 'SELECT * FROM chapters WHERE novelId = ? AND chapterId > ?',
[novelId, chapterId],
- (tx, results) => {
+ (txObj, results) => {
resolve(results.rows.item(0));
},
(txObj, error) => console.log('Error ', error),
@@ -89,9 +90,9 @@ export const getPrevChapterFromDB = async (novelId, chapterId) => {
return new Promise((resolve, reject) =>
db.transaction(tx => {
tx.executeSql(
- `SELECT * FROM chapters WHERE novelId = ? AND chapterId < ?`,
+ 'SELECT * FROM chapters WHERE novelId = ? AND chapterId < ?',
[novelId, chapterId],
- (tx, results) => {
+ (txObj, results) => {
resolve(results.rows.item(results.rows.length - 1));
},
(txObj, error) => console.log('Error ', error),
@@ -100,59 +101,64 @@ export const getPrevChapterFromDB = async (novelId, chapterId) => {
);
};
-const markChapterReadQuery = `UPDATE chapters SET \`read\` = 1 WHERE chapterId = ?`;
+const markChapterReadQuery =
+ 'UPDATE chapters SET `read` = 1 WHERE chapterId = ?';
export const markChapterRead = async chapterId => {
db.transaction(tx => {
tx.executeSql(
markChapterReadQuery,
[chapterId],
- (tx, res) => {},
- (tx, error) => console.log(error),
+ (txObj, res) => {},
+ (txObj, error) => console.log(error),
);
});
};
-const markChapterUnreadQuery = `UPDATE chapters SET \`read\` = 0 WHERE chapterId = ?`;
+const markChapterUnreadQuery =
+ 'UPDATE chapters SET `read` = 0 WHERE chapterId = ?';
export const markChapterUnread = async chapterId => {
db.transaction(tx => {
tx.executeSql(
markChapterUnreadQuery,
[chapterId],
- (tx, res) => {},
- (tx, error) => console.log(error),
+ (txObj, res) => {},
+ (txObj, error) => console.log(error),
);
});
};
-const markAllChaptersReadQuery = `UPDATE chapters SET \`read\` = 1 WHERE novelId = ?`;
+const markAllChaptersReadQuery =
+ 'UPDATE chapters SET `read` = 1 WHERE novelId = ?';
export const markAllChaptersRead = async novelId => {
db.transaction(tx => {
tx.executeSql(
markAllChaptersReadQuery,
[novelId],
- (tx, res) => {},
- (tx, error) => console.log(error),
+ (txObj, res) => {},
+ (txObj, error) => console.log(error),
);
});
};
-const markAllChaptersUnreadQuery = `UPDATE chapters SET \`read\` = 0 WHERE novelId = ?`;
+const markAllChaptersUnreadQuery =
+ 'UPDATE chapters SET `read` = 0 WHERE novelId = ?';
export const markAllChaptersUnread = async novelId => {
db.transaction(tx => {
tx.executeSql(
markAllChaptersUnreadQuery,
[novelId],
- (tx, res) => {},
- (tx, error) => console.log(error),
+ (txObj, res) => {},
+ (txObj, error) => console.log(error),
);
});
};
-const isChapterDownloadedQuery = `SELECT * FROM downloads WHERE downloadChapterId=?`;
+const isChapterDownloadedQuery =
+ 'SELECT * FROM downloads WHERE downloadChapterId=?';
export const isChapterDownloaded = async chapterId => {
return new Promise((resolve, reject) =>
@@ -173,7 +179,8 @@ export const isChapterDownloaded = async chapterId => {
);
};
-const downloadChapterQuery = `INSERT INTO downloads (downloadChapterId, chapterName, chapterText) VALUES (?, ?, ?)`;
+const downloadChapterQuery =
+ 'INSERT INTO downloads (downloadChapterId, chapterName, chapterText) VALUES (?, ?, ?)';
export const downloadChapter = async (
sourceId,
@@ -186,13 +193,13 @@ export const downloadChapter = async (
const chapter = await source.parseChapter(novelUrl, chapterUrl);
db.transaction(tx => {
- tx.executeSql(`UPDATE chapters SET downloaded = 1 WHERE chapterId = ?`, [
+ tx.executeSql('UPDATE chapters SET downloaded = 1 WHERE chapterId = ?', [
chapterId,
]);
tx.executeSql(
downloadChapterQuery,
[chapterId, chapter.chapterName, chapter.chapterText],
- (tx, res) => {
+ (txObj, res) => {
// console.log(`Downloaded Chapter ${chapter.chapterUrl}`);
},
(txObj, error) => console.log('Error ', error),
@@ -201,20 +208,21 @@ export const downloadChapter = async (
};
export const deleteChapter = async chapterId => {
- const updateIsDownloadedQuery = `UPDATE chapters SET downloaded = 0 WHERE chapterId=?`;
- const deleteChapterQuery = `DELETE FROM downloads WHERE downloadChapterId=?`;
+ const updateIsDownloadedQuery =
+ 'UPDATE chapters SET downloaded = 0 WHERE chapterId=?';
+ const deleteChapterQuery = 'DELETE FROM downloads WHERE downloadChapterId=?';
db.transaction(tx => {
tx.executeSql(
updateIsDownloadedQuery,
[chapterId],
- (tx, res) => {},
+ (txObj, res) => {},
(txObj, error) => console.log('Error ', error),
);
tx.executeSql(
deleteChapterQuery,
[chapterId],
- (tx, res) => console.log(`Chapter deleted`),
+ (txObj, res) => console.log('Chapter deleted'),
(txObj, error) => console.log('Error ', error),
);
});
@@ -234,48 +242,51 @@ export const getLastReadChapter = async novelId => {
tx.executeSql(
getLastReadChapterQuery,
[novelId],
- (tx, {rows}) => resolve(rows.item(0)),
+ (txObj, {rows}) => resolve(rows.item(0)),
(txObj, error) => console.log('Error ', error),
);
});
});
};
-const bookmarkChapterQuery = `UPDATE chapters SET bookmark = ? WHERE chapterId = ?`;
+const bookmarkChapterQuery =
+ 'UPDATE chapters SET bookmark = ? WHERE chapterId = ?';
export const bookmarkChapter = async (bookmark, chapterId) => {
db.transaction(tx => {
tx.executeSql(
bookmarkChapterQuery,
[!bookmark, chapterId],
- (tx, res) => {},
+ (txObj, res) => {},
(txObj, error) => console.log('Error ', error),
);
});
};
-const markPreviuschaptersReadQuery = `UPDATE chapters SET \`read\` = 1 WHERE chapterId < ? AND novelId = ?`;
+const markPreviuschaptersReadQuery =
+ 'UPDATE chapters SET `read` = 1 WHERE chapterId < ? AND novelId = ?';
export const markPreviuschaptersRead = async (chapterId, novelId) => {
db.transaction(tx => {
tx.executeSql(
markPreviuschaptersReadQuery,
[chapterId, novelId],
- (tx, res) => {},
- (tx, error) => console.log(error),
+ (txObj, res) => {},
+ (txObj, error) => console.log(error),
);
});
};
-const markPreviousChaptersUnreadQuery = `UPDATE chapters SET \`read\` = 0 WHERE chapterId < ? AND novelId = ?`;
+const markPreviousChaptersUnreadQuery =
+ 'UPDATE chapters SET `read` = 0 WHERE chapterId < ? AND novelId = ?';
export const markPreviousChaptersUnread = async (chapterId, novelId) => {
db.transaction(tx => {
tx.executeSql(
markPreviousChaptersUnreadQuery,
[chapterId, novelId],
- (tx, res) => {},
- (tx, error) => console.log(error),
+ (txObj, res) => {},
+ (txObj, error) => console.log(error),
);
});
};
@@ -304,7 +315,7 @@ export const getDownloadedChapters = () => {
export const deleteDownloads = async () => {
db.transaction(tx => {
- tx.executeSql(`UPDATE chapters SET downloaded = 0`);
+ tx.executeSql('UPDATE chapters SET downloaded = 0');
tx.executeSql('DELETE FROM downloads; VACCUM;');
});
};
diff --git a/src/database/queries/NovelQueries.js b/src/database/queries/NovelQueries.js
index e9afb5f4..d0873968 100644
--- a/src/database/queries/NovelQueries.js
+++ b/src/database/queries/NovelQueries.js
@@ -9,7 +9,8 @@ import {insertChapters} from './ChapterQueries';
import {showToast} from '../../hooks/showToast';
-const insertNovelQuery = `INSERT INTO novels (novelUrl, sourceUrl, sourceId, source, novelName, novelCover, novelSummary, author, artist, status, genre) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`;
+const insertNovelQuery =
+ 'INSERT INTO novels (novelUrl, sourceUrl, sourceId, source, novelName, novelCover, novelSummary, author, artist, status, genre) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
export const insertNovel = async novel => {
return new Promise((resolve, reject) =>
@@ -41,7 +42,7 @@ export const followNovel = async (followed, novelId) => {
tx.executeSql(
'UPDATE novels SET followed = ? WHERE novelId = ?',
[!followed, novelId],
- (tx, res) => {},
+ (txo, res) => {},
(txObj, error) => console.log('Error ', error),
);
});
@@ -52,13 +53,13 @@ export const unfollowNovel = async novelId => {
tx.executeSql(
'UPDATE novels SET followed = 0 WHERE novelId = ?',
[novelId],
- (tx, res) => {},
+ (txo, res) => {},
(txObj, error) => console.log('Error ', error),
);
});
};
-const checkNovelInCacheQuery = `SELECT * FROM novels WHERE novelUrl=? LIMIT 1`;
+const checkNovelInCacheQuery = 'SELECT * FROM novels WHERE novelUrl=? LIMIT 1';
export const checkNovelInCache = novelUrl => {
return new Promise((resolve, reject) =>
@@ -83,7 +84,7 @@ export const getNovel = async (sourceId, novelUrl) => {
return new Promise((resolve, reject) =>
db.transaction(tx => {
tx.executeSql(
- `SELECT * FROM novels WHERE novelUrl = ? AND sourceId = ?`,
+ 'SELECT * FROM novels WHERE novelUrl = ? AND sourceId = ?',
[novelUrl, sourceId],
(txObj, {rows}) => resolve(rows.item(0)),
(txObj, error) => console.log('Error ', error),
@@ -103,7 +104,8 @@ export const deleteNovelCache = () => {
});
};
-const restoreFromBackupQuery = `INSERT INTO novels (novelUrl, sourceUrl, sourceId, source, novelName, novelCover, novelSummary, author, artist, status, genre, followed, unread) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`;
+const restoreFromBackupQuery =
+ 'INSERT INTO novels (novelUrl, sourceUrl, sourceId, source, novelName, novelCover, novelSummary, author, artist, status, genre, followed, unread) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
export const restoreLibrary = async novel => {
return new Promise((resolve, reject) =>
@@ -135,7 +137,8 @@ export const restoreLibrary = async novel => {
);
};
-const migrateNovelQuery = `INSERT INTO novels (novelUrl, sourceUrl, sourceId, source, novelName, novelCover, novelSummary, author, artist, status, genre, followed) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`;
+const migrateNovelQuery =
+ 'INSERT INTO novels (novelUrl, sourceUrl, sourceId, source, novelName, novelCover, novelSummary, author, artist, status, genre, followed) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
export const migrateNovel = async (sourceId, novelUrl) => {
try {
diff --git a/src/database/tables/HistoryTable.js b/src/database/tables/HistoryTable.js
index 988357ae..6c53b90e 100644
--- a/src/database/tables/HistoryTable.js
+++ b/src/database/tables/HistoryTable.js
@@ -8,4 +8,5 @@ export const createHistoryTableQuery = `
ON DELETE CASCADE
)`;
-export const createChapterIdIndexQuery = `CREATE INDEX IF NOT EXISTS historyChapterIdIndex ON history(historyChapterId)`;
+export const createChapterIdIndexQuery =
+ 'CREATE INDEX IF NOT EXISTS historyChapterIdIndex ON history(historyChapterId)';
diff --git a/src/database/tables/NovelTable.js b/src/database/tables/NovelTable.js
index 0b875749..81487d5b 100644
--- a/src/database/tables/NovelTable.js
+++ b/src/database/tables/NovelTable.js
@@ -16,6 +16,8 @@ export const createNovelTableQuery = `
unread INTEGER DEFAULT 1
)`;
-export const createUrlIndexQuery = `CREATE INDEX IF NOT EXISTS novelUrlIndex ON novels(novelUrl)`;
+export const createUrlIndexQuery =
+ 'CREATE INDEX IF NOT EXISTS novelUrlIndex ON novels(novelUrl)';
-export const createLibraryIndexQuery = `CREATE INDEX IF NOT EXISTS novelFollowedIndex ON novels(followed)`;
+export const createLibraryIndexQuery =
+ 'CREATE INDEX IF NOT EXISTS novelFollowedIndex ON novels(followed)';
diff --git a/src/hooks/githubUpdateChecker.js b/src/hooks/githubUpdateChecker.js
index 4c285935..c7c0a0bc 100644
--- a/src/hooks/githubUpdateChecker.js
+++ b/src/hooks/githubUpdateChecker.js
@@ -1,6 +1,8 @@
import {useState, useEffect} from 'react';
-export const githubUpdateChecker = () => {
+import {showToast} from './../hooks/showToast';
+
+export const useGithubUpdateChecker = () => {
const latestReleaseUrl =
'https://api.github.com/repos/rajarsheechatterjee/lnreader/releases/latest';
@@ -32,7 +34,10 @@ export const githubUpdateChecker = () => {
};
useEffect(() => {
- checkForRelease();
+ checkForRelease().catch(e => {
+ showToast(`Could not connect to github:\n${`${e}`.split(':')[1].trim()}`);
+ // console.error(e);
+ });
}, []);
if (!checking) {
diff --git a/src/hooks/reduxHooks.js b/src/hooks/reduxHooks.js
index 96aa2af4..e0c34528 100644
--- a/src/hooks/reduxHooks.js
+++ b/src/hooks/reduxHooks.js
@@ -37,7 +37,7 @@ const useChapter = () => {
return chapter;
};
-const findNovel = novelId => {
+const useFindNovel = novelId => {
let novel = useSelector(state => state.preferenceReducer.novelSettings);
novel = novel[novelId];
@@ -47,7 +47,7 @@ const findNovel = novelId => {
const usePreferences = novelId => {
let sort, filter, position, showChapterTitles;
- const novel = findNovel(novelId);
+ const novel = useFindNovel(novelId);
if (novel) {
sort = novel.sort;
@@ -68,7 +68,7 @@ const useSavedSettings = () => {
const useContinueReading = (chapters, novelId) => {
let lastReadChapter, chapterId, novel, position;
- novel = findNovel(novelId);
+ novel = useFindNovel(novelId);
if (novel) {
chapterId = novel.lastRead;
position = novel.position;
@@ -90,7 +90,7 @@ const useContinueReading = (chapters, novelId) => {
const usePosition = (novelId, chapterId) => {
let novel, position;
- novel = findNovel(novelId);
+ novel = useFindNovel(novelId);
if (novel) {
if (novel.position) {
diff --git a/src/navigators/BottomNavBar.js b/src/navigators/BottomNavBar.js
index 6cf5820e..058a230e 100644
--- a/src/navigators/BottomNavBar.js
+++ b/src/navigators/BottomNavBar.js
@@ -25,12 +25,12 @@ const BottomNavigationBar = ({
}) => {
const focusedOptions = descriptors[state.routes[state.index].key].options;
+ const insets = useSafeAreaInsets();
+
if (focusedOptions.tabBarVisible === false) {
return null;
}
- const insets = useSafeAreaInsets();
-
return (
{
const theme = useTheme();
- const insets = useSafeAreaInsets();
+ // const insets = useSafeAreaInsets();
const {
showHistoryTab = true,
diff --git a/src/navigators/Main.js b/src/navigators/Main.js
index e1c7f84e..1add7e09 100644
--- a/src/navigators/Main.js
+++ b/src/navigators/Main.js
@@ -6,7 +6,7 @@ import {createStackNavigator} from '@react-navigation/stack';
import {setBarColor} from '../theme/utils/setBarColor';
import {useTheme} from '../hooks/reduxHooks';
-import {githubUpdateChecker} from '../hooks/githubUpdateChecker';
+import {useGithubUpdateChecker} from '../hooks/githubUpdateChecker';
import * as SplashScreen from 'expo-splash-screen';
/**
@@ -42,7 +42,7 @@ const MainNavigator = () => {
}, 500);
}, [theme]);
- const {isNewVersion, latestRelease} = githubUpdateChecker() || {};
+ const {isNewVersion, latestRelease} = useGithubUpdateChecker() || {};
return (
diff --git a/src/redux/downloads/downloads.actions.js b/src/redux/downloads/downloads.actions.js
index 37707eb6..1bbcd762 100644
--- a/src/redux/downloads/downloads.actions.js
+++ b/src/redux/downloads/downloads.actions.js
@@ -1,13 +1,11 @@
-import {
- SET_DOWNLOAD_QUEUE,
- CANCEL_DOWNLOAD,
- PAUSE_DOWNLOADS,
-} from './donwloads.types';
+import {CANCEL_DOWNLOAD, PAUSE_DOWNLOADS} from './donwloads.types';
import BackgroundService from 'react-native-background-actions';
import {downloadChapter} from '../../database/queries/ChapterQueries';
import {CHAPTER_DOWNLOADED} from '../novel/novel.types';
import {showToast} from '../../hooks/showToast';
+import * as Notifications from 'expo-notifications';
+
export const pauseDownloads = () => async dispatch => {
showToast('Download paused');
diff --git a/src/redux/novel/novel.actions.js b/src/redux/novel/novel.actions.js
index 29d9dd88..e06b974e 100644
--- a/src/redux/novel/novel.actions.js
+++ b/src/redux/novel/novel.actions.js
@@ -86,7 +86,7 @@ export const getNovelAction =
/**
* Check if novel is cached.
*/
- const novel = await getNovel(sourceId, novelUrl);
+ let novel = await getNovel(sourceId, novelUrl);
if (novel) {
/**
@@ -112,7 +112,7 @@ export const getNovelAction =
/**
* Get novel from db.
*/
- const novel = await getNovel(sourceId, novelUrl);
+ novel = await getNovel(sourceId, novelUrl);
novel.chapters = await getChapters(novel.novelId);
dispatch({
diff --git a/src/redux/updates/updates.actions.js b/src/redux/updates/updates.actions.js
index 56a9ad65..c543a121 100644
--- a/src/redux/updates/updates.actions.js
+++ b/src/redux/updates/updates.actions.js
@@ -8,7 +8,7 @@ import {showToast} from '../../hooks/showToast';
export const getUpdatesAction = () => async dispatch => {
const updates = await getUpdates();
- const groups = updates.reduce((groups, update) => {
+ const groups = updates.reduce((grs, update) => {
var dateParts = update.updateTime.split('-');
var jsDate = new Date(
dateParts[0],
@@ -16,11 +16,11 @@ export const getUpdatesAction = () => async dispatch => {
dateParts[2].substr(0, 2),
);
const date = jsDate.toISOString();
- if (!groups[date]) {
- groups[date] = [];
+ if (!grs[date]) {
+ grs[date] = [];
}
- groups[date].push(update);
- return groups;
+ grs[date].push(update);
+ return grs;
}, {});
const groupedUpdates = Object.keys(groups).map(date => {
diff --git a/src/screens/browse/SettingsBrowseScreen.js b/src/screens/browse/SettingsBrowseScreen.js
index d8b8c7ad..cfca3fc6 100644
--- a/src/screens/browse/SettingsBrowseScreen.js
+++ b/src/screens/browse/SettingsBrowseScreen.js
@@ -5,7 +5,6 @@ import {Switch} from 'react-native-paper';
import {useDispatch, useSelector} from 'react-redux';
import {Appbar} from '../../components/Appbar';
-import {ScreenContainer} from '../../components/Common';
import {List} from '../../components/List';
import {useSettings, useTheme} from '../../hooks/reduxHooks';
diff --git a/src/screens/browse/SourceNovels.js b/src/screens/browse/SourceNovels.js
index 90a0946e..10d8fb47 100644
--- a/src/screens/browse/SourceNovels.js
+++ b/src/screens/browse/SourceNovels.js
@@ -2,7 +2,6 @@ import React from 'react';
import {StyleSheet, View, FlatList, Text} from 'react-native';
import {useLibrary, useTheme} from '../../hooks/reduxHooks';
-import EmptyView from '../../components/EmptyView';
import {Appbar} from '../../components/Appbar';
import ListView from '../../components/ListView';
diff --git a/src/screens/browse/discover/BrowseMalCard.js b/src/screens/browse/discover/BrowseMalCard.js
index 851a58ab..aad56b10 100644
--- a/src/screens/browse/discover/BrowseMalCard.js
+++ b/src/screens/browse/discover/BrowseMalCard.js
@@ -1,7 +1,6 @@
import React from 'react';
-import {StyleSheet, Pressable, Text, View, FlatList} from 'react-native';
+import {StyleSheet, Pressable, Text, View} from 'react-native';
import FastImage from 'react-native-fast-image';
-import {Row} from '../../../components/Common';
const GenreChip = ({children, theme}) => (
diff --git a/src/screens/browse/discover/MalTopNovels.js b/src/screens/browse/discover/MalTopNovels.js
index 270f7857..5e1f56e6 100644
--- a/src/screens/browse/discover/MalTopNovels.js
+++ b/src/screens/browse/discover/MalTopNovels.js
@@ -6,9 +6,9 @@ import * as WebBrowser from 'expo-web-browser';
import {Searchbar} from '../../../components/Searchbar/Searchbar';
import {ErrorView} from '../../../components/ErrorView/ErrorView';
-import {useTheme, useSettings} from '../../../hooks/reduxHooks';
+import {useTheme /*, useSettings */} from '../../../hooks/reduxHooks';
import {showToast} from '../../../hooks/showToast';
-import {getDeviceOrientation} from '../../../services/utils/helpers';
+// import {useDeviceOrientation} from '../../../services/utils/helpers';
import {scrapeSearchResults, scrapeTopNovels} from './MyAnimeListScraper';
import BrowseMalCard from './BrowseMalCard';
@@ -24,17 +24,17 @@ const BrowseMalScreen = ({navigation, route}) => {
const malUrl = 'https://myanimelist.net/topmanga.php?type=lightnovels';
- const getNovels = async limit => {
+ const getNovels = async lim => {
try {
- const data = await scrapeTopNovels(limit);
+ const data = await scrapeTopNovels(lim ?? limit);
- setNovels(novels => novels.concat(data));
+ setNovels(before => before.concat(data));
setLoading(false);
- } catch (error) {
- setError(error.message);
+ } catch (err) {
+ setError(err.message);
setNovels([]);
setLoading(false);
- showToast(error.message);
+ showToast(err.message);
}
};
@@ -52,11 +52,11 @@ const BrowseMalScreen = ({navigation, route}) => {
setNovels(data);
setLoading(false);
- } catch (error) {
- setError(error.message);
+ } catch (err) {
+ setError(err.message);
setNovels([]);
setLoading(false);
- showToast(error.message);
+ showToast(err.message);
}
};
@@ -76,21 +76,21 @@ const BrowseMalScreen = ({navigation, route}) => {
/>
);
- const {displayMode, novelsPerRow} = useSettings();
+ // const {displayMode, novelsPerRow} = useSettings();
- const orientation = getDeviceOrientation();
+ // const orientation = useDeviceOrientation();
- const getNovelsPerRow = () => {
- if (displayMode === 2) {
- return 1;
- }
+ // const getNovelsPerRow = () => {
+ // if (displayMode === 2) {
+ // return 1;
+ // }
- if (orientation === 'landscape') {
- return 6;
- } else {
- return novelsPerRow;
- }
- };
+ // if (orientation === 'landscape') {
+ // return 6;
+ // } else {
+ // return novelsPerRow;
+ // }
+ // };
const isCloseToBottom = ({layoutMeasurement, contentOffset, contentSize}) => {
const paddingToBottom = 20;
@@ -150,7 +150,7 @@ const BrowseMalScreen = ({navigation, route}) => {
onScroll={({nativeEvent}) => {
if (!searchText && isCloseToBottom(nativeEvent)) {
getNovels(limit + 50);
- setLimit(limit => limit + 50);
+ setLimit(before => before + 50);
}
}}
ListFooterComponent={
diff --git a/src/screens/browse/discover/MyAnimeListScraper.js b/src/screens/browse/discover/MyAnimeListScraper.js
index 2068e4cb..c53872bb 100644
--- a/src/screens/browse/discover/MyAnimeListScraper.js
+++ b/src/screens/browse/discover/MyAnimeListScraper.js
@@ -11,7 +11,7 @@ const scrapeTopNovels = async pageNo => {
const novels = [];
- $('tr.ranking-list').each(function (res) {
+ $('tr.ranking-list').each(function () {
const novelId = $(this).find('img').attr('data-src').split('/');
const novelCover =
@@ -48,7 +48,7 @@ const scrapeSearchResults = async searchTerm => {
$('.list')
.find('tr')
- .each(function (res) {
+ .each(function () {
const novelName = $(this).find('a > strong').text();
if (novelName) {
diff --git a/src/screens/browse/globalsearch/GlobalSearch.js b/src/screens/browse/globalsearch/GlobalSearch.js
index 62c63079..2a6e843d 100644
--- a/src/screens/browse/globalsearch/GlobalSearch.js
+++ b/src/screens/browse/globalsearch/GlobalSearch.js
@@ -1,5 +1,9 @@
import React, {useEffect, useState} from 'react';
-import {StyleSheet, View, FlatList, ActivityIndicator} from 'react-native';
+import {
+ /* StyleSheet, */ View,
+ FlatList,
+ ActivityIndicator,
+} from 'react-native';
import {ProgressBar} from 'react-native-paper';
import {useSelector} from 'react-redux';
@@ -42,10 +46,7 @@ const GlobalSearch = ({route, navigation}) => {
const library = useLibrary();
useEffect(() => {
- let mounted = true;
novelName && onSubmitEditing();
-
- return () => (mounted = false);
}, []);
const clearSearchbar = () => setSearchText('');
@@ -64,8 +65,8 @@ const GlobalSearch = ({route, navigation}) => {
const source = getSource(globalSearchSources[i].sourceId);
const data = await source.searchNovels(encodeURI(searchText));
- setSearchResults(searchResults => [
- ...searchResults,
+ setSearchResults(before => [
+ ...before,
{
sourceId: globalSearchSources[i].sourceId,
sourceName: globalSearchSources[i].sourceName,
@@ -76,8 +77,8 @@ const GlobalSearch = ({route, navigation}) => {
setLoading(false);
} catch (error) {
showToast(globalSearchSources[i].sourceName + ': ' + error.message);
- setSearchResults(searchResults => [
- ...searchResults,
+ setSearchResults(before => [
+ ...before,
{
sourceId: globalSearchSources[i].sourceId,
sourceName: globalSearchSources[i].sourceName,
@@ -87,7 +88,7 @@ const GlobalSearch = ({route, navigation}) => {
]);
setLoading(false);
}
- setProgress(progress => progress + 1 / globalSearchSources.length);
+ setProgress(before => before + 1 / globalSearchSources.length);
}
};
@@ -160,4 +161,4 @@ const GlobalSearch = ({route, navigation}) => {
export default GlobalSearch;
-const styles = StyleSheet.create({});
+// const styles = StyleSheet.create({});
diff --git a/src/screens/browse/migration/MigrationNovels.js b/src/screens/browse/migration/MigrationNovels.js
index 2dc3544c..dac6d303 100644
--- a/src/screens/browse/migration/MigrationNovels.js
+++ b/src/screens/browse/migration/MigrationNovels.js
@@ -1,6 +1,6 @@
import React, {useEffect, useState} from 'react';
import {
- StyleSheet,
+ /* StyleSheet, */
View,
Text,
FlatList,
@@ -49,8 +49,8 @@ const MigrationNovels = ({navigation, route}) => {
const source = getSource(migrationSources[i].sourceId);
const data = await source.searchNovels(novelName);
- setSearchResults(searchResults => [
- ...searchResults,
+ setSearchResults(before => [
+ ...before,
{
sourceId: migrationSources[i].sourceId,
sourceName: migrationSources[i].sourceName,
@@ -62,8 +62,8 @@ const MigrationNovels = ({navigation, route}) => {
} catch (error) {
showToast(error.message);
- setSearchResults(searchResults => [
- ...searchResults,
+ setSearchResults(before => [
+ ...before,
{
sourceId: migrationSources[i].sourceId,
sourceName: migrationSources[i].sourceName,
@@ -73,7 +73,7 @@ const MigrationNovels = ({navigation, route}) => {
]);
setLoading(false);
}
- setProgress(progress => progress + 1 / migrationSources.length);
+ setProgress(before => before + 1 / migrationSources.length);
}
};
@@ -145,4 +145,4 @@ const MigrationNovels = ({navigation, route}) => {
export default MigrationNovels;
-const styles = StyleSheet.create({});
+// const styles = StyleSheet.create({});
diff --git a/src/screens/history/HistoryScreen.js b/src/screens/history/HistoryScreen.js
index 6f483a73..f153f0a5 100644
--- a/src/screens/history/HistoryScreen.js
+++ b/src/screens/history/HistoryScreen.js
@@ -1,7 +1,6 @@
import React, {useState, useCallback} from 'react';
import {
StyleSheet,
- FlatList,
ActivityIndicator,
Text,
View,
@@ -89,7 +88,7 @@ const History = ({navigation}) => {
};
const groupByDate = rawHistory => {
- const groups = rawHistory.reduce((groups, update) => {
+ const groups = rawHistory.reduce((grs, update) => {
var dateParts = update.historyTimeRead.split('-');
var jsDate = new Date(
dateParts[0],
@@ -97,11 +96,11 @@ const History = ({navigation}) => {
dateParts[2].substr(0, 2),
);
const date = jsDate.toISOString();
- if (!groups[date]) {
- groups[date] = [];
+ if (!grs[date]) {
+ grs[date] = [];
}
- groups[date].push(update);
- return groups;
+ grs[date].push(update);
+ return grs;
}, {});
const groupedHistory = Object.keys(groups).map(date => {
diff --git a/src/screens/library/LibraryScreen.js b/src/screens/library/LibraryScreen.js
index a855d126..a6c77924 100644
--- a/src/screens/library/LibraryScreen.js
+++ b/src/screens/library/LibraryScreen.js
@@ -209,8 +209,8 @@ const LibraryScreen = ({navigation}) => {
{
icon: 'check',
onPress: () => {
- selectedNovels.map(id => markAllChaptersRead(id)),
- setSelectedNovels([]);
+ selectedNovels.map(id => markAllChaptersRead(id));
+ setSelectedNovels([]);
dispatch(getLibraryAction(sort, filter));
},
},
diff --git a/src/screens/more/DownloadsScreen.js b/src/screens/more/DownloadsScreen.js
index dc122235..77c5cdb3 100644
--- a/src/screens/more/DownloadsScreen.js
+++ b/src/screens/more/DownloadsScreen.js
@@ -98,9 +98,7 @@ const Downloads = ({navigation}) => {
const deleteChapter = (chapterId, chapterName) => {
dispatch(deleteChapterAction(chapterId, chapterName));
- setChapters(chapters =>
- chapters.filter(item => item.chapterId !== chapterId),
- );
+ setChapters(chaps => chaps.filter(item => item.chapterId !== chapterId));
};
const renderItem = ({item}) => (
diff --git a/src/screens/more/MoreScreen.js b/src/screens/more/MoreScreen.js
index 81f79c57..3ba9ad64 100644
--- a/src/screens/more/MoreScreen.js
+++ b/src/screens/more/MoreScreen.js
@@ -1,9 +1,8 @@
import React from 'react';
-import {StyleSheet, View, Image, Pressable, Text} from 'react-native';
+import {/* StyleSheet ,*/ View, Pressable, Text} from 'react-native';
import {Switch} from 'react-native-paper';
import {useDispatch, useSelector} from 'react-redux';
-import {Appbar} from '../../components/Appbar';
import {ScreenContainer} from '../../components/Common';
import {List} from '../../components/List';
@@ -148,4 +147,4 @@ const MoreScreen = ({navigation}) => {
export default MoreScreen;
-const styles = StyleSheet.create({});
+// const styles = StyleSheet.create({});
diff --git a/src/screens/novel/NovelScreen.js b/src/screens/novel/NovelScreen.js
index 04286540..335f8843 100644
--- a/src/screens/novel/NovelScreen.js
+++ b/src/screens/novel/NovelScreen.js
@@ -108,7 +108,7 @@ const Novel = ({route, navigation}) => {
const [jumpToChapterModal, showJumpToChapterModal] = useState(false);
- const keyExtractor = useCallback(item => item.chapterId.toString(), []);
+ const keyExtractor = useCallback(i => i.chapterId.toString(), []);
const downloadChapter = (chapterUrl, chapterName, chapterId) =>
dispatch(
@@ -133,11 +133,11 @@ const Novel = ({route, navigation}) => {
navigateToChapter();
} else {
if (isSelected(chapter.chapterId)) {
- setSelected(selected =>
- selected.filter(item => item.chapterId !== chapter.chapterId),
+ setSelected(sel =>
+ sel.filter(it => it.chapterId !== chapter.chapterId),
);
} else {
- setSelected(selected => [...selected, chapter]);
+ setSelected(sel => [...sel, chapter]);
}
}
};
@@ -145,7 +145,7 @@ const Novel = ({route, navigation}) => {
const onSelectLongPress = chapter => {
if (selected.length === 0) {
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Medium);
- setSelected(selected => [...selected, chapter]);
+ setSelected(sel => [...sel, chapter]);
} else {
/**
* Select custom range
@@ -154,8 +154,8 @@ const Novel = ({route, navigation}) => {
if (lastSelectedChapter.chapterId !== chapter.chapterId) {
if (lastSelectedChapter.chapterId > chapter.chapterId) {
- setSelected(selected => [
- ...selected,
+ setSelected(sel => [
+ ...sel,
chapter,
...chapters.filter(
chap =>
@@ -164,8 +164,8 @@ const Novel = ({route, navigation}) => {
),
]);
} else {
- setSelected(selected => [
- ...selected,
+ setSelected(sel => [
+ ...sel,
chapter,
...chapters.filter(
chap =>
@@ -223,10 +223,10 @@ const Novel = ({route, navigation}) => {
showExtraMenu(false);
};
- const renderItem = ({item, index}) => (
+ const renderItem = ({item: it, index}) => (
{
width: Dimensions.get('window').width,
elevation: 2,
}}
- active={selected.length == 0}
+ active={selected.length === 0}
animationDuration={100}
>
{
/>
- {selected.length == 0 && (
+ {selected.length === 0 && (
{
small
color={theme.colorButtonText}
uppercase={false}
- label={novel.unread ? `Start` : `Resume`}
+ label={novel.unread ? 'Start' : 'Resume'}
icon="play"
onPress={() =>
navigation.navigate('Chapter', {
diff --git a/src/screens/novel/components/EditInfoModal.js b/src/screens/novel/components/EditInfoModal.js
index 3c963735..2edb799b 100644
--- a/src/screens/novel/components/EditInfoModal.js
+++ b/src/screens/novel/components/EditInfoModal.js
@@ -9,7 +9,7 @@ import {
} from 'react-native';
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
-import {Button, Modal, Portal, Switch, TextInput} from 'react-native-paper';
+import {Button, Modal, Portal, TextInput} from 'react-native-paper';
import {setNovel} from '../../../redux/novel/novel.actions';
import {updateNovelInfo} from '../../../database/queries/NovelQueries';
@@ -27,8 +27,8 @@ const EditInfoModal = ({theme, hideModal, modalVisible, novel, dispatch}) => {
},
};
- const removeTag = tag => {
- let tags = info.genre.split(',').filter(item => item !== tag);
+ const removeTag = t => {
+ let tags = info.genre.split(',').filter(item => item !== t);
setInfo({...info, genre: tags.join(',')});
};
@@ -118,7 +118,7 @@ const EditInfoModal = ({theme, hideModal, modalVisible, novel, dispatch}) => {
/>
{
}}
onPress={navigateToLastReadChapter}
>
- {novel.unread ? `Start reading ` : `Continue reading `}
+ {novel.unread ? 'Start reading ' : 'Continue reading '}
{lastRead.chapterName}
) : (
diff --git a/src/screens/novel/components/JumpToChapterModal.js b/src/screens/novel/components/JumpToChapterModal.js
index 2af33b3c..b43f33fa 100644
--- a/src/screens/novel/components/JumpToChapterModal.js
+++ b/src/screens/novel/components/JumpToChapterModal.js
@@ -57,12 +57,12 @@ const JumpToChapterModal = ({
});
hideModal();
} else {
- setError(`Enter a valid chapter name`);
+ setError('Enter a valid chapter name');
}
}
};
- const onChangeText = text => setText(text);
+ const onChangeText = txt => setText(txt);
const textInputTheme = {
colors: {
diff --git a/src/screens/novel/components/NovelBottomSheet.js b/src/screens/novel/components/NovelBottomSheet.js
index 00b5f71d..dc56d090 100644
--- a/src/screens/novel/components/NovelBottomSheet.js
+++ b/src/screens/novel/components/NovelBottomSheet.js
@@ -8,7 +8,6 @@ import {
} from 'react-native';
import {TabView, SceneMap, TabBar} from 'react-native-tab-view';
-import {Checkbox as PaperCheckbox} from 'react-native-paper';
import Bottomsheet from 'rn-sliding-up-panel';
import {Checkbox, SortItem} from '../../../components/Checkbox/Checkbox';
diff --git a/src/screens/novel/components/Tracker/SetTrackChaptersDialog.js b/src/screens/novel/components/Tracker/SetTrackChaptersDialog.js
index 0973b28f..160c9d94 100644
--- a/src/screens/novel/components/Tracker/SetTrackChaptersDialog.js
+++ b/src/screens/novel/components/Tracker/SetTrackChaptersDialog.js
@@ -1,10 +1,6 @@
import React, {useState} from 'react';
import {StyleSheet, Text} from 'react-native';
import {Modal, TextInput} from 'react-native-paper';
-import {
- RadioButton,
- RadioButtonGroup,
-} from '../../../../components/RadioButton';
const SetTrackChaptersDialog = ({
trackItem,
diff --git a/src/screens/reader/ReaderScreen.js b/src/screens/reader/ReaderScreen.js
index e880f1f2..601e0ae1 100644
--- a/src/screens/reader/ReaderScreen.js
+++ b/src/screens/reader/ReaderScreen.js
@@ -205,9 +205,9 @@ const Chapter = ({route, navigation}) => {
}
};
- const getChapter = async chapterId => {
+ const getChapter = async id => {
try {
- if (chapterId) {
+ if (id) {
const chapterDownloaded = await getChapterFromDB(chapterId);
if (chapterDownloaded) {
@@ -223,10 +223,10 @@ const Chapter = ({route, navigation}) => {
}
setLoading(false);
- } catch (error) {
- setError(error.message);
+ } catch (e) {
+ setError(e.message);
setLoading(false);
- showToast(error.message);
+ showToast(e.message);
}
};
@@ -295,6 +295,7 @@ const Chapter = ({route, navigation}) => {
}, [autoScroll, currentOffset]);
const isCloseToBottom = useCallback(
+ // eslint-disable-next-line no-shadow
({layoutMeasurement, contentOffset, contentSize}) => {
const paddingToBottom = 40;
return (
@@ -319,12 +320,10 @@ const Chapter = ({route, navigation}) => {
const onScroll = useCallback(({nativeEvent}) => {
const offsetY = nativeEvent.contentOffset.y;
- const position =
+ const pos =
nativeEvent.contentOffset.y + nativeEvent.layoutMeasurement.height;
- const percentage = Math.round(
- (position / nativeEvent.contentSize.height) * 100,
- );
+ const percentage = Math.round((pos / nativeEvent.contentSize.height) * 100);
setScrollPercentage(percentage);
if (!incognitoMode) {
@@ -418,7 +417,7 @@ const Chapter = ({route, navigation}) => {
dispatch(setAppSettings('useWebViewForChapter', !useWebViewForChapter));
const onWebViewNavigationStateChange = async ({url}) => {
- if ((sourceId === 50 || sourceId == 62) && url !== 'about:blank') {
+ if ((sourceId === 50 || sourceId === 62) && url !== 'about:blank') {
setLoading(true);
const res = await fetchChapter(sourceId, novelUrl, url);
setChapter(res);
diff --git a/src/screens/reader/components/ReaderBottomSheet/ReaderBottomSheet.js b/src/screens/reader/components/ReaderBottomSheet/ReaderBottomSheet.js
index 04e0e692..3c92ac36 100644
--- a/src/screens/reader/components/ReaderBottomSheet/ReaderBottomSheet.js
+++ b/src/screens/reader/components/ReaderBottomSheet/ReaderBottomSheet.js
@@ -1,22 +1,13 @@
import React, {memo, useState} from 'react';
-import {
- StyleSheet,
- View,
- Text,
- Pressable,
- ScrollView,
- Animated,
-} from 'react-native';
+import {StyleSheet, View, Text, ScrollView, Animated} from 'react-native';
import Slider from '@react-native-community/slider';
-import {IconButton, Switch} from 'react-native-paper';
+import {IconButton} from 'react-native-paper';
import Bottomsheet from 'rn-sliding-up-panel';
import BottomSheetHandle from '../../../../components/BottomSheetHandle';
import {Row} from '../../../../components/Common';
-import {fonts} from '../../../../services/utils/constants';
-
import {
setAppSettings,
setReaderSettings,
diff --git a/src/screens/reader/components/ReaderBottomSheet/components/ReaderBottomSheetFontPicker.js b/src/screens/reader/components/ReaderBottomSheet/components/ReaderBottomSheetFontPicker.js
index 0500eacd..1ef335aa 100644
--- a/src/screens/reader/components/ReaderBottomSheet/components/ReaderBottomSheetFontPicker.js
+++ b/src/screens/reader/components/ReaderBottomSheet/components/ReaderBottomSheetFontPicker.js
@@ -1,5 +1,4 @@
import React from 'react';
-import PropTypes from 'prop-types';
import {Pressable, ScrollView, StyleSheet, Text, View} from 'react-native';
import {useDispatch} from 'react-redux';
diff --git a/src/screens/reader/components/ReaderSeekBar.js b/src/screens/reader/components/ReaderSeekBar.js
index d415166d..4db75521 100644
--- a/src/screens/reader/components/ReaderSeekBar.js
+++ b/src/screens/reader/components/ReaderSeekBar.js
@@ -2,7 +2,7 @@ import React from 'react';
import {Dimensions, View, Text, StyleSheet} from 'react-native';
import Slider from '@react-native-community/slider';
-import {getDeviceOrientation} from '../../../services/utils/helpers';
+import {useDeviceOrientation} from '../../../services/utils/helpers';
const VerticalScrollbar = ({
theme,
@@ -23,92 +23,94 @@ const VerticalScrollbar = ({
setLoading(false);
};
+ const screenOrientation = useDeviceOrientation();
+
if (hide) {
return null;
+ }
+
+ if (screenOrientation === 'potrait' && verticalSeekbar) {
+ return (
+
+
+ {scrollPercentage}
+
+
+
+ 100
+
+
+ );
} else {
- if (getDeviceOrientation() === 'potrait' && verticalSeekbar) {
- return (
-
+
-
- {scrollPercentage}
-
-
-
- 100
-
-
- );
- } else {
- return (
-
+
+
-
- {scrollPercentage}
-
-
-
- 100
-
-
- );
- }
+ 100
+
+
+ );
}
};
diff --git a/src/screens/setting/SettingsBackupScreen.js b/src/screens/setting/SettingsBackupScreen.js
index 5e1f8279..ad515046 100644
--- a/src/screens/setting/SettingsBackupScreen.js
+++ b/src/screens/setting/SettingsBackupScreen.js
@@ -1,5 +1,4 @@
import React from 'react';
-import {useDispatch} from 'react-redux';
import {Appbar} from '../../components/Appbar';
import {List} from '../../components/List';
diff --git a/src/screens/setting/SettingsReaderScreen.js b/src/screens/setting/SettingsReaderScreen.js
index 14c537f1..b4fd7f9e 100644
--- a/src/screens/setting/SettingsReaderScreen.js
+++ b/src/screens/setting/SettingsReaderScreen.js
@@ -214,7 +214,9 @@ const FirstRoute = React.memo(({theme, dispatch, reader}) => {
keyboardType="numeric"
onChangeText={text =>
text !== '' &&
- dispatch(setAppSettings('autoScrollInterval', parseInt(text)))
+ dispatch(
+ setAppSettings('autoScrollInterval', parseInt(text, 10)),
+ )
}
/>
diff --git a/src/screens/setting/SettingsTrackerScreen.js b/src/screens/setting/SettingsTrackerScreen.js
index 9dc43eb0..a768e95e 100644
--- a/src/screens/setting/SettingsTrackerScreen.js
+++ b/src/screens/setting/SettingsTrackerScreen.js
@@ -46,14 +46,14 @@ const TrackerScreen = ({navigation}) => {
myAnimeListConfig.authUrl,
myAnimeListConfig.redirectUri,
).then(res => {
- console.log(res.type);
+ // console.log(res.type);
if (res.type === 'success') {
const {url} = res;
- const codeExtractor = new RegExp(/=([^&]+)/);
+ const codeExtractor = new RegExp(/[=]([^&]+)/);
let code = url.match(codeExtractor);
- console.log(code);
+ // console.log(code);
if (code) {
code = code[1];
@@ -61,7 +61,7 @@ const TrackerScreen = ({navigation}) => {
code,
myAnimeListConfig.codeChallenge,
).then(objects => {
- console.log(objects);
+ // console.log(objects);
dispatch(setTracker(objects));
});
}
@@ -74,7 +74,7 @@ const TrackerScreen = ({navigation}) => {
/>
{tracker && tracker.expires_in < new Date(Date.now()) && (
<>
-
+
Settings
{
setSearchText('');
};
- const getNovels = async () => {
- try {
- if (page <= totalPages) {
- const source = getSource(sourceId);
- const res = await source.popularNovels(page);
- setNovels(prevState => [...prevState, ...res.novels]);
- setTotalPages(res.totalPages);
+ const getNovels = useCallback(
+ async loadPage => {
+ try {
+ if (loadPage <= totalPages) {
+ const source = getSource(sourceId);
+ const res = await source.popularNovels(loadPage);
+ setNovels(prevState => [...prevState, ...res.novels]);
+ setTotalPages(res.totalPages);
+ setLoading(false);
+ }
+ } catch (e) {
+ setError(e.message);
+ showToast(e.message);
+ setNovels([]);
setLoading(false);
}
- } catch (error) {
- setError(error.message);
- showToast(error.message);
- setNovels([]);
- setLoading(false);
- }
- };
+ },
+ [sourceId, totalPages],
+ );
const getSearchResults = async () => {
try {
@@ -67,30 +70,23 @@ const Extension = ({navigation, route}) => {
const res = await source.searchNovels(searchText);
setNovels(res);
setLoading(false);
- } catch (error) {
- setError(error.message);
- showToast(error.message);
+ } catch (e) {
+ setError(e.message);
+ showToast(e.message);
setNovels([]);
setLoading(false);
}
};
const checkIFInLibrary = useCallback(
- (sourceId, novelUrl) =>
- library.some(
- obj => obj.novelUrl === novelUrl && obj.sourceId === sourceId,
- ),
- [],
+ (id, novelUrl) =>
+ library.some(obj => obj.novelUrl === novelUrl && obj.sourceId === id),
+ [library],
);
- useEffect(() => {
- let mounted = true;
- getNovels();
-
- return () => {
- mounted = false;
- };
- }, [page]);
+ useCallback(() => {
+ getNovels(page);
+ }, [page, getNovels]);
const getNextPage = () => {
if (!searchText) {
diff --git a/src/screens/updates/UpdatesScreen.js b/src/screens/updates/UpdatesScreen.js
index 4062b046..58181534 100644
--- a/src/screens/updates/UpdatesScreen.js
+++ b/src/screens/updates/UpdatesScreen.js
@@ -2,7 +2,6 @@ import React, {useState, useCallback} from 'react';
import {
StyleSheet,
View,
- FlatList,
ActivityIndicator,
RefreshControl,
Text,
@@ -44,7 +43,7 @@ const Updates = ({navigation}) => {
useFocusEffect(
useCallback(() => {
dispatch(getUpdatesAction());
- }, []),
+ }, [dispatch]),
);
const onRefresh = async () => {
@@ -65,7 +64,7 @@ const Updates = ({navigation}) => {
novelName: item.novelName,
bookmark: item.bookmark,
}),
- [],
+ [navigation],
);
const onPressCover = useCallback(
@@ -76,7 +75,7 @@ const Updates = ({navigation}) => {
novelName: item.novelName,
novelCover: item.novelCover,
}),
- [],
+ [navigation],
);
const downloadChapter = useCallback(
@@ -91,13 +90,16 @@ const Updates = ({navigation}) => {
),
);
},
- [],
+ [dispatch],
);
- const deleteChapter = useCallback((chapterId, chapterName) => {
- dispatch(deleteChapterAction(chapterId, chapterName));
- dispatch(getUpdatesAction());
- }, []);
+ const deleteChapter = useCallback(
+ (chapterId, chapterName) => {
+ dispatch(deleteChapterAction(chapterId, chapterName));
+ dispatch(getUpdatesAction());
+ },
+ [dispatch],
+ );
const renderItem = ({item}) => (
{
+export const getAccessToken = async (code, challenge) => {
const headers = {
'Content-Type': 'application/x-www-form-urlencoded',
};
@@ -46,7 +46,7 @@ export const getAccessToken = async (code, codeChallenge) => {
client_id: myAnimeListConfig.clientId,
grant_type: 'authorization_code',
code,
- code_verifier: codeChallenge,
+ code_verifier: challenge,
};
const response = await fetch(myAnimeListConfig.tokenUrl, {
@@ -62,7 +62,7 @@ export const getAccessToken = async (code, codeChallenge) => {
expires_in: new Date(Date.now() + tokenResponse.expires_in),
};
- console.log(tokenResponse);
+ // console.log(tokenResponse);
return tokenResponse;
};
@@ -117,7 +117,7 @@ export const updateItem = async (malId, bearerToken, body) => {
});
const listItem = await res.json();
- console.log(listItem);
+ // console.log(listItem);
return listItem;
};
@@ -136,7 +136,7 @@ export const updateMalChaptersRead = async (malId, bearerToken, body) => {
});
const listItem = await res.json();
- console.log(listItem.num_chapters_read);
+ // console.log(listItem.num_chapters_read);
return listItem.num_chapters_read;
};
diff --git a/src/services/backup/BackupQueries.js b/src/services/backup/BackupQueries.js
index 45b38228..4eb67be2 100644
--- a/src/services/backup/BackupQueries.js
+++ b/src/services/backup/BackupQueries.js
@@ -1,7 +1,7 @@
import * as SQLite from 'expo-sqlite';
const db = SQLite.openDatabase('lnreader.db');
-const getLibraryNovelsQuery = `SELECT * FROM novels WHERE followed = 1`;
+const getLibraryNovelsQuery = 'SELECT * FROM novels WHERE followed = 1';
const getLibraryNovels = () => {
return new Promise((resolve, reject) =>
@@ -16,7 +16,8 @@ const getLibraryNovels = () => {
);
};
-const getLibraryChaptersQuery = `SELECT chapters.* FROM chapters JOIN novels ON chapters.novelId = novels.novelId WHERE novels.followed = 1`;
+const getLibraryChaptersQuery =
+ 'SELECT chapters.* FROM chapters JOIN novels ON chapters.novelId = novels.novelId WHERE novels.followed = 1';
const getLibraryChapters = () => {
return new Promise((resolve, reject) =>
@@ -31,7 +32,8 @@ const getLibraryChapters = () => {
);
};
-const getLibraryDownloadsQuery = `SELECT downloads.* FROM downloads JOIN chapters ON downloads.downloadChapterId = chapters.chapterId JOIN novels ON chapters.novelId = novels.novelId WHERE novels.followed = 1`;
+const getLibraryDownloadsQuery =
+ 'SELECT downloads.* FROM downloads JOIN chapters ON downloads.downloadChapterId = chapters.chapterId JOIN novels ON chapters.novelId = novels.novelId WHERE novels.followed = 1';
const getLibraryDownloads = () => {
return new Promise((resolve, reject) =>
@@ -46,7 +48,8 @@ const getLibraryDownloads = () => {
);
};
-const restoreNovelsQuery = `INSERT OR REPLACE INTO novels (novelId, novelUrl, sourceUrl, sourceId, source, novelName, novelCover, novelSummary, author, artist, status, genre, followed, unread) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`;
+const restoreNovelsQuery =
+ 'INSERT OR REPLACE INTO novels (novelId, novelUrl, sourceUrl, sourceId, source, novelName, novelCover, novelSummary, author, artist, status, genre, followed, unread) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
const restoreNovels = async novel => {
db.transaction(tx =>
@@ -74,7 +77,8 @@ const restoreNovels = async novel => {
);
};
-const restoreChaptersQuery = `INSERT OR IGNORE INTO chapters (novelId, chapterId, chapterUrl, chapterName, releaseDate, bookmark, \`read\`, downloaded) VALUES (?, ?, ?, ?, ?, ?, ?, ?)`;
+const restoreChaptersQuery =
+ 'INSERT OR IGNORE INTO chapters (novelId, chapterId, chapterUrl, chapterName, releaseDate, bookmark, `read`, downloaded) VALUES (?, ?, ?, ?, ?, ?, ?, ?)';
const restoreChapters = async chapter => {
const {
@@ -107,7 +111,8 @@ const restoreChapters = async chapter => {
);
};
-const restoreDownloadsQuery = `INSERT OR IGNORE INTO downloads (downloadChapterId, chapterName, chapterText) VALUES (?, ?, ?)`;
+const restoreDownloadsQuery =
+ 'INSERT OR IGNORE INTO downloads (downloadChapterId, chapterName, chapterText) VALUES (?, ?, ?)';
const restoreDownloads = async chapter => {
const {downloadChapterId, chapterName, chapterText} = chapter;
diff --git a/src/services/updates.js b/src/services/updates.js
index 7f4efb18..86cdb7e9 100644
--- a/src/services/updates.js
+++ b/src/services/updates.js
@@ -54,7 +54,7 @@ export const updateNovel = async (sourceId, novelUrl, novelId) => {
tx.executeSql(
"INSERT OR IGNORE INTO updates (chapterId, novelId, updateTime) values (?, ?, (datetime('now','localtime')))",
[insertId, novelId],
- (txObj, res) => {
+ (txOBJ, res) => {
// console.log(
// "Inserted Chapter Id -> " +
// insertId +
@@ -62,7 +62,7 @@ export const updateNovel = async (sourceId, novelUrl, novelId) => {
// novelId
// );
},
- (txObj, error) => console.log('Error ', error),
+ (txOBJ, error) => console.log('Error ', error),
);
}
},
@@ -95,8 +95,8 @@ export const updateNovelChapters = async (
tx.executeSql(
"INSERT OR IGNORE INTO updates (chapterId, novelId, updateTime) values (?, ?, (datetime('now','localtime')))",
[insertId, novelId],
- (txObj, res) => {},
- (txObj, error) => console.log('Error ', error),
+ (txOBJ, res) => {},
+ (txOBJ, error) => console.log('Error ', error),
);
}
},
diff --git a/src/services/utils/helpers.js b/src/services/utils/helpers.js
index 8011aa9d..81df9536 100644
--- a/src/services/utils/helpers.js
+++ b/src/services/utils/helpers.js
@@ -16,7 +16,7 @@ export const parseChapterNumber = chapterName => {
}
};
-export const getDeviceOrientation = () => {
+export const useDeviceOrientation = () => {
const window = useWindowDimensions();
if (window.width > window.height) {
diff --git a/src/sources/ar/arnovel.js b/src/sources/ar/arnovel.js
index fb8fa8c9..fd4e74aa 100644
--- a/src/sources/ar/arnovel.js
+++ b/src/sources/ar/arnovel.js
@@ -12,16 +12,19 @@ const popularNovels = async page => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novels = [];
- $('.page-item-detail').each(function () {
- const novelName = $(this).find('.h5 > a').text();
+ loadedCheerio('.page-item-detail').each(function () {
+ const novelName = loadedCheerio(this).find('.h5 > a').text();
const novelCover =
'https://github.com/LNReader/lnreader-sources/blob/main/src/coverNotAvailable.jpg?raw=true';
- let novelUrl = $(this).find('.h5 > a').attr('href').split('/')[4];
+ let novelUrl = loadedCheerio(this)
+ .find('.h5 > a')
+ .attr('href')
+ .split('/')[4];
const novel = {
sourceId,
@@ -42,11 +45,11 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novel = {sourceId, sourceName, url, novelUrl};
- novel.novelName = $('.post-title > h1')
+ novel.novelName = loadedCheerio('.post-title > h1')
.text()
.replace(/[\t\n]/g, '')
.trim();
@@ -54,13 +57,13 @@ const parseNovelAndChapters = async novelUrl => {
novel.novelCover =
'https://github.com/LNReader/lnreader-sources/blob/main/src/coverNotAvailable.jpg?raw=true';
- $('.post-content_item').each(function () {
- detailName = $(this)
+ loadedCheerio('.post-content_item').each(function () {
+ const detailName = loadedCheerio(this)
.find('.summary-heading > h5')
.text()
.replace(/[\t\n]/g, '')
.trim();
- detail = $(this)
+ const detail = loadedCheerio(this)
.find('.summary-content')
.text()
.replace(/[\t\n]/g, '')
@@ -79,15 +82,17 @@ const parseNovelAndChapters = async novelUrl => {
}
});
- $('.description-summary > div.summary__content').find('em').remove();
+ loadedCheerio('.description-summary > div.summary__content')
+ .find('em')
+ .remove();
- novel.summary = $('.description-summary > div.summary__content')
+ novel.summary = loadedCheerio('.description-summary > div.summary__content')
.text()
.trim();
let novelChapters = [];
- // const novelId = $('#manga-chapters-holder').attr('data-id');
+ // const novelId = loadedCheerio('#manga-chapters-holder').attr('data-id');
// let formData = new FormData();
// formData.append('action', 'manga_get_chapters');
@@ -98,18 +103,18 @@ const parseNovelAndChapters = async novelUrl => {
});
const text = await data.text();
- $ = cheerio.load(text);
+ loadedCheerio = cheerio.load(text);
- $('.wp-manga-chapter').each(function () {
- chapterName = $(this)
+ loadedCheerio('.wp-manga-chapter').each(function () {
+ const chapterName = loadedCheerio(this)
.find('a')
.text()
.replace(/[\t\n]/g, '')
.trim();
- releaseDate = $(this).find('span').text().trim();
+ const releaseDate = loadedCheerio(this).find('span').text().trim();
- chapterUrl = $(this).find('a').attr('href').split('/');
+ let chapterUrl = loadedCheerio(this).find('a').attr('href').split('/');
chapterUrl[6]
? (chapterUrl = chapterUrl[5] + '/' + chapterUrl[6])
@@ -129,10 +134,10 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
- const chapterName = $('h1#chapter-heading').text();
- const chapterText = $('.reading-content').html();
+ const chapterName = loadedCheerio('h1#chapter-heading').text();
+ const chapterText = loadedCheerio('.reading-content').html();
const chapter = {
sourceId,
@@ -151,16 +156,19 @@ const searchNovels = async searchTerm => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novels = [];
- $('.c-tabs-item__content').each(function () {
- const novelName = $(this).find('.h4 > a').text();
+ loadedCheerio('.c-tabs-item__content').each(function () {
+ const novelName = loadedCheerio(this).find('.h4 > a').text();
const novelCover =
'https://github.com/LNReader/lnreader-sources/blob/main/src/coverNotAvailable.jpg?raw=true';
- let novelUrl = $(this).find('.h4 > a').attr('href').split('/')[4];
+ let novelUrl = loadedCheerio(this)
+ .find('.h4 > a')
+ .attr('href')
+ .split('/')[4];
const novel = {
sourceId,
diff --git a/src/sources/br/ArthurScans.js b/src/sources/br/ArthurScans.js
index c807cfdd..62062e58 100644
--- a/src/sources/br/ArthurScans.js
+++ b/src/sources/br/ArthurScans.js
@@ -14,15 +14,20 @@ const popularNovels = async page => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novels = [];
- $('.page-item-detail').each(function () {
- const novelName = $(this).find('.item-summary h3').text().trim();
- const novelCover = $(this).find('.img-responsive').attr('data-src');
+ loadedCheerio('.page-item-detail').each(function () {
+ const novelName = loadedCheerio(this)
+ .find('.item-summary h3')
+ .text()
+ .trim();
+ const novelCover = loadedCheerio(this)
+ .find('.img-responsive')
+ .attr('data-src');
- let novelUrl = $(this).find('div > a').attr('href');
+ let novelUrl = loadedCheerio(this).find('div > a').attr('href');
const novel = {
sourceId,
@@ -43,21 +48,24 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novel = {sourceId, url, sourceName};
- $('.post-title > h3 > span').remove();
+ loadedCheerio('.post-title > h3 > span').remove();
novel.novelUrl = novelUrl;
- novel.novelName = $('.post-title > h1').text().trim();
+ novel.novelName = loadedCheerio('.post-title > h1').text().trim();
- novel.novelCover = $('.summary_image > a > img').attr('data-src');
+ novel.novelCover = loadedCheerio('.summary_image > a > img').attr('data-src');
- $('.post-content_item').each(function () {
- const detailName = $(this).find('.summary-heading > h5').text().trim();
- const detail = $(this).find('.summary-content').text().trim();
+ loadedCheerio('.post-content_item').each(function () {
+ const detailName = loadedCheerio(this)
+ .find('.summary-heading > h5')
+ .text()
+ .trim();
+ const detail = loadedCheerio(this).find('.summary-content').text().trim();
switch (detailName) {
case 'Genre(s)':
@@ -74,25 +82,27 @@ const parseNovelAndChapters = async novelUrl => {
}
});
- $('.description-summary > div.summary__content').find('em').remove();
- $('.premium-block').remove();
+ loadedCheerio('.description-summary > div.summary__content')
+ .find('em')
+ .remove();
+ loadedCheerio('.premium-block').remove();
- novel.summary = $('div.summary__content').text().trim();
+ novel.summary = loadedCheerio('div.summary__content').text().trim();
let novelChapters = [];
const data = await fetch(novelUrl + 'ajax/chapters', {method: 'POST'});
const text = await data.text();
- $ = cheerio.load(text);
+ loadedCheerio = cheerio.load(text);
- $('.wp-manga-chapter').each(function () {
- $('i').remove();
+ loadedCheerio('.wp-manga-chapter').each(function () {
+ loadedCheerio('i').remove();
- const chapterName = $(this).find('a').text().trim();
+ const chapterName = loadedCheerio(this).find('a').text().trim();
const releaseDate = null;
- const chapterUrl = $(this).find('a').attr('href');
+ const chapterUrl = loadedCheerio(this).find('a').attr('href');
const chapter = {chapterName, releaseDate, chapterUrl};
@@ -110,10 +120,10 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
- const chapterName = $('#chapter-heading').text();
- const chapterText = $('.reading-content').html();
+ const chapterName = loadedCheerio('#chapter-heading').text();
+ const chapterText = loadedCheerio('.reading-content').html();
const chapter = {
sourceId,
@@ -132,15 +142,20 @@ const searchNovels = async searchTerm => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novels = [];
- $('.c-tabs-item__content').each(function (result) {
- const novelName = $(this).find('.post-title > h3').text().trim();
- const novelCover = $(this).find('div > div > a > img').attr('data-src');
+ loadedCheerio('.c-tabs-item__content').each(function () {
+ const novelName = loadedCheerio(this)
+ .find('.post-title > h3')
+ .text()
+ .trim();
+ const novelCover = loadedCheerio(this)
+ .find('div > div > a > img')
+ .attr('data-src');
- let novelUrl = $(this).find('div > div > a').attr('href');
+ let novelUrl = loadedCheerio(this).find('div > div > a').attr('href');
novelUrl = novelUrl.replace(`${baseUrl}/`, '');
const novel = {
diff --git a/src/sources/br/ReaperScansBr.js b/src/sources/br/ReaperScansBr.js
index 62f34af8..cdec2e57 100644
--- a/src/sources/br/ReaperScansBr.js
+++ b/src/sources/br/ReaperScansBr.js
@@ -15,15 +15,20 @@ const popularNovels = async page => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novels = [];
- $('.page-item-detail').each(function (result) {
- const novelName = $(this).find('.item-summary h3').text().trim();
- const novelCover = $(this).find('.img-responsive').attr('data-src');
+ loadedCheerio('.page-item-detail').each(function () {
+ const novelName = loadedCheerio(this)
+ .find('.item-summary h3')
+ .text()
+ .trim();
+ const novelCover = loadedCheerio(this)
+ .find('.img-responsive')
+ .attr('data-src');
- let novelUrl = $(this).find('div > a').attr('href');
+ let novelUrl = loadedCheerio(this).find('div > a').attr('href');
const novel = {
sourceId,
@@ -44,21 +49,24 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novel = {sourceId, url, sourceName};
- $('.post-title > h3 > span').remove();
+ loadedCheerio('.post-title > h3 > span').remove();
novel.novelUrl = novelUrl;
- novel.novelName = $('.post-title > h1').text().trim();
+ novel.novelName = loadedCheerio('.post-title > h1').text().trim();
- novel.novelCover = $('.summary_image > a > img').attr('data-src');
+ novel.novelCover = loadedCheerio('.summary_image > a > img').attr('data-src');
- $('.post-content_item').each(function () {
- const detailName = $(this).find('.summary-heading > h5').text().trim();
- const detail = $(this).find('.summary-content').text().trim();
+ loadedCheerio('.post-content_item').each(function () {
+ const detailName = loadedCheerio(this)
+ .find('.summary-heading > h5')
+ .text()
+ .trim();
+ const detail = loadedCheerio(this).find('.summary-content').text().trim();
switch (detailName) {
case 'Genre(s)':
@@ -75,20 +83,22 @@ const parseNovelAndChapters = async novelUrl => {
}
});
- $('.description-summary > div.summary__content').find('em').remove();
- $('.premium-block').remove();
+ loadedCheerio('.description-summary > div.summary__content')
+ .find('em')
+ .remove();
+ loadedCheerio('.premium-block').remove();
- novel.summary = $('div.summary__content').text().trim();
+ novel.summary = loadedCheerio('div.summary__content').text().trim();
let novelChapters = [];
- $('.wp-manga-chapter').each(function () {
- $('i').remove();
+ loadedCheerio('.wp-manga-chapter').each(function () {
+ loadedCheerio('i').remove();
- const chapterName = $(this).find('a').text().trim();
+ const chapterName = loadedCheerio(this).find('a').text().trim();
const releaseDate = null;
- const chapterUrl = $(this).find('a').attr('href');
+ const chapterUrl = loadedCheerio(this).find('a').attr('href');
const chapter = {chapterName, releaseDate, chapterUrl};
@@ -106,10 +116,10 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
- const chapterName = $('#chapter-heading').text();
- let chapterText = $('.reading-content').html();
+ const chapterName = loadedCheerio('#chapter-heading').text();
+ let chapterText = loadedCheerio('.reading-content').html();
const chapter = {
sourceId,
novelUrl,
@@ -127,15 +137,20 @@ const searchNovels = async searchTerm => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novels = [];
- $('.c-tabs-item__content').each(function (result) {
- const novelName = $(this).find('.post-title > h3').text().trim();
- const novelCover = $(this).find('div > div > a > img').attr('data-src');
+ loadedCheerio('.c-tabs-item__content').each(function () {
+ const novelName = loadedCheerio(this)
+ .find('.post-title > h3')
+ .text()
+ .trim();
+ const novelCover = loadedCheerio(this)
+ .find('div > div > a > img')
+ .attr('data-src');
- let novelUrl = $(this).find('div > div > a').attr('href');
+ let novelUrl = loadedCheerio(this).find('div > div > a').attr('href');
novelUrl = novelUrl.replace(`${baseUrl}/`, '');
const novel = {
diff --git a/src/sources/ch/yushubo.js b/src/sources/ch/yushubo.js
index 2e28a660..bf5af2e5 100644
--- a/src/sources/ch/yushubo.js
+++ b/src/sources/ch/yushubo.js
@@ -14,16 +14,20 @@ const popularNovels = async page => {
});
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novels = [];
- $('.clearfix > li').each(function (result) {
+ loadedCheerio('.clearfix > li').each(function () {
const novelUrl =
- $(this).find('a').attr('href').replace('.html', '').substring(1) + '/';
+ loadedCheerio(this)
+ .find('a')
+ .attr('href')
+ .replace('.html', '')
+ .substring(1) + '/';
- const novelName = $(this).find('a').text();
- let novelCover = $(this).find('img').attr('src');
+ const novelName = loadedCheerio(this).find('a').text();
+ let novelCover = loadedCheerio(this).find('img').attr('src');
novelCover = novelCover.includes('https://tva1.sinaimg.cn/')
? `${novelCover}`
: `${baseUrl}${novelCover}`;
@@ -52,7 +56,7 @@ const parseNovelAndChapters = async novelUrl => {
});
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novel = {};
@@ -64,15 +68,15 @@ const parseNovelAndChapters = async novelUrl => {
novel.novelUrl = novelUrl;
- novel.novelName = $('dd > h2').text();
+ novel.novelName = loadedCheerio('dd > h2').text();
- novel.novelCover = $('dt > img').attr('src');
+ novel.novelCover = loadedCheerio('dt > img').attr('src');
- novel.summary = $('div.content > p').text();
+ novel.summary = loadedCheerio('div.content > p').text();
let info = [];
- $('.info a').each(function (result) {
- info.push($(this).text());
+ loadedCheerio('.info a').each(function () {
+ info.push(loadedCheerio(this).text());
});
novel.genre = info[0];
@@ -85,9 +89,9 @@ const parseNovelAndChapters = async novelUrl => {
let chapters = [];
- $('.bookshelf-list a').each(function (result) {
- let chapterUrl = $(this).attr('href').substring(1);
- let chapterName = $(this).attr('title');
+ loadedCheerio('.bookshelf-list a').each(function () {
+ let chapterUrl = loadedCheerio(this).attr('href').substring(1);
+ let chapterName = loadedCheerio(this).attr('title');
let releaseDate = null;
chapters.push({
@@ -113,10 +117,10 @@ const parseChapter = async (novelUrl, chapterUrl) => {
});
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
- const chapterName = $('.read-section h3').text();
- let chapterText = $('.read-section').html();
+ const chapterName = loadedCheerio('.read-section h3').text();
+ let chapterText = loadedCheerio('.read-section').html();
const chapter = {
sourceId: 52,
@@ -144,16 +148,20 @@ const searchNovels = async searchTerm => {
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novels = [];
- $('.clearfix > li').each(function (result) {
+ loadedCheerio('.clearfix > li').each(function () {
let novelUrl =
- $(this).find('a').attr('href').replace('.html', '').substring(1) + '/';
+ loadedCheerio(this)
+ .find('a')
+ .attr('href')
+ .replace('.html', '')
+ .substring(1) + '/';
- const novelName = $(this).find('a').text();
- let novelCover = $(this).find('img').attr('src');
+ const novelName = loadedCheerio(this).find('a').text();
+ let novelCover = loadedCheerio(this).find('img').attr('src');
novelCover = novelCover.includes('https://tva1.sinaimg.cn/')
? `${novelCover}`
: `${baseUrl}${novelCover}`;
diff --git a/src/sources/en/boxnovel.js b/src/sources/en/boxnovel.js
index 67c87047..2ef03ede 100644
--- a/src/sources/en/boxnovel.js
+++ b/src/sources/en/boxnovel.js
@@ -12,15 +12,15 @@ const popularNovels = async page => {
const result = await fetch(url);
const body = await result.text();
- const $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.page-item-detail').each(function (result) {
- const novelName = $(this).find('h3 > a').text();
- const novelCover = $(this).find('img').attr('src');
+ loadedCheerio('.page-item-detail').each(function () {
+ const novelName = loadedCheerio(this).find('h3 > a').text();
+ const novelCover = loadedCheerio(this).find('img').attr('src');
- let novelUrl = $(this).find('h3 > a').attr('href');
+ let novelUrl = loadedCheerio(this).find('h3 > a').attr('href');
novelUrl = novelUrl.replace(`${baseUrl}/`, '');
const novel = {
@@ -42,11 +42,11 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- let $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novel = {};
- $('.post-title > h3 > span').remove();
+ loadedCheerio('.post-title > h3 > span').remove();
novel.sourceId = 1;
@@ -56,20 +56,20 @@ const parseNovelAndChapters = async novelUrl => {
novel.novelUrl = novelUrl;
- novel.novelName = $('.post-title > h3')
+ novel.novelName = loadedCheerio('.post-title > h3')
.text()
.replace(/[\t\n]/g, '')
.trim();
- novel.novelCover = $('.summary_image > a > img').attr('src');
+ novel.novelCover = loadedCheerio('.summary_image > a > img').attr('src');
- $('.post-content_item').each(function (result) {
- detailName = $(this)
+ loadedCheerio('.post-content_item').each(function () {
+ const detailName = loadedCheerio(this)
.find('.summary-heading > h5')
.text()
.replace(/[\t\n]/g, '')
.trim();
- detail = $(this)
+ const detail = loadedCheerio(this)
.find('.summary-content')
.text()
.replace(/[\t\n]/g, '')
@@ -88,9 +88,11 @@ const parseNovelAndChapters = async novelUrl => {
}
});
- $('.description-summary > div.summary__content').find('em').remove();
+ loadedCheerio('.description-summary > div.summary__content')
+ .find('em')
+ .remove();
- novel.summary = $('.description-summary > div.summary__content')
+ novel.summary = loadedCheerio('.description-summary > div.summary__content')
.text()
.replace(/[\t\n]|Description|Summary/g, '');
@@ -99,22 +101,25 @@ const parseNovelAndChapters = async novelUrl => {
const data = await fetch(`${url}ajax/chapters/`, {method: 'POST'});
const text = await data.text();
- $ = cheerio.load(text);
+ loadedCheerio = cheerio.load(text);
- $('.wp-manga-chapter').each(function () {
- const chapterName = $(this)
+ loadedCheerio('.wp-manga-chapter').each(function () {
+ const chapterName = loadedCheerio(this)
.find('a')
.text()
.replace(/[\t\n]/g, '')
.trim();
- const releaseDate = $(this)
+ const releaseDate = loadedCheerio(this)
.find('span')
.text()
.replace(/[\t\n]/g, '')
.trim();
- const chapterUrl = $(this).find('a').attr('href').replace(url, '');
+ const chapterUrl = loadedCheerio(this)
+ .find('a')
+ .attr('href')
+ .replace(url, '');
const chapter = {chapterName, releaseDate, chapterUrl};
@@ -132,10 +137,10 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
- const chapterName = $('div.text-left > h3').text();
- let chapterText = $('.reading-content').html();
+ const chapterName = loadedCheerio('div.text-left > h3').text();
+ let chapterText = loadedCheerio('.reading-content').html();
const chapter = {
sourceId,
novelUrl,
@@ -153,15 +158,15 @@ const searchNovels = async searchTerm => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.c-tabs-item__content').each(function (result) {
- const novelName = $(this).find('h4 > a').text();
- const novelCover = $(this).find('img').attr('src');
+ loadedCheerio('.c-tabs-item__content').each(function () {
+ const novelName = loadedCheerio(this).find('h4 > a').text();
+ const novelCover = loadedCheerio(this).find('img').attr('src');
- let novelUrl = $(this).find('h4 > a').attr('href');
+ let novelUrl = loadedCheerio(this).find('h4 > a').attr('href');
novelUrl = novelUrl.replace(`${baseUrl}/`, '');
const novel = {
diff --git a/src/sources/en/comrademao.js b/src/sources/en/comrademao.js
index c530614a..c190e527 100644
--- a/src/sources/en/comrademao.js
+++ b/src/sources/en/comrademao.js
@@ -13,19 +13,19 @@ const popularNovels = async page => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('div.container')
+ loadedCheerio('div.container')
.find('section')
.each(function () {
- const novelName = $(this)
+ const novelName = loadedCheerio(this)
.find('div.columns > div:nth-child(2) > a')
.text();
- const novelCover = $(this).find('img').attr('src');
+ const novelCover = loadedCheerio(this).find('img').attr('src');
- let novelUrl = $(this)
+ let novelUrl = loadedCheerio(this)
.find('div.columns > div:nth-child(2) > a')
.attr('href');
novelUrl = novelUrl.replace(baseUrl + 'novel/', '');
@@ -45,35 +45,37 @@ const popularNovels = async page => {
const parseNovelAndChapters = async novelUrl => {
const url = baseUrl + 'novel/' + novelUrl;
- console.log(url);
+ // console.log(url);
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novel = {sourceId, sourceName, url, novelUrl};
- novel.novelName = $(
+ novel.novelName = loadedCheerio(
'#NovelInfo > div > div.column.is-one-third.has-text-centered > p',
)
.text()
.trim();
- novel.novelCover = $('img.attachment-post-thumbnail').attr('src');
+ novel.novelCover = loadedCheerio('img.attachment-post-thumbnail').attr('src');
- novel.summary = $('#NovelInfo > div > div:nth-child(2) > p').text().trim();
+ novel.summary = loadedCheerio('#NovelInfo > div > div:nth-child(2) > p')
+ .text()
+ .trim();
- novel.genre = $('#NovelInfo > p:nth-child(2)')
+ novel.genre = loadedCheerio('#NovelInfo > p:nth-child(2)')
.text()
.replace(/Genre(s):|\s/g, '');
- novel.status = $('#NovelInfo > p:nth-child(5)')
+ novel.status = loadedCheerio('#NovelInfo > p:nth-child(5)')
.text()
.replace(/Status:|\s/g, '')
.trim();
- novel.author = $('#NovelInfo > p:nth-child(4)')
+ novel.author = loadedCheerio('#NovelInfo > p:nth-child(4)')
.text()
.replace(/Publisher:|\s/g, '')
.trim();
@@ -97,7 +99,7 @@ const parseNovelAndChapters = async novelUrl => {
// $("small").remove();
- let chapterUrlPrefix = $('table > tbody')
+ let chapterUrlPrefix = loadedCheerio('table > tbody')
.find('tr')
.first()
.find('a')
@@ -111,7 +113,7 @@ const parseNovelAndChapters = async novelUrl => {
chapterUrlPrefix = chapterUrlPrefix.join('-').toLowerCase();
- let latestChapter = $('table > tbody')
+ let latestChapter = loadedCheerio('table > tbody')
.find('tr')
.first()
.find('a')
@@ -140,16 +142,16 @@ const parseNovelAndChapters = async novelUrl => {
const parseChapter = async (novelUrl, chapterUrl) => {
const url = `${baseUrl}mtl/${novelUrl}/${chapterUrl}`;
- console.log(url);
+ // console.log(url);
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let chapterName = '';
- let chapterText = $('#content').html();
+ let chapterText = loadedCheerio('#content').html();
const chapter = {
sourceId,
@@ -168,17 +170,17 @@ const searchNovels = async searchTerm => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.newbox')
+ loadedCheerio('.newbox')
.find('li')
.each(function () {
- const novelName = $(this).find('h3').text();
- const novelCover = $(this).find('img').attr('src');
+ const novelName = loadedCheerio(this).find('h3').text();
+ const novelCover = loadedCheerio(this).find('img').attr('src');
- let novelUrl = $(this).find('a').attr('href');
+ let novelUrl = loadedCheerio(this).find('a').attr('href');
novelUrl = novelUrl.replace(baseUrl + 'novel/', '');
const novel = {
diff --git a/src/sources/en/divinedaolibrary.js b/src/sources/en/divinedaolibrary.js
index 2485dffa..51715207 100644
--- a/src/sources/en/divinedaolibrary.js
+++ b/src/sources/en/divinedaolibrary.js
@@ -13,16 +13,16 @@ const popularNovels = async page => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('#main')
+ loadedCheerio('#main')
.find('li')
.each(function () {
- const novelName = $(this).find('a').text();
+ const novelName = loadedCheerio(this).find('a').text();
const novelCover = null;
- const novelUrl = $(this).find(' a').attr('href');
+ const novelUrl = loadedCheerio(this).find(' a').attr('href');
const novel = {
sourceId,
@@ -43,35 +43,37 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novel = {sourceId, sourceName, url, novelUrl};
- novel.novelName = $('h1.entry-title').text().trim();
+ novel.novelName = loadedCheerio('h1.entry-title').text().trim();
novel.novelCover =
- $('.entry-content').find('img').attr('src') ||
+ loadedCheerio('.entry-content').find('img').attr('src') ||
'https://github.com/LNReader/lnreader-sources/blob/main/src/coverNotAvailable.jpg?raw=true';
- novel.summary = $('#main > article > div > p:nth-child(6)').text().trim();
+ novel.summary = loadedCheerio('#main > article > div > p:nth-child(6)')
+ .text()
+ .trim();
novel.genre = null;
novel.status = null;
- novel.author = $('#main > article > div > h3:nth-child(2)')
+ novel.author = loadedCheerio('#main > article > div > h3:nth-child(2)')
.text()
.replace(/Author:/g, '')
.trim();
let novelChapters = [];
- $('#main')
+ loadedCheerio('#main')
.find('li > span > a')
.each(function () {
- const chapterName = $(this).text().trim();
+ const chapterName = loadedCheerio(this).text().trim();
const releaseDate = null;
- const chapterUrl = $(this).attr('href');
+ const chapterUrl = loadedCheerio(this).attr('href');
novelChapters.push({chapterName, releaseDate, chapterUrl});
});
@@ -87,14 +89,14 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
- let chapterName = $('.entry-title').text().trim();
+ let chapterName = loadedCheerio('.entry-title').text().trim();
- let chapterText = $('.entry-content').html();
+ let chapterText = loadedCheerio('.entry-content').html();
if (!chapterText) {
- chapterText = $('.page-header').html();
+ chapterText = loadedCheerio('.page-header').html();
}
const chapter = {
@@ -114,16 +116,16 @@ const searchNovels = async searchTerm => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('#main')
+ loadedCheerio('#main')
.find('li')
.each(function () {
- const novelName = $(this).find('a').text();
+ const novelName = loadedCheerio(this).find('a').text();
const novelCover = null;
- const novelUrl = $(this).find(' a').attr('href');
+ const novelUrl = loadedCheerio(this).find(' a').attr('href');
const novel = {
sourceId,
diff --git a/src/sources/en/fastnovel.js b/src/sources/en/fastnovel.js
index 1426f7dc..f020e8fa 100644
--- a/src/sources/en/fastnovel.js
+++ b/src/sources/en/fastnovel.js
@@ -1,7 +1,7 @@
import cheerio from 'react-native-cheerio';
const baseUrl = 'https://fastnovel.net';
-const searchUrl = `https://fastnovel.net/search/`;
+const searchUrl = 'https://fastnovel.net/search/';
const popularNovels = async page => {
let totalPages = 39;
@@ -10,14 +10,14 @@ const popularNovels = async page => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.film-item').each(function (result) {
- const novelName = $(this).find('.name').text();
- const novelCover = $(this).find('.img').attr('data-original');
- const novelUrl = $(this).find('a').attr('href').substring(1);
+ loadedCheerio('.film-item').each(function () {
+ const novelName = loadedCheerio(this).find('.name').text();
+ const novelCover = loadedCheerio(this).find('.img').attr('data-original');
+ const novelUrl = loadedCheerio(this).find('a').attr('href').substring(1);
const novel = {
sourceId: 3,
@@ -38,7 +38,7 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novel = {};
@@ -50,22 +50,22 @@ const parseNovelAndChapters = async novelUrl => {
novel.novelUrl = novelUrl;
- novel.novelName = $('h1').text();
+ novel.novelName = loadedCheerio('h1').text();
- novel.novelCover = $('.book-cover').attr('data-original');
+ novel.novelCover = loadedCheerio('.book-cover').attr('data-original');
- novel.summary = $('div.film-content > p').text();
+ novel.summary = loadedCheerio('div.film-content > p').text();
- novel.author = $('li > label')
+ novel.author = loadedCheerio('li > label')
.filter(function () {
- return $(this).text().trim() === 'Author:';
+ return loadedCheerio(this).text().trim() === 'Author:';
})
.next()
.text();
- novel.genre = $('li')
+ novel.genre = loadedCheerio('li')
.filter(function () {
- return $(this).find('label').text().trim() === 'Genre:';
+ return loadedCheerio(this).find('label').text().trim() === 'Genre:';
})
.text()
.replace('Genre:', '');
@@ -74,9 +74,9 @@ const parseNovelAndChapters = async novelUrl => {
novel.status = null;
- novel.status = $('li')
+ novel.status = loadedCheerio('li')
.filter(function () {
- return $(this).find('label').text().trim() === 'Status:';
+ return loadedCheerio(this).find('label').text().trim() === 'Status:';
})
.text()
.includes('Completed')
@@ -85,19 +85,19 @@ const parseNovelAndChapters = async novelUrl => {
let novelChapters = [];
- $('.chapter').each(function (result) {
- const chapterName = $(this).text();
+ loadedCheerio('.chapter').each(function () {
+ const chapterName = loadedCheerio(this).text();
const releaseDate = null;
- let chapterUrl = $(this).attr('href');
+ let chapterUrl = loadedCheerio(this).attr('href');
chapterUrl = chapterUrl.replace(`/${novelUrl}/`, '');
- const novel = {
+ const chapter = {
chapterName,
releaseDate,
chapterUrl,
};
- novelChapters.push(novel);
+ novelChapters.push(chapter);
});
novel.chapters = novelChapters;
@@ -111,11 +111,11 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
- const chapterName = $('.episode-name').text();
+ const chapterName = loadedCheerio('.episode-name').text();
- let chapterText = $('#chapter-body').html();
+ let chapterText = loadedCheerio('#chapter-body').html();
const chapter = {
sourceId: 3,
novelUrl,
@@ -133,14 +133,14 @@ const searchNovels = async searchTerm => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.film-item').each(function (result) {
- const novelName = $(this).find('div.title > p.name').text();
- const novelCover = $(this).find('.img').attr('data-original');
- const novelUrl = $(this).find('a').attr('href').substring(1);
+ loadedCheerio('.film-item').each(function () {
+ const novelName = loadedCheerio(this).find('div.title > p.name').text();
+ const novelCover = loadedCheerio(this).find('.img').attr('data-original');
+ const novelUrl = loadedCheerio(this).find('a').attr('href').substring(1);
const novel = {
sourceId: 3,
diff --git a/src/sources/en/foxaholic.js b/src/sources/en/foxaholic.js
index 666d55d5..5c89e6da 100644
--- a/src/sources/en/foxaholic.js
+++ b/src/sources/en/foxaholic.js
@@ -9,15 +9,18 @@ const popularNovels = async page => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.page-item-detail').each(function (result) {
- const novelName = $(this).find('.h5 > a').text();
- const novelCover = $(this).find('img').attr('data-src');
+ loadedCheerio('.page-item-detail').each(function () {
+ const novelName = loadedCheerio(this).find('.h5 > a').text();
+ const novelCover = loadedCheerio(this).find('img').attr('data-src');
- let novelUrl = $(this).find('.h5 > a').attr('href').split('/')[4];
+ let novelUrl = loadedCheerio(this)
+ .find('.h5 > a')
+ .attr('href')
+ .split('/')[4];
novelUrl += '/';
const novel = {
@@ -39,7 +42,7 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novel = {};
@@ -51,20 +54,20 @@ const parseNovelAndChapters = async novelUrl => {
novel.novelUrl = novelUrl;
- novel.novelName = $('.post-title > h1')
+ novel.novelName = loadedCheerio('.post-title > h1')
.text()
.replace(/[\t\n]/g, '')
.trim();
- novel.novelCover = $('.summary_image > a > img').attr('data-src');
+ novel.novelCover = loadedCheerio('.summary_image > a > img').attr('data-src');
- $('.post-content_item').each(function (result) {
- detailName = $(this)
+ loadedCheerio('.post-content_item').each(function () {
+ const detailName = loadedCheerio(this)
.find('.summary-heading > h5')
.text()
.replace(/[\t\n]/g, '')
.trim();
- detail = $(this)
+ const detail = loadedCheerio(this)
.find('.summary-content')
.text()
.replace(/[\t\n]/g, '')
@@ -83,9 +86,11 @@ const parseNovelAndChapters = async novelUrl => {
}
});
- $('.description-summary > div.summary__content').find('em').remove();
+ loadedCheerio('.description-summary > div.summary__content')
+ .find('em')
+ .remove();
- novel.summary = $('.description-summary > div.summary__content')
+ novel.summary = loadedCheerio('.description-summary > div.summary__content')
.text()
.trim();
@@ -102,18 +107,18 @@ const parseNovelAndChapters = async novelUrl => {
});
const text = await data.text();
- $ = cheerio.load(text);
+ loadedCheerio = cheerio.load(text);
- $('.wp-manga-chapter').each(function (result) {
- chapterName = $(this)
+ loadedCheerio('.wp-manga-chapter').each(function () {
+ const chapterName = loadedCheerio(this)
.find('a')
.text()
.replace(/[\t\n]/g, '')
.trim();
- releaseDate = $(this).find('span').text().trim();
+ const releaseDate = loadedCheerio(this).find('span').text().trim();
- chapterUrl = $(this).find('a').attr('href').split('/');
+ let chapterUrl = loadedCheerio(this).find('a').attr('href').split('/');
chapterUrl[6]
? (chapterUrl = chapterUrl[5] + '/' + chapterUrl[6])
@@ -133,10 +138,10 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
- const chapterName = $('h1#chapter-heading').text();
- let chapterText = $('.reading-content').html();
+ const chapterName = loadedCheerio('h1#chapter-heading').text();
+ let chapterText = loadedCheerio('.reading-content').html();
const chapter = {
sourceId: 22,
novelUrl,
@@ -154,15 +159,18 @@ const searchNovels = async searchTerm => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.c-tabs-item__content').each(function (result) {
- const novelName = $(this).find('.h4 > a').text();
- const novelCover = $(this).find('img').attr('data-src');
+ loadedCheerio('.c-tabs-item__content').each(function () {
+ const novelName = loadedCheerio(this).find('.h4 > a').text();
+ const novelCover = loadedCheerio(this).find('img').attr('data-src');
- let novelUrl = $(this).find('.h4 > a').attr('href').split('/')[4];
+ let novelUrl = loadedCheerio(this)
+ .find('.h4 > a')
+ .attr('href')
+ .split('/')[4];
novelUrl += '/';
const novel = {
sourceId: 22,
diff --git a/src/sources/en/freewebnovel.js b/src/sources/en/freewebnovel.js
index 23adacff..6420f04f 100644
--- a/src/sources/en/freewebnovel.js
+++ b/src/sources/en/freewebnovel.js
@@ -9,15 +9,15 @@ const popularNovels = async page => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.li-row').each(function (result) {
- const novelName = $(this).find('.tit').text();
- const novelCover = $(this).find('img').attr('src');
+ loadedCheerio('.li-row').each(function () {
+ const novelName = loadedCheerio(this).find('.tit').text();
+ const novelCover = loadedCheerio(this).find('img').attr('src');
- let novelUrl = $(this)
+ let novelUrl = loadedCheerio(this)
.find('h3 > a')
.attr('href')
.replace('.html', '')
@@ -42,7 +42,7 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novel = {};
@@ -54,43 +54,47 @@ const parseNovelAndChapters = async novelUrl => {
novel.novelUrl = novelUrl;
- novel.novelName = $('h1.tit').text();
+ novel.novelName = loadedCheerio('h1.tit').text();
- novel.novelCover = $('.pic > img').attr('src');
+ novel.novelCover = loadedCheerio('.pic > img').attr('src');
- novel.genre = $('[title=Genre]')
+ novel.genre = loadedCheerio('[title=Genre]')
.next()
.text()
.replace(/[\t\n]/g, '');
- novel.author = $('[title=Author]')
+ novel.author = loadedCheerio('[title=Author]')
.next()
.text()
.replace(/[\t\n]/g, '');
novel.artist = null;
- novel.status = $('[title=Status]')
+ novel.status = loadedCheerio('[title=Status]')
.next()
.text()
.replace(/[\t\n]/g, '');
- let novelSummary = $('.inner').text().trim();
+ let novelSummary = loadedCheerio('.inner').text().trim();
novel.summary = novelSummary;
let novelChapters = [];
let latestChapter;
- $('h3.tit').each(function (res) {
- if ($(this).find('a').text() === novel.novelName) {
- latestChapter = $(this).next().find('span.s3').text().match(/\d+/);
+ loadedCheerio('h3.tit').each(function (res) {
+ if (loadedCheerio(this).find('a').text() === novel.novelName) {
+ latestChapter = loadedCheerio(this)
+ .next()
+ .find('span.s3')
+ .text()
+ .match(/\d+/);
}
});
latestChapter = latestChapter[0];
- for (let i = 1; i <= parseInt(latestChapter); i++) {
+ for (let i = 1; i <= parseInt(latestChapter, 10); i++) {
const chapterName = 'Chapter ' + i;
const releaseDate = null;
@@ -115,11 +119,11 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
- let chapterName = $('h1.tit').text();
+ let chapterName = loadedCheerio('h1.tit').text();
- let chapterText = $('div.txt').html();
+ let chapterText = loadedCheerio('div.txt').html();
const chapter = {
sourceId: 13,
@@ -144,15 +148,17 @@ const searchNovels = async searchTerm => {
});
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.li-row > .li > .con').each(function (result) {
- const novelName = $(this).find('.tit').text();
- const novelCover = $(this).find('.pic > a > img').attr('data-cfsrc');
+ loadedCheerio('.li-row > .li > .con').each(function () {
+ const novelName = loadedCheerio(this).find('.tit').text();
+ const novelCover = loadedCheerio(this)
+ .find('.pic > a > img')
+ .attr('data-cfsrc');
- let novelUrl = $(this)
+ let novelUrl = loadedCheerio(this)
.find('h3 > a')
.attr('href')
.replace('.html', '')
diff --git a/src/sources/en/jpmtl.js b/src/sources/en/jpmtl.js
index 33aa033a..b3fda25a 100644
--- a/src/sources/en/jpmtl.js
+++ b/src/sources/en/jpmtl.js
@@ -33,7 +33,7 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novel = {};
@@ -45,17 +45,17 @@ const parseNovelAndChapters = async novelUrl => {
novel.novelUrl = novelUrl;
- novel.novelName = $('h1.book-sidebar__title').text();
+ novel.novelName = loadedCheerio('h1.book-sidebar__title').text();
- novel.novelCover = $('.book-sidebar').find('img').attr('src');
+ novel.novelCover = loadedCheerio('.book-sidebar').find('img').attr('src');
- $('.post-content_item').each(function (result) {
- detailName = $(this)
+ loadedCheerio('.post-content_item').each(function () {
+ const detailName = loadedCheerio(this)
.find('.summary-heading > h5')
.text()
.replace(/[\t\n]/g, '')
.trim();
- detail = $(this)
+ const detail = loadedCheerio(this)
.find('.summary-content')
.text()
.replace(/[\t\n]/g, '')
@@ -64,19 +64,19 @@ const parseNovelAndChapters = async novelUrl => {
novel[detailName] = detail;
});
- novel.summary = $('.main-book__synopsis').text();
+ novel.summary = loadedCheerio('.main-book__synopsis').text();
novel.genre = '';
- $('a.main-book__category').each(function (result) {
- novel.genre += $(this).text();
+ loadedCheerio('a.main-book__category').each(function () {
+ novel.genre += loadedCheerio(this).text();
});
function capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
- const info = $('.book-sidebar__author > .book-sidebar__info')
+ const info = loadedCheerio('.book-sidebar__author > .book-sidebar__info')
.text()
.trim()
.split('・');
@@ -122,10 +122,10 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
- const chapterName = $('.chapter-content__title').text();
- let chapterText = $('.chapter-content__content').html();
+ const chapterName = loadedCheerio('.chapter-content__title').text();
+ let chapterText = loadedCheerio('.chapter-content__content').html();
novelUrl += '/';
const chapter = {
diff --git a/src/sources/en/kisslightnovels.js b/src/sources/en/kisslightnovels.js
index f6e7572c..07c7670c 100644
--- a/src/sources/en/kisslightnovels.js
+++ b/src/sources/en/kisslightnovels.js
@@ -9,15 +9,15 @@ const popularNovels = async page => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.page-item-detail').each(function (result) {
- const novelName = $(this).find('h5 > a').text();
- const novelCover = $(this).find('img').attr('src');
+ loadedCheerio('.page-item-detail').each(function () {
+ const novelName = loadedCheerio(this).find('h5 > a').text();
+ const novelCover = loadedCheerio(this).find('img').attr('src');
- let novelUrl = $(this).find('h5 > a').attr('href');
+ let novelUrl = loadedCheerio(this).find('h5 > a').attr('href');
novelUrl = novelUrl.replace(`${baseUrl}novel/`, '');
const novel = {
@@ -39,7 +39,7 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novel = {};
@@ -51,20 +51,20 @@ const parseNovelAndChapters = async novelUrl => {
novel.novelUrl = novelUrl;
- novel.novelName = $('.post-title > h1')
+ novel.novelName = loadedCheerio('.post-title > h1')
.text()
.replace(/[\t\n]/g, '')
.trim();
- novel.novelCover = $('.summary_image > a > img').attr('src');
+ novel.novelCover = loadedCheerio('.summary_image > a > img').attr('src');
- $('.post-content_item').each(function (result) {
- detailName = $(this)
+ loadedCheerio('.post-content_item').each(function () {
+ const detailName = loadedCheerio(this)
.find('.summary-heading > h5')
.text()
.replace(/[\t\n]/g, '')
.trim();
- detail = $(this)
+ const detail = loadedCheerio(this)
.find('.summary-content')
.text()
.replace(/[\t\n]/g, '')
@@ -83,28 +83,33 @@ const parseNovelAndChapters = async novelUrl => {
}
});
- $('.description-summary > div.summary__content').find('em').remove();
+ loadedCheerio('.description-summary > div.summary__content')
+ .find('em')
+ .remove();
- novel.summary = $('.description-summary > div.summary__content')
+ novel.summary = loadedCheerio('.description-summary > div.summary__content')
.text()
.replace(/[\t\n]/g, '');
let novelChapters = [];
- $('.wp-manga-chapter').each(function (result) {
- chapterName = $(this)
+ loadedCheerio('.wp-manga-chapter').each(function () {
+ const chapterName = loadedCheerio(this)
.find('a')
.text()
.replace(/[\t\n]/g, '')
.trim();
- releaseDate = $(this)
+ const releaseDate = loadedCheerio(this)
.find('span')
.text()
.replace(/[\t\n]/g, '')
.trim();
- chapterUrl = $(this).find('a').attr('href').replace(url, '');
+ const chapterUrl = loadedCheerio(this)
+ .find('a')
+ .attr('href')
+ .replace(url, '');
novelChapters.push({chapterName, releaseDate, chapterUrl});
});
@@ -120,13 +125,13 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
- $('#snippet-box').remove();
+ loadedCheerio('#snippet-box').remove();
- const chapterName = $('div.text-left > h4').text();
+ const chapterName = loadedCheerio('div.text-left > h4').text();
- let chapterText = $('.reading-content').html();
+ let chapterText = loadedCheerio('.reading-content').html();
const chapter = {
sourceId: 11,
novelUrl,
@@ -144,15 +149,15 @@ const searchNovels = async searchTerm => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.c-tabs-item__content').each(function (result) {
- const novelName = $(this).find('h4 > a').text();
- const novelCover = $(this).find('img').attr('src');
+ loadedCheerio('.c-tabs-item__content').each(function () {
+ const novelName = loadedCheerio(this).find('h4 > a').text();
+ const novelCover = loadedCheerio(this).find('img').attr('src');
- let novelUrl = $(this).find('h4 > a').attr('href');
+ let novelUrl = loadedCheerio(this).find('h4 > a').attr('href');
novelUrl = novelUrl.replace(`${baseUrl}novel/`, '');
const novel = {
diff --git a/src/sources/en/lightnovelpub.js b/src/sources/en/lightnovelpub.js
index eda6edd5..da71e80b 100644
--- a/src/sources/en/lightnovelpub.js
+++ b/src/sources/en/lightnovelpub.js
@@ -19,24 +19,24 @@ const popularNovels = async page => {
});
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.novel-item.ads').remove();
+ loadedCheerio('.novel-item.ads').remove();
- $('.novel-item').each(function () {
- const novelName = $(this)
+ loadedCheerio('.novel-item').each(function () {
+ const novelName = loadedCheerio(this)
.find('.novel-title')
.text()
.replace(/[\t\n]/g, '');
- const novelCover = $(this).find('img').attr('data-src');
+ const novelCover = loadedCheerio(this).find('img').attr('data-src');
- let novelUrl = $(this)
+ let novelUrl = loadedCheerio(this)
.find('.novel-title > a')
.attr('href')
- .replace(`/novel/`, '');
+ .replace('/novel/', '');
novelUrl += '/';
const novel = {
@@ -68,7 +68,7 @@ const parseNovelAndChapters = async novelUrl => {
});
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novel = {};
@@ -80,39 +80,42 @@ const parseNovelAndChapters = async novelUrl => {
novel.novelUrl = novelUrl;
- novel.novelName = $('h1.novel-title')
+ novel.novelName = loadedCheerio('h1.novel-title')
.text()
.replace(/[\t\n]/g, '')
.trim();
- novel.novelCover = $('figure.cover > img').attr('data-src');
+ novel.novelCover = loadedCheerio('figure.cover > img').attr('data-src');
novel.genre = '';
- $('div.categories > ul > li').each(function () {
+ loadedCheerio('div.categories > ul > li').each(function () {
novel.genre +=
- $(this)
+ loadedCheerio(this)
.text()
.replace(/[\t\n]/g, '') + ',';
});
- $('div.header-stats > span').each(function () {
- if ($(this).find('small').text() === 'Status') {
- novel.status = $(this).find('strong').text();
+ loadedCheerio('div.header-stats > span').each(function () {
+ if (loadedCheerio(this).find('small').text() === 'Status') {
+ novel.status = loadedCheerio(this).find('strong').text();
}
});
novel.genre = novel.genre.slice(0, -1);
- novel.author = $('.author > a > span').text();
+ novel.author = loadedCheerio('.author > a > span').text();
- novel.summary = $('.summary > .content').text().trim();
+ novel.summary = loadedCheerio('.summary > .content').text().trim();
let novelChapters = [];
let totalChapters;
- totalChapters = $('.header-stats > span').first().text().match(/\d+/)[0];
+ totalChapters = loadedCheerio('.header-stats > span')
+ .first()
+ .text()
+ .match(/\d+/)[0];
for (let i = 1; i <= totalChapters; i++) {
const chapterName = 'Chapter ' + i;
@@ -146,10 +149,10 @@ const parseChapter = async (novelUrl, chapterUrl) => {
headers: headers,
});
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
- const chapterName = $('h2').text();
- let chapterText = $('#chapter-container').html();
+ const chapterName = loadedCheerio('h2').text();
+ let chapterText = loadedCheerio('#chapter-container').html();
const chapter = {
sourceId: 15,
novelUrl,
@@ -177,19 +180,22 @@ const searchNovels = async searchTerm => {
});
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novels = [];
- let results = JSON.parse($('body').text());
+ let results = JSON.parse(loadedCheerio('body').text());
- $ = cheerio.load(results.resultview);
+ loadedCheerio = cheerio.load(results.resultview);
- $('.novel-item').each(function () {
- const novelName = $(this).find('h4.novel-title').text();
- const novelCover = $(this).find('img').attr('src');
+ loadedCheerio('.novel-item').each(function () {
+ const novelName = loadedCheerio(this).find('h4.novel-title').text();
+ const novelCover = loadedCheerio(this).find('img').attr('src');
- let novelUrl = $(this).find('a').attr('href').replace(`/novel/`, '');
+ let novelUrl = loadedCheerio(this)
+ .find('a')
+ .attr('href')
+ .replace('/novel/', '');
novelUrl += '/';
const novel = {
diff --git a/src/sources/en/lightnovelupdates.js b/src/sources/en/lightnovelupdates.js
index b4531b9e..59160b7b 100644
--- a/src/sources/en/lightnovelupdates.js
+++ b/src/sources/en/lightnovelupdates.js
@@ -12,14 +12,14 @@ const popularNovels = async page => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.page-item-detail').each(function () {
- const novelName = $(this).find('.h5 > a').text();
- const novelCover = $(this).find('img').attr('src');
- const novelUrl = $(this).find('.h5 > a').attr('href');
+ loadedCheerio('.page-item-detail').each(function () {
+ const novelName = loadedCheerio(this).find('.h5 > a').text();
+ const novelCover = loadedCheerio(this).find('img').attr('src');
+ const novelUrl = loadedCheerio(this).find('.h5 > a').attr('href');
const novel = {
sourceId,
@@ -37,23 +37,26 @@ const popularNovels = async page => {
const parseNovelAndChapters = async novelUrl => {
const url = novelUrl;
- console.log(url);
+ // console.log(url);
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novel = {sourceId, sourceName, novelUrl, url};
- novel.novelName = $('.post-title > h1').text().trim();
+ novel.novelName = loadedCheerio('.post-title > h1').text().trim();
novel.novelCover =
- $('.summary_image > a > img').attr('src') ||
+ loadedCheerio('.summary_image > a > img').attr('src') ||
'https://github.com/LNReader/lnreader-sources/blob/main/src/coverNotAvailable.jpg?raw=true';
- $('.post-content_item').each(function (result) {
- detailName = $(this).find('.summary-heading > h5').text().trim();
- detail = $(this).find('.summary-content').text().trim();
+ loadedCheerio('.post-content_item').each(function () {
+ const detailName = loadedCheerio(this)
+ .find('.summary-heading > h5')
+ .text()
+ .trim();
+ const detail = loadedCheerio(this).find('.summary-content').text().trim();
switch (detailName) {
case 'Genre(s)':
@@ -68,11 +71,11 @@ const parseNovelAndChapters = async novelUrl => {
}
});
- novel.summary = $('div.summary__content').text();
+ novel.summary = loadedCheerio('div.summary__content').text();
let novelChapters = [];
- const novelId = $('.rating-post-id').attr('value');
+ const novelId = loadedCheerio('.rating-post-id').attr('value');
let formData = new FormData();
formData.append('action', 'manga_get_chapters');
@@ -87,12 +90,12 @@ const parseNovelAndChapters = async novelUrl => {
);
const text = await data.text();
- $ = cheerio.load(text);
+ loadedCheerio = cheerio.load(text);
- $('.wp-manga-chapter').each(function () {
- const chapterName = $(this).find('a').text().trim();
- const releaseDate = $(this).find('span').text().trim();
- const chapterUrl = $(this).find('a').attr('href');
+ loadedCheerio('.wp-manga-chapter').each(function () {
+ const chapterName = loadedCheerio(this).find('a').text().trim();
+ const releaseDate = loadedCheerio(this).find('span').text().trim();
+ const chapterUrl = loadedCheerio(this).find('a').attr('href');
const chapter = {chapterName, releaseDate, chapterUrl};
@@ -127,14 +130,14 @@ const searchNovels = async searchTerm => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.c-tabs-item__content').each(function (result) {
- const novelName = $(this).find('.h4 > a').text();
- const novelCover = $(this).find('img').attr('src');
- const novelUrl = $(this).find('.h4 > a').attr('href');
+ loadedCheerio('.c-tabs-item__content').each(function () {
+ const novelName = loadedCheerio(this).find('.h4 > a').text();
+ const novelCover = loadedCheerio(this).find('img').attr('src');
+ const novelUrl = loadedCheerio(this).find('.h4 > a').attr('href');
const novel = {
sourceId,
diff --git a/src/sources/en/lnmtl.js b/src/sources/en/lnmtl.js
index 205fed9c..9884e357 100644
--- a/src/sources/en/lnmtl.js
+++ b/src/sources/en/lnmtl.js
@@ -11,15 +11,15 @@ const popularNovels = async page => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.media').each(function (result) {
- const novelName = $(this).find('h4').text();
- const novelCover = $(this).find('img').attr('src');
+ loadedCheerio('.media').each(function () {
+ const novelName = loadedCheerio(this).find('h4').text();
+ const novelCover = loadedCheerio(this).find('img').attr('src');
- let novelUrl = $(this).find('h4 > a').attr('href');
+ let novelUrl = loadedCheerio(this).find('h4 > a').attr('href');
novelUrl = novelUrl.replace(baseUrl + 'novel/', '');
const novel = {
@@ -43,7 +43,7 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novel = {};
@@ -55,23 +55,23 @@ const parseNovelAndChapters = async novelUrl => {
novel.novelUrl = novelUrl;
- novel.novelName = $('.novel-name').text();
+ novel.novelName = loadedCheerio('.novel-name').text();
- novel.novelCover = $('div.novel').find('img').attr('src');
+ novel.novelCover = loadedCheerio('div.novel').find('img').attr('src');
- novel.summary = $('div.description').text().trim();
+ novel.summary = loadedCheerio('div.description').text().trim();
- novel.author = $(
+ novel.author = loadedCheerio(
'main > div:nth-child(3) > div > div.col-lg-3.col-md-4 > div:nth-child(2) > div.panel-body > dl:nth-child(1) > dd > span',
).text();
- novel.status = $(
+ novel.status = loadedCheerio(
'main > div:nth-child(3) > div > div.col-lg-3.col-md-4 > div:nth-child(2) > div.panel-body > dl:nth-child(2) > dd',
)
.text()
.trim();
- novel.genre = $(
+ novel.genre = loadedCheerio(
'main > div.container > div > div.col-lg-3.col-md-4 > div:nth-child(4) > div.panel-body > ul',
)
.text()
@@ -79,7 +79,7 @@ const parseNovelAndChapters = async novelUrl => {
.replace(/\s\s/g, ',');
let volumes = JSON.parse(
- $('main')
+ loadedCheerio('main')
.next()
.html()
.match(/lnmtl.volumes = \[(.*?)\]/)[0]
@@ -125,16 +125,16 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
- let chapterName = $('h3 > span.chapter-title').text().trim();
+ let chapterName = loadedCheerio('h3 > span.chapter-title').text().trim();
- $('.original').remove();
+ loadedCheerio('.original').remove();
- let chapterText = $('.chapter-body').html();
+ let chapterText = loadedCheerio('.chapter-body').html();
if (!chapterText) {
- chapterText = $('.alert.alert-warning').text();
+ chapterText = loadedCheerio('.alert.alert-warning').text();
}
chapterText =
@@ -157,9 +157,9 @@ const searchNovels = async searchTerm => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
- let novels = $('footer')
+ let novels = loadedCheerio('footer')
.next()
.next()
.html()
diff --git a/src/sources/en/mtlnovel.js b/src/sources/en/mtlnovel.js
index 4e8d1e69..4e4f9509 100644
--- a/src/sources/en/mtlnovel.js
+++ b/src/sources/en/mtlnovel.js
@@ -6,7 +6,7 @@ const popularNovels = async page => {
let totalPages = 10;
const url = `${baseUrl}/alltime-rank/page/${page}`;
- console.log(url);
+ // console.log(url);
let headers = new Headers({
referer: 'https://www.mtlnovel.com/',
@@ -20,15 +20,15 @@ const popularNovels = async page => {
});
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('div.box.wide').each(function (result) {
- const novelName = $(this).find('a.list-title').text().slice(4);
- const novelCover = $(this).find('amp-img').attr('src');
+ loadedCheerio('div.box.wide').each(function () {
+ const novelName = loadedCheerio(this).find('a.list-title').text().slice(4);
+ const novelCover = loadedCheerio(this).find('amp-img').attr('src');
- let novelUrl = $(this).find('a.list-title').attr('href');
+ let novelUrl = loadedCheerio(this).find('a.list-title').attr('href');
novelUrl = novelUrl.replace('https://www.mtlnovel.com/', '');
const novel = {
@@ -59,7 +59,7 @@ const parseNovelAndChapters = async novelUrl => {
});
const body = await result.text();
- const $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novel = {};
@@ -71,31 +71,31 @@ const parseNovelAndChapters = async novelUrl => {
novel.novelUrl = novelUrl;
- novel.novelName = $('h1.entry-title').text();
+ novel.novelName = loadedCheerio('h1.entry-title').text();
- novel.novelCover = $('.nov-head > amp-img').attr('src');
+ novel.novelCover = loadedCheerio('.nov-head > amp-img').attr('src');
- novel.summary = $('div.desc > h2').next().text().trim();
+ novel.summary = loadedCheerio('div.desc > h2').next().text().trim();
- novel.author = $('tr > td')
+ novel.author = loadedCheerio('tr > td')
.filter(function () {
- return $(this).prev().text().trim() === 'Author';
+ return loadedCheerio(this).prev().text().trim() === 'Author';
})
.next()
.text()
.replace('Auhtor:', '');
- novel.status = $('tr > td')
+ novel.status = loadedCheerio('tr > td')
.filter(function () {
- return $(this).prev().text().trim() === 'Status';
+ return loadedCheerio(this).prev().text().trim() === 'Status';
})
.next()
.text()
.replace('Status:', '');
- novel.genre = $('td')
+ novel.genre = loadedCheerio('td')
.filter(function () {
- return $(this).prev().text().trim() === 'Genre';
+ return loadedCheerio(this).prev().text().trim() === 'Genre';
})
.next()
.text()
@@ -106,20 +106,20 @@ const parseNovelAndChapters = async novelUrl => {
const chapterListUrl = url + '/chapter-list/';
const getChapters = async () => {
- const result = await fetch(chapterListUrl);
- const body = await result.text();
+ const listResult = await fetch(chapterListUrl);
+ const listBody = await listResult.text();
- $ = cheerio.load(body);
+ loadedCheerio = cheerio.load(listBody);
let novelChapters = [];
- $('div.ch-list')
+ loadedCheerio('div.ch-list')
.find('a.ch-link')
- .each(function (result) {
- const chapterName = $(this).text().replace('~ ', '');
+ .each(function () {
+ const chapterName = loadedCheerio(this).text().replace('~ ', '');
const releaseDate = null;
- let chapterUrl = $(this).attr('href');
+ let chapterUrl = loadedCheerio(this).attr('href');
chapterUrl = chapterUrl.replace(
`https://www.mtlnovel.com/${novelUrl}`,
'',
@@ -141,15 +141,15 @@ const parseNovelAndChapters = async novelUrl => {
const parseChapter = async (novelUrl, chapterUrl) => {
const url = `${baseUrl}/${novelUrl}${chapterUrl}`;
- console.log(url);
+ // console.log(url);
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
- const chapterName = $('h1.main-title').text();
- let chapterText = $('div.par').html();
+ const chapterName = loadedCheerio('h1.main-title').text();
+ let chapterText = loadedCheerio('div.par').html();
const chapter = {
sourceId: 5,
novelUrl,
diff --git a/src/sources/en/novelfull.js b/src/sources/en/novelfull.js
index 76ce7595..80bf42b2 100644
--- a/src/sources/en/novelfull.js
+++ b/src/sources/en/novelfull.js
@@ -9,32 +9,34 @@ const popularNovels = async page => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('div.col-truyen-main > div.list-truyen > .row').each(function (result) {
- const novelName = $(this).find('h3.truyen-title > a').text();
+ loadedCheerio('div.col-truyen-main > div.list-truyen > .row').each(
+ function () {
+ const novelName = loadedCheerio(this).find('h3.truyen-title > a').text();
- let novelCover = $(this).find('img').attr('src');
- novelCover = baseUrl + novelCover;
+ let novelCover = loadedCheerio(this).find('img').attr('src');
+ novelCover = baseUrl + novelCover;
- let novelUrl = $(this)
- .find('h3.truyen-title > a')
- .attr('href')
- .replace('.html', '')
- .substring(1);
- novelUrl = `${novelUrl}/`;
+ let novelUrl = loadedCheerio(this)
+ .find('h3.truyen-title > a')
+ .attr('href')
+ .replace('.html', '')
+ .substring(1);
+ novelUrl = `${novelUrl}/`;
- const novel = {
- sourceId: 8,
- novelUrl,
- novelName,
- novelCover,
- };
+ const novel = {
+ sourceId: 8,
+ novelUrl,
+ novelName,
+ novelCover,
+ };
- novels.push(novel);
- });
+ novels.push(novel);
+ },
+ );
return {totalPages, novels};
};
@@ -45,7 +47,7 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novel = {};
@@ -57,51 +59,51 @@ const parseNovelAndChapters = async novelUrl => {
novel.novelUrl = novelUrl;
- novel.novelName = $('div.book > img').attr('alt');
+ novel.novelName = loadedCheerio('div.book > img').attr('alt');
- novel.novelCover = baseUrl + $('div.book > img').attr('src');
+ novel.novelCover = baseUrl + loadedCheerio('div.book > img').attr('src');
- novel.summary = $('div.desc-text').text().trim();
+ novel.summary = loadedCheerio('div.desc-text').text().trim();
- novel.author = $('div.info > div > h3')
+ novel.author = loadedCheerio('div.info > div > h3')
.filter(function () {
- return $(this).text().trim() === 'Author:';
+ return loadedCheerio(this).text().trim() === 'Author:';
})
.siblings()
.text();
- novel.genre = $('div.info > div')
+ novel.genre = loadedCheerio('div.info > div')
.filter(function () {
- return $(this).find('h3').text().trim() === 'Genre:';
+ return loadedCheerio(this).find('h3').text().trim() === 'Genre:';
})
.text()
.replace('Genre:', '');
novel.artist = null;
- novel.status = $('div.info > div > h3')
+ novel.status = loadedCheerio('div.info > div > h3')
.filter(function () {
- return $(this).text().trim() === 'Status:';
+ return loadedCheerio(this).text().trim() === 'Status:';
})
.next()
.text();
- const novelId = $('#rating').attr('data-novel-id');
+ const novelId = loadedCheerio('#rating').attr('data-novel-id');
- const getChapters = async novelId => {
- const chapterListUrl = baseUrl + '/ajax/chapter-option?novelId=' + novelId;
+ const getChapters = async id => {
+ const chapterListUrl = baseUrl + '/ajax/chapter-option?novelId=' + id;
const data = await fetch(chapterListUrl);
const chapters = await data.text();
- $ = cheerio.load(chapters);
+ loadedCheerio = cheerio.load(chapters);
let novelChapters = [];
- $('select > option').each(function (result) {
- let chapterName = $(this).text();
+ loadedCheerio('select > option').each(function () {
+ let chapterName = loadedCheerio(this).text();
let releaseDate = null;
- let chapterUrl = $(this).attr('value');
+ let chapterUrl = loadedCheerio(this).attr('value');
chapterUrl = chapterUrl.replace(`/${novelUrl}`, '');
novelChapters.push({
@@ -124,10 +126,10 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
- const chapterName = $('.chapter-title').attr('title');
- let chapterText = $('#chapter-content').html();
+ const chapterName = loadedCheerio('.chapter-title').attr('title');
+ let chapterText = loadedCheerio('#chapter-content').html();
const chapter = {
sourceId: 8,
novelUrl,
@@ -140,37 +142,39 @@ const parseChapter = async (novelUrl, chapterUrl) => {
};
const searchNovels = async searchTerm => {
- const searchUrl = `https://novelfull.com/search?keyword=`;
+ const searchUrl = 'https://novelfull.com/search?keyword=';
const url = `${searchUrl}${searchTerm}`;
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('div.col-truyen-main > div.list-truyen > .row').each(function (result) {
- let novelUrl = $(this)
- .find('h3.truyen-title > a')
- .attr('href')
- .replace('.html', '')
- .substring(1);
- novelUrl = `${novelUrl}/`;
+ loadedCheerio('div.col-truyen-main > div.list-truyen > .row').each(
+ function () {
+ let novelUrl = loadedCheerio(this)
+ .find('h3.truyen-title > a')
+ .attr('href')
+ .replace('.html', '')
+ .substring(1);
+ novelUrl = `${novelUrl}/`;
- const novelName = $(this).find('h3.truyen-title > a').text();
- const novelCover = baseUrl + $(this).find('img').attr('src');
+ const novelName = loadedCheerio(this).find('h3.truyen-title > a').text();
+ const novelCover = baseUrl + loadedCheerio(this).find('img').attr('src');
- const novel = {
- sourceId: 8,
- novelUrl,
- novelName,
- novelCover,
- };
+ const novel = {
+ sourceId: 8,
+ novelUrl,
+ novelName,
+ novelCover,
+ };
- novels.push(novel);
- });
+ novels.push(novel);
+ },
+ );
return novels;
};
diff --git a/src/sources/en/novelhall.js b/src/sources/en/novelhall.js
index f79b464e..10eb9063 100644
--- a/src/sources/en/novelhall.js
+++ b/src/sources/en/novelhall.js
@@ -7,16 +7,16 @@ const popularNovels = async page => {
const result = await fetch(baseUrl);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('div.section1')
+ loadedCheerio('div.section1')
.find('li')
- .each(function (result) {
- const novelName = $(this).find('.book-info > h2 > a').text();
- const novelCover = $(this).find('img').attr('src');
- const novelUrl = $(this).find('a').attr('href').substring(1);
+ .each(function () {
+ const novelName = loadedCheerio(this).find('.book-info > h2 > a').text();
+ const novelCover = loadedCheerio(this).find('img').attr('src');
+ const novelUrl = loadedCheerio(this).find('a').attr('href').substring(1);
const novel = {
sourceId: 6,
@@ -37,7 +37,7 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novel = {};
@@ -49,32 +49,39 @@ const parseNovelAndChapters = async novelUrl => {
novel.novelUrl = novelUrl;
- novel.novelName = $('h1').text();
+ novel.novelName = loadedCheerio('h1').text();
- novel.novelCover = $('div.book-img > img').attr('src');
+ novel.novelCover = loadedCheerio('div.book-img > img').attr('src');
- novel.summary = $('div.intro')
+ novel.summary = loadedCheerio('div.intro')
.text()
.replace(/[\t\n]/g, '');
- novel.author = $('span.blue').first().text().replace('Author:', '');
+ novel.author = loadedCheerio('span.blue')
+ .first()
+ .text()
+ .replace('Author:', '');
- novel.genre = $('a.red').text();
+ novel.genre = loadedCheerio('a.red').text();
novel.artist = null;
- novel.status = $('span.blue').first().next().text().replace('Status:', '');
+ novel.status = loadedCheerio('span.blue')
+ .first()
+ .next()
+ .text()
+ .replace('Status:', '');
let novelChapters = [];
- $('div.book-catalog.hidden-xs#morelist')
+ loadedCheerio('div.book-catalog.hidden-xs#morelist')
.find('li.post-11')
- .each(function (result) {
- let chapterName = $(this).find('a').text();
+ .each(function () {
+ let chapterName = loadedCheerio(this).find('a').text();
let releaseDate = null;
- let chapterUrl = $(this).find('a').attr('href');
+ let chapterUrl = loadedCheerio(this).find('a').attr('href');
if (chapterUrl) {
chapterUrl = chapterUrl.replace(`/${novelUrl}/`, '');
@@ -100,11 +107,11 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
- const chapterName = $('h1').text();
- let chapterText = $('div.entry-content').html();
- chapter = {
+ const chapterName = loadedCheerio('h1').text();
+ const chapterText = loadedCheerio('div.entry-content').html();
+ const chapter = {
sourceId: 6,
novelUrl,
chapterUrl,
@@ -123,22 +130,22 @@ const searchNovels = async searchTerm => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('tr').each(function (result) {
- let novelName = $(this).find('td:nth-child(2)').text();
+ loadedCheerio('tr').each(function () {
+ let novelName = loadedCheerio(this).find('td:nth-child(2)').text();
novelName = novelName.replace(/[\t\n]/g, '');
const novelCover = 'https://cdn.novelupdates.com/imgmid/noimagemid.jpg';
- let novelUrl = $(this).find('td:nth-child(2) >').attr('href');
+ let novelUrl = loadedCheerio(this).find('td:nth-child(2) >').attr('href');
if (novelUrl) {
novelUrl = novelUrl.slice(1);
}
- novel = {
+ const novel = {
sourceId: 6,
novelName,
novelCover,
diff --git a/src/sources/en/novelonlinefull.js b/src/sources/en/novelonlinefull.js
index 88134e57..051378e3 100644
--- a/src/sources/en/novelonlinefull.js
+++ b/src/sources/en/novelonlinefull.js
@@ -13,15 +13,15 @@ const popularNovels = async page => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.update_item.list_category').each(function () {
- const novelName = $(this).find('h3').text().trim();
- const novelCover = $(this).find('img').attr('src');
+ loadedCheerio('.update_item.list_category').each(function () {
+ const novelName = loadedCheerio(this).find('h3').text().trim();
+ const novelCover = loadedCheerio(this).find('img').attr('src');
- let novelUrl = $(this).find('h3 > a').attr('href');
+ let novelUrl = loadedCheerio(this).find('h3 > a').attr('href');
novelUrl = novelUrl.replace(baseUrl + 'novel/', '');
const novel = {
@@ -43,46 +43,48 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novel = {sourceId, sourceName, url, novelUrl};
- novel.novelName = $('h1').text().trim();
+ novel.novelName = loadedCheerio('h1').text().trim();
- novel.novelCover = $('.info_image > img').attr('src');
+ novel.novelCover = loadedCheerio('.info_image > img').attr('src');
- novel.summary = $('#noidungm').text().trim();
+ novel.summary = loadedCheerio('#noidungm').text().trim();
- novel.genre = $('div.truyen_if_wrap > ul > li:nth-child(3)')
+ novel.genre = loadedCheerio('div.truyen_if_wrap > ul > li:nth-child(3)')
.text()
.replace('GENRES: ', '')
.replace(/ - /g, ',')
.trim();
- console.log(novel.genre);
+ // console.log(novel.genre);
novel.status =
- $(' div.truyen_if_wrap > ul > li:nth-child(4) > a')
+ loadedCheerio(' div.truyen_if_wrap > ul > li:nth-child(4) > a')
.text()
.replace('STATUS', '')
.trim() === 'ONGOING'
? Status.ONGOING
: Status.COMPLETED;
- novel.author = $('div.truyen_if_wrap > ul > li:nth-child(2)')
+ novel.author = loadedCheerio('div.truyen_if_wrap > ul > li:nth-child(2)')
.text()
.replace('Author(s):', '')
.trim();
let novelChapters = [];
- $('.chapter-list')
+ loadedCheerio('.chapter-list')
.find('.row')
.each(function () {
- const releaseDate = $(this).find('span:nth-child(2)').text();
+ const releaseDate = loadedCheerio(this).find('span:nth-child(2)').text();
- const chapterName = $(this).find('span:nth-child(1) > a').text();
- const chapterUrl = $(this).find('a').attr('href');
+ const chapterName = loadedCheerio(this)
+ .find('span:nth-child(1) > a')
+ .text();
+ const chapterUrl = loadedCheerio(this).find('a').attr('href');
novelChapters.push({
chapterName,
@@ -102,10 +104,10 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
- let chapterName = $('.name_chapter').text();
- let chapterText = $('#vung_doc').html();
+ let chapterName = loadedCheerio('.name_chapter').text();
+ let chapterText = loadedCheerio('#vung_doc').html();
const chapter = {
sourceId,
@@ -124,15 +126,15 @@ const searchNovels = async searchTerm => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.update_item.list_category').each(function () {
- const novelName = $(this).find('h3').text();
- const novelCover = $(this).find('img').attr('src');
+ loadedCheerio('.update_item.list_category').each(function () {
+ const novelName = loadedCheerio(this).find('h3').text();
+ const novelCover = loadedCheerio(this).find('img').attr('src');
- let novelUrl = $(this).find('h3 > a').attr('href');
+ let novelUrl = loadedCheerio(this).find('h3 > a').attr('href');
novelUrl = novelUrl.replace(baseUrl + 'novel/', '');
const novel = {
diff --git a/src/sources/en/novelpassion.js b/src/sources/en/novelpassion.js
index 92b0d67e..1e5cb19f 100644
--- a/src/sources/en/novelpassion.js
+++ b/src/sources/en/novelpassion.js
@@ -11,18 +11,19 @@ const popularNovels = async page => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('div.j_bookList.lis-mn.ddc')
+ loadedCheerio('div.j_bookList.lis-mn.ddc')
.find('li')
- .each(function (result) {
- const novelName = $(this).find('h3').text();
+ .each(function () {
+ const novelName = loadedCheerio(this).find('h3').text();
const novelCover =
- 'https://www.novelpassion.com' + $(this).find('img').attr('src');
+ 'https://www.novelpassion.com' +
+ loadedCheerio(this).find('img').attr('src');
- let novelUrl = $(this).find('div.pr > a').attr('href');
+ let novelUrl = loadedCheerio(this).find('div.pr > a').attr('href');
novelUrl = novelUrl.replace('/novel/', '');
const novel = {
@@ -44,7 +45,7 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novel = {};
@@ -56,25 +57,25 @@ const parseNovelAndChapters = async novelUrl => {
novel.novelUrl = novelUrl;
- novelName = $('h2.mh').text();
+ const novelName = loadedCheerio('h2.mh').text();
novel.novelName = novelName;
- novel.novelCover = baseUrl + $('i.g_thumb > img').attr('src');
+ novel.novelCover = baseUrl + loadedCheerio('i.g_thumb > img').attr('src');
- let novelSummary = $('div.j_synopsis').text().trim();
+ let novelSummary = loadedCheerio('div.j_synopsis').text().trim();
novel.summary = novelSummary;
- $('address.lh20.m14.pr').each(function (result) {
- detailName = $(this).find('p.ell.dib.vam').text().trim();
+ loadedCheerio('address.lh20.m14.pr').each(function () {
+ const detailName = loadedCheerio(this).find('p.ell.dib.vam').text().trim();
- detail = $(this).find('div.dns').text().trim();
+ const detail = loadedCheerio(this).find('div.dns').text().trim();
switch (detailName) {
case 'Categories:':
- novel.genre = detail.trim().replace(/ - /g, ',');
+ novel.genre = detail.trim().replace(/ - {2}/g, ',');
break;
case 'Author:':
- novel.author = detail.trim().replace(/ - /g, ', ');
+ novel.author = detail.trim().replace(/ - {2}/g, ', ');
break;
}
@@ -85,15 +86,15 @@ const parseNovelAndChapters = async novelUrl => {
let novelChapters = [];
- $('.content-list')
+ loadedCheerio('.content-list')
.find('li')
- .each(function (result) {
- const chapterName = $(this).find('span.sp1').text();
+ .each(function () {
+ const chapterName = loadedCheerio(this).find('span.sp1').text();
- let releaseDate = $(this).find('i.sp2').text();
+ let releaseDate = loadedCheerio(this).find('i.sp2').text();
releaseDate = moment(new Date(releaseDate)).format('MM/DD/YY');
- const chapterUrl = $(this)
+ const chapterUrl = loadedCheerio(this)
.find('a')
.attr('href')
.replace('/novel/' + novelUrl + '/', '');
@@ -116,11 +117,11 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
- let chapterName = $('div.cha-content').find('strong').text();
+ let chapterName = loadedCheerio('div.cha-content').find('strong').text();
- let chapterText = $('div.cha-content').html();
+ let chapterText = loadedCheerio('div.cha-content').html();
const chapter = {
sourceId: 33,
novelUrl,
@@ -138,18 +139,19 @@ const searchNovels = async searchTerm => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('div.j_bookList.lis-mn.ddc')
+ loadedCheerio('div.j_bookList.lis-mn.ddc')
.find('li')
- .each(function (result) {
- const novelName = $(this).find('h3').text();
+ .each(function () {
+ const novelName = loadedCheerio(this).find('h3').text();
const novelCover =
- 'https://www.novelpassion.com' + $(this).find('img').attr('src');
+ 'https://www.novelpassion.com' +
+ loadedCheerio(this).find('img').attr('src');
- let novelUrl = $(this).find('div.pr > a').attr('href');
+ let novelUrl = loadedCheerio(this).find('div.pr > a').attr('href');
novelUrl = novelUrl.replace('/novel/', '');
const novel = {
diff --git a/src/sources/en/noveltrench.js b/src/sources/en/noveltrench.js
index 514154d5..3d9b7c2e 100644
--- a/src/sources/en/noveltrench.js
+++ b/src/sources/en/noveltrench.js
@@ -9,15 +9,15 @@ const popularNovels = async page => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.page-item-detail').each(function (result) {
- const novelName = $(this).find('.h5 > a').text();
- const novelCover = $(this).find('img').attr('data-src');
+ loadedCheerio('.page-item-detail').each(function () {
+ const novelName = loadedCheerio(this).find('.h5 > a').text();
+ const novelCover = loadedCheerio(this).find('img').attr('data-src');
- let novelUrl = $(this).find('.h5 > a').attr('href');
+ let novelUrl = loadedCheerio(this).find('.h5 > a').attr('href');
novelUrl = novelUrl.replace(`${baseUrl}manga/`, '');
const novel = {
@@ -39,7 +39,7 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novel = {};
@@ -51,20 +51,20 @@ const parseNovelAndChapters = async novelUrl => {
novel.novelUrl = novelUrl;
- novel.novelName = $('.post-title > h1')
+ novel.novelName = loadedCheerio('.post-title > h1')
.text()
.replace(/[\t\n]/g, '')
.trim();
- novel.novelCover = $('.summary_image > a > img').attr('data-src');
+ novel.novelCover = loadedCheerio('.summary_image > a > img').attr('data-src');
- $('.post-content_item').each(function (result) {
- detailName = $(this)
+ loadedCheerio('.post-content_item').each(function () {
+ const detailName = loadedCheerio(this)
.find('.summary-heading > h5')
.text()
.replace(/[\t\n]/g, '')
.trim();
- detail = $(this)
+ const detail = loadedCheerio(this)
.find('.summary-content')
.text()
.replace(/[\t\n]/g, '')
@@ -83,28 +83,33 @@ const parseNovelAndChapters = async novelUrl => {
}
});
- $('.description-summary > div.summary__content').find('em').remove();
+ loadedCheerio('.description-summary > div.summary__content')
+ .find('em')
+ .remove();
- novel.summary = $('.description-summary > div.summary__content')
+ novel.summary = loadedCheerio('.description-summary > div.summary__content')
.text()
.replace(/[\t\n]/g, '');
let novelChapters = [];
- $('.wp-manga-chapter').each(function (result) {
- chapterName = $(this)
+ loadedCheerio('.wp-manga-chapter').each(function () {
+ const chapterName = loadedCheerio(this)
.find('a')
.text()
.replace(/[\t\n]/g, '')
.trim();
- releaseDate = $(this)
+ const releaseDate = loadedCheerio(this)
.find('span')
.text()
.replace(/[\t\n]/g, '')
.trim();
- chapterUrl = $(this).find('a').attr('href').replace(url, '');
+ const chapterUrl = loadedCheerio(this)
+ .find('a')
+ .attr('href')
+ .replace(url, '');
novelChapters.push({chapterName, releaseDate, chapterUrl});
});
@@ -119,10 +124,10 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
- const chapterName = $('h1#chapter-heading').text();
- let chapterText = $('.reading-content').html();
+ const chapterName = loadedCheerio('h1#chapter-heading').text();
+ let chapterText = loadedCheerio('.reading-content').html();
const chapter = {
sourceId: 9,
novelUrl,
@@ -140,15 +145,15 @@ const searchNovels = async searchTerm => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.c-tabs-item__content').each(function (result) {
- const novelName = $(this).find('.h4 > a').text();
- const novelCover = $(this).find('img').attr('data-src');
+ loadedCheerio('.c-tabs-item__content').each(function () {
+ const novelName = loadedCheerio(this).find('.h4 > a').text();
+ const novelCover = loadedCheerio(this).find('img').attr('data-src');
- let novelUrl = $(this).find('.h4 > a').attr('href');
+ let novelUrl = loadedCheerio(this).find('.h4 > a').attr('href');
novelUrl = novelUrl.replace(`${baseUrl}manga/`, '');
const novel = {
diff --git a/src/sources/en/novelupdates.js b/src/sources/en/novelupdates.js
index 452ffd9f..e182f778 100644
--- a/src/sources/en/novelupdates.js
+++ b/src/sources/en/novelupdates.js
@@ -21,14 +21,14 @@ const popularNovels = async page => {
});
const body = await result.text();
- const $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
const novels = [];
- $('div.search_main_box_nu').each(function (res) {
- const novelCover = $(this).find('img').attr('src');
- const novelName = $(this).find('.search_title > a').text();
- const novelUrl = $(this)
+ loadedCheerio('div.search_main_box_nu').each(function (res) {
+ const novelCover = loadedCheerio(this).find('img').attr('src');
+ const novelName = loadedCheerio(this).find('.search_title > a').text();
+ const novelUrl = loadedCheerio(this)
.find('.search_title > a')
.attr('href')
.split('/')[4];
@@ -55,7 +55,7 @@ const parseNovelAndChapters = async novelUrl => {
});
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novel = {
sourceId,
@@ -64,32 +64,32 @@ const parseNovelAndChapters = async novelUrl => {
novelUrl,
};
- novel.novelName = $('.seriestitlenu').text();
+ novel.novelName = loadedCheerio('.seriestitlenu').text();
- novel.novelCover = $('.seriesimg > img').attr('src');
+ novel.novelCover = loadedCheerio('.seriesimg > img').attr('src');
- novel.author = $('#showauthors').text().trim();
+ novel.author = loadedCheerio('#showauthors').text().trim();
- novel.genre = $('#seriesgenre').text().trim().replace(/\s/g, ',');
+ novel.genre = loadedCheerio('#seriesgenre').text().trim().replace(/\s/g, ',');
- novel.status = $('#editstatus').text().includes('Ongoing')
+ novel.status = loadedCheerio('#editstatus').text().includes('Ongoing')
? 'Ongoing'
: 'Completed';
- let type = $('#showtype').text().trim();
+ let type = loadedCheerio('#showtype').text().trim();
- let summary = $('#editdescription').text().trim();
+ let summary = loadedCheerio('#editdescription').text().trim();
novel.summary = summary + `\n\nType: ${type}`;
let novelChapters = [];
- const novelId = $('input#mypostid').attr('value');
+ const novelId = loadedCheerio('input#mypostid').attr('value');
let formData = new FormData();
formData.append('action', 'nd_getchapters');
formData.append('mygrr', 0);
- formData.append('mypostid', parseInt(novelId));
+ formData.append('mypostid', parseInt(novelId, 10));
const data = await fetch(
'https://www.novelupdates.com/wp-admin/admin-ajax.php',
@@ -101,14 +101,15 @@ const parseNovelAndChapters = async novelUrl => {
);
const text = await data.text();
- $ = cheerio.load(text);
+ loadedCheerio = cheerio.load(text);
- $('li.sp_li_chp').each(function () {
- const chapterName = $(this).text().trim();
+ loadedCheerio('li.sp_li_chp').each(function () {
+ const chapterName = loadedCheerio(this).text().trim();
const releaseDate = null;
- const chapterUrl = 'https:' + $(this).find('a').first().next().attr('href');
+ const chapterUrl =
+ 'https:' + loadedCheerio(this).find('a').first().next().attr('href');
novelChapters.push({chapterName, releaseDate, chapterUrl});
});
@@ -120,7 +121,7 @@ const parseNovelAndChapters = async novelUrl => {
function getLocation(href) {
var match = href.match(
- /^(https?\:)\/\/(([^:\/?#]*)(?:\:([0-9]+))?)([\/]{0,1}[^?#]*)(\?[^#]*|)(#.*|)$/,
+ /^(https?:)\/\/(([^:/?#]*)(?::([0-9]+))?)([/]{0,1}[^?#]*)(\?[^#]*|)(#.*|)$/,
);
return match && `${match[1]}//${match[3]}`;
}
@@ -134,6 +135,8 @@ const parseChapter = async (novelUrl, chapterUrl) => {
let chapterName = '';
+ let chapterText = '';
+
try {
result = await fetch(url, {
method: 'GET',
@@ -145,7 +148,7 @@ const parseChapter = async (novelUrl, chapterUrl) => {
// console.log("Redirected URL: ", result.url);
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let isWuxiaWorld = result.url.toLowerCase().includes('wuxiaworld');
@@ -157,13 +160,14 @@ const parseChapter = async (novelUrl, chapterUrl) => {
* Checks if its a wwordpress site
*/
let isWordPress =
- $('meta[name="generator"]').attr('content') || $('footer').text();
+ loadedCheerio('meta[name="generator"]').attr('content') ||
+ loadedCheerio('footer').text();
if (isWordPress) {
isWordPress =
isWordPress.toLowerCase().includes('wordpress') ||
isWordPress.includes('Site Kit by Google') ||
- $('.powered-by').text().toLowerCase().includes('wordpress');
+ loadedCheerio('.powered-by').text().toLowerCase().includes('wordpress');
}
let isRainOfSnow = result.url.toLowerCase().includes('rainofsnow');
@@ -175,19 +179,19 @@ const parseChapter = async (novelUrl, chapterUrl) => {
let isScribbleHub = result.url.toLowerCase().includes('scribblehub');
if (isWuxiaWorld) {
- chapterText = $('#chapter-content').html();
+ chapterText = loadedCheerio('#chapter-content').html();
} else if (isRainOfSnow) {
- chapterText = $('div.content').html();
+ chapterText = loadedCheerio('div.content').html();
} else if (isTumblr) {
- chapterText = $('.post').html();
+ chapterText = loadedCheerio('.post').html();
} else if (isBlogspot) {
- $('.post-share-buttons').remove();
+ loadedCheerio('.post-share-buttons').remove();
- chapterText = $('.entry-content').html();
+ chapterText = loadedCheerio('.entry-content').html();
} else if (isHostedNovel) {
- chapterText = $('.chapter').html();
+ chapterText = loadedCheerio('.chapter').html();
} else if (isScribbleHub) {
- chapterText = $('div.chp_raw').html();
+ chapterText = loadedCheerio('div.chp_raw').html();
} else if (isWordPress) {
/**
* Remove wordpress bloat tags
@@ -209,21 +213,21 @@ const parseChapter = async (novelUrl, chapterUrl) => {
'.ezoic-ad',
];
- bloatClasses.map(tag => $(tag).remove());
+ bloatClasses.map(tag => loadedCheerio(tag).remove());
chapterText =
- $('.entry-content').html() ||
- $('.single_post').html() ||
- $('.post-entry').html() ||
- $('.main-content').html() ||
- $('article.post').html() ||
- $('.content').html() ||
- $('#content').html();
+ loadedCheerio('.entry-content').html() ||
+ loadedCheerio('.single_post').html() ||
+ loadedCheerio('.post-entry').html() ||
+ loadedCheerio('.main-content').html() ||
+ loadedCheerio('article.post').html() ||
+ loadedCheerio('.content').html() ||
+ loadedCheerio('#content').html();
} else if (isWebNovel) {
- chapterText = $('.cha-words').html();
+ chapterText = loadedCheerio('.cha-words').html();
if (!chapterText) {
- chapterText = $('._content').html();
+ chapterText = loadedCheerio('._content').html();
}
} else {
/**
@@ -231,9 +235,9 @@ const parseChapter = async (novelUrl, chapterUrl) => {
*/
const tags = ['nav', 'header', 'footer', '.hidden'];
- tags.map(tag => $(tag).remove());
+ tags.map(tag => loadedCheerio(tag).remove());
- chapterText = $('body').html();
+ chapterText = loadedCheerio('body').html();
}
if (!chapterText) {
@@ -273,14 +277,14 @@ const searchNovels = async searchTerm => {
});
const body = await res.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('div.search_main_box_nu').each(function (res) {
- const novelCover = $(this).find('img').attr('src');
- const novelName = $(this).find('.search_title > a').text();
- const novelUrl = $(this)
+ loadedCheerio('div.search_main_box_nu').each(function () {
+ const novelCover = loadedCheerio(this).find('img').attr('src');
+ const novelName = loadedCheerio(this).find('.search_title > a').text();
+ const novelUrl = loadedCheerio(this)
.find('.search_title > a')
.attr('href')
.split('/')[4];
diff --git a/src/sources/en/novelupdatescc.js b/src/sources/en/novelupdatescc.js
index 624ff7ff..50cc33db 100644
--- a/src/sources/en/novelupdatescc.js
+++ b/src/sources/en/novelupdatescc.js
@@ -7,15 +7,15 @@ const popularNovels = async page => {
const result = await fetch(baseUrl);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.section-item').each(function (result) {
- const novelName = $(this).find('.book-name').text();
- const novelCover = $(this).find('img').attr('src');
+ loadedCheerio('.section-item').each(function () {
+ const novelName = loadedCheerio(this).find('.book-name').text();
+ const novelCover = loadedCheerio(this).find('img').attr('src');
- let novelUrl = $(this).find('a').attr('href').slice(1);
+ let novelUrl = loadedCheerio(this).find('a').attr('href').slice(1);
const novel = {
sourceId: 18,
@@ -36,7 +36,7 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novel = {};
@@ -48,25 +48,25 @@ const parseNovelAndChapters = async novelUrl => {
novel.novelUrl = novelUrl;
- novel.novelName = $('.book-name').text();
+ novel.novelName = loadedCheerio('.book-name').text();
- novel.novelCover = $('div.book-img > img').attr('src');
+ novel.novelCover = loadedCheerio('div.book-img > img').attr('src');
- novel.genre = $('div.book-catalog > span.txt').text();
+ novel.genre = loadedCheerio('div.book-catalog > span.txt').text();
- novel.status = $('div.book-state > span.txt').text();
+ novel.status = loadedCheerio('div.book-state > span.txt').text();
- novel.author = $('div.author > span.name').text();
+ novel.author = loadedCheerio('div.author > span.name').text();
- novelSummary = $('div.content > p.desc').text();
+ const novelSummary = loadedCheerio('div.content > p.desc').text();
novel.summary = novelSummary.trim();
let novelChapters = [];
- $('.chapter-item').each(function (result) {
- const chapterName = $(this).find('.chapter-name').text();
+ loadedCheerio('.chapter-item').each(function () {
+ const chapterName = loadedCheerio(this).find('.chapter-name').text();
const releaseDate = null;
- const chapterUrl = $(this).attr('href').slice(1);
+ const chapterUrl = loadedCheerio(this).attr('href').slice(1);
novelChapters.push({
chapterName,
@@ -86,10 +86,10 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
- const chapterName = $('h1.chapter-title').text();
- let chapterText = $('div.chapter-entity').html();
+ const chapterName = loadedCheerio('h1.chapter-title').text();
+ let chapterText = loadedCheerio('div.chapter-entity').html();
const chapter = {
sourceId: 18,
novelUrl,
@@ -107,17 +107,17 @@ const searchNovels = async searchTerm => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.list-item').each(function (result) {
- $(this).find('font').remove();
+ loadedCheerio('.list-item').each(function () {
+ loadedCheerio(this).find('font').remove();
- const novelName = $(this).find('.book-name').text();
- const novelCover = $(this).find('img').attr('src');
+ const novelName = loadedCheerio(this).find('.book-name').text();
+ const novelCover = loadedCheerio(this).find('img').attr('src');
- let novelUrl = $(this).find('a').attr('href').slice(1);
+ let novelUrl = loadedCheerio(this).find('a').attr('href').slice(1);
const novel = {
sourceId: 18,
diff --git a/src/sources/en/rainofsnow.js b/src/sources/en/rainofsnow.js
index 9a81d9d0..e01ae55a 100644
--- a/src/sources/en/rainofsnow.js
+++ b/src/sources/en/rainofsnow.js
@@ -15,14 +15,14 @@ const popularNovels = async page => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.minbox').each(function () {
- const novelName = $(this).find('h3').text();
- const novelCover = $(this).find('img').attr('data-src');
- const novelUrl = $(this).find('h3 > a').attr('href');
+ loadedCheerio('.minbox').each(function () {
+ const novelName = loadedCheerio(this).find('h3').text();
+ const novelCover = loadedCheerio(this).find('img').attr('data-src');
+ const novelUrl = loadedCheerio(this).find('h3 > a').attr('href');
const novel = {
sourceId,
@@ -43,23 +43,23 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novel = {sourceId, sourceName, url, novelUrl};
- novel.novelName = $('h2').text().trim();
+ novel.novelName = loadedCheerio('h2').text().trim();
- novel.novelCover = $('.imagboca1 > img').attr('data-src');
+ novel.novelCover = loadedCheerio('.imagboca1 > img').attr('data-src');
- novel.summary = $('#synop').text().trim();
+ novel.summary = loadedCheerio('#synop').text().trim();
- novel.genre = $(
+ novel.genre = loadedCheerio(
'body > div.queen > div > div > div.row > div.col-md-12.col-lg-7 > div > div.backcolor1 > ul > li:nth-child(5) > small',
)
.text()
.trim();
- novel.author = $(
+ novel.author = loadedCheerio(
'body > div.queen > div > div > div.row > div.col-md-12.col-lg-7 > div > div.backcolor1 > ul > li:nth-child(2) > small',
).text();
@@ -67,12 +67,16 @@ const parseNovelAndChapters = async novelUrl => {
let novelChapters = [];
- $('#chapter')
+ loadedCheerio('#chapter')
.find('li')
.each(function () {
- const chapterName = $(this).find('.chapter').first().text().trim();
- const releaseDate = $(this).find('small').text();
- const chapterUrl = $(this).find('a').attr('href');
+ const chapterName = loadedCheerio(this)
+ .find('.chapter')
+ .first()
+ .text()
+ .trim();
+ const releaseDate = loadedCheerio(this).find('small').text();
+ const chapterUrl = loadedCheerio(this).find('a').attr('href');
novelChapters.push({chapterName, releaseDate, chapterUrl});
});
@@ -86,10 +90,10 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(chapterUrl);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
- let chapterName = $('.content > h2').text();
- let chapterText = $('.content').html();
+ let chapterName = loadedCheerio('.content > h2').text();
+ let chapterText = loadedCheerio('.content').html();
const chapter = {
sourceId,
@@ -108,14 +112,14 @@ const searchNovels = async searchTerm => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.minbox').each(function () {
- const novelName = $(this).find('h3').text();
- const novelCover = $(this).find('img').attr('data-src');
- const novelUrl = $(this).find('h3 > a').attr('href');
+ loadedCheerio('.minbox').each(function () {
+ const novelName = loadedCheerio(this).find('h3').text();
+ const novelCover = loadedCheerio(this).find('img').attr('data-src');
+ const novelUrl = loadedCheerio(this).find('h3 > a').attr('href');
const novel = {
sourceId,
diff --git a/src/sources/en/ranobes.js b/src/sources/en/ranobes.js
index 38c12a15..c4b52639 100644
--- a/src/sources/en/ranobes.js
+++ b/src/sources/en/ranobes.js
@@ -22,15 +22,15 @@ const popularNovels = async page => {
const result = await fetch(url, {method: 'GET', headers: headers});
const body = await result.text();
- let $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novels = [];
- $('article.block.story.shortstory.mod-poster').each(function () {
- const novelName = $(this).find('h2.title').text();
- let novelCover = $(this).find('figure').attr('style');
+ loadedCheerio('article.block.story.shortstory.mod-poster').each(function () {
+ const novelName = loadedCheerio(this).find('h2.title').text();
+ let novelCover = loadedCheerio(this).find('figure').attr('style');
- let novelUrl = $(this)
+ let novelUrl = loadedCheerio(this)
.find('a')
.attr('href')
.replace(baseUrl + 'novels/', '');
@@ -58,7 +58,7 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- let $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novel = {
sourceId,
@@ -67,20 +67,22 @@ const parseNovelAndChapters = async novelUrl => {
novelUrl,
};
- novel.novelName = $('meta[property="og:title"]').attr('content');
+ novel.novelName = loadedCheerio('meta[property="og:title"]').attr('content');
- novel.novelCover = baseUrl + $('.poster > a > img').attr('src');
+ novel.novelCover = baseUrl + loadedCheerio('.poster > a > img').attr('src');
- novel.author = $('dl.author > dd').text();
+ novel.author = loadedCheerio('dl.author > dd').text();
- novel.genre = $('.book-generes').text().trim();
+ novel.genre = loadedCheerio('.book-generes').text().trim();
- novel.summary = $('div[itemprop="description"]').text().trim();
+ novel.summary = loadedCheerio('div[itemprop="description"]').text().trim();
- novel.author = $('span[itemprop="author"]').text();
- novel.genre = $('span[itemprop="genre"]').text().replace(', ', ',');
+ novel.author = loadedCheerio('span[itemprop="author"]').text();
+ novel.genre = loadedCheerio('span[itemprop="genre"]')
+ .text()
+ .replace(', ', ',');
- let tempNovelUrl = $('.r-fullstory-chapters-foot')
+ let tempNovelUrl = loadedCheerio('.r-fullstory-chapters-foot')
.find('a')
.next()
.next()
@@ -92,18 +94,18 @@ const parseNovelAndChapters = async novelUrl => {
const chaptersHtml = await fetch(chapterListUrl);
const chapterHtmlToString = await chaptersHtml.text();
- $ = cheerio.load(chapterHtmlToString);
+ loadedCheerio = cheerio.load(chapterHtmlToString);
// let lastPage = $("div.pages > a").last().text();
let novelChapters = [];
- $('#dle-content > div.cat_block.cat_line').each(function () {
- const chapterName = $(this).find('.title').text();
+ loadedCheerio('#dle-content > div.cat_block.cat_line').each(function () {
+ const chapterName = loadedCheerio(this).find('.title').text();
let releaseDate = new Date();
- let timeAgo = $(this).find('small').text();
+ let timeAgo = loadedCheerio(this).find('small').text();
timeAgo = timeAgo.match(/\d+/)[0];
@@ -121,7 +123,7 @@ const parseNovelAndChapters = async novelUrl => {
releaseDate = moment(releaseDate).format('MM/DD/YY');
- const chapterUrl = $(this)
+ const chapterUrl = loadedCheerio(this)
.find('a')
.attr('href')
.replace(baseUrl + 'up/', '');
@@ -191,11 +193,11 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
- let chapterName = $('h1.title').text();
+ let chapterName = loadedCheerio('h1.title').text();
- let chapterText = $('#arrticle').html();
+ let chapterText = loadedCheerio('#arrticle').html();
const chapter = {
sourceId,
novelUrl,
diff --git a/src/sources/en/readlightnovel.js b/src/sources/en/readlightnovel.js
index 93e78093..4400c381 100644
--- a/src/sources/en/readlightnovel.js
+++ b/src/sources/en/readlightnovel.js
@@ -4,8 +4,6 @@ const sourceId = 2;
const sourceName = 'ReadLightNovel';
-const lang = 'en';
-
const baseUrl = 'https://www.readlightnovel.me';
const searchUrl = 'https://www.readlightnovel.me/detailed-search';
@@ -17,14 +15,14 @@ const popularNovels = async page => {
const result = await fetch(url);
const body = await result.text();
- const $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
const novels = [];
- $('.top-novel-block').each(function (result) {
- const novelName = $(this).find('h2 > a').text();
- const novelCover = $(this).find('img').attr('src');
- const novelUrl = $(this)
+ loadedCheerio('.top-novel-block').each(function () {
+ const novelName = loadedCheerio(this).find('h2 > a').text();
+ const novelCover = loadedCheerio(this).find('img').attr('src');
+ const novelUrl = loadedCheerio(this)
.find('h2 > a')
.attr('href')
.replace(`${baseUrl}/`, '');
@@ -48,19 +46,21 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novel;
- const novelName = $('.block-title > h1').text();
+ const novelName = loadedCheerio('.block-title > h1').text();
- const novelCover = $('.novel-cover > a > img').attr('src');
+ const novelCover = loadedCheerio('.novel-cover > a > img').attr('src');
let author, artist, genre, summary, status;
- $('.novel-detail-item').each(function (result) {
- const detailName = $(this).find('.novel-detail-header > h6').text();
- const detail = $(this).find('.novel-detail-body').text().trim();
+ loadedCheerio('.novel-detail-item').each(function () {
+ const detailName = loadedCheerio(this)
+ .find('.novel-detail-header > h6')
+ .text();
+ const detail = loadedCheerio(this).find('.novel-detail-body').text().trim();
switch (detailName) {
case 'Genre':
@@ -84,17 +84,17 @@ const parseNovelAndChapters = async novelUrl => {
let chapters = [];
- $('.panel').each(function () {
- let volumeName = $(this).find('h4.panel-title').text();
+ loadedCheerio('.panel').each(function () {
+ let volumeName = loadedCheerio(this).find('h4.panel-title').text();
- $(this)
+ loadedCheerio(this)
.find('ul.chapter-chs > li')
.each(function () {
- let chapterName = $(this).find('a').text();
+ let chapterName = loadedCheerio(this).find('a').text();
const releaseDate = null;
- const chapterUrl = $(this)
+ const chapterUrl = loadedCheerio(this)
.find('a')
.attr('href')
.replace(`${baseUrl}/${novelUrl}/`, '');
@@ -137,24 +137,28 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
- $('.block-title > h1').find('a').remove();
+ loadedCheerio('.block-title > h1').find('a').remove();
- const chapterName = $('.block-title > h1').text().replace(' - ', '');
+ const chapterName = loadedCheerio('.block-title > h1')
+ .text()
+ .replace(' - ', '');
- $('.alert').remove();
- $('.hidden').remove();
- $('iframe').remove();
- $('button').remove();
- $('.hid').remove();
- $('center').remove();
- $(
+ loadedCheerio('.alert').remove();
+ loadedCheerio('.hidden').remove();
+ loadedCheerio('iframe').remove();
+ loadedCheerio('button').remove();
+ loadedCheerio('.hid').remove();
+ loadedCheerio('center').remove();
+ loadedCheerio(
'div[style="float: left; margin-top: 20px; font-style: italic;margin-left: 50px; font-size: 14px;"]',
).remove();
- $('div[style="float:left;margin-top:15px;margin-bottom:15px;"]').remove();
+ loadedCheerio(
+ 'div[style="float:left;margin-top:15px;margin-bottom:15px;"]',
+ ).remove();
- let chapterText = $('.desc').html();
+ let chapterText = loadedCheerio('.desc').html();
const chapter = {
sourceId: 2,
@@ -178,15 +182,17 @@ const searchNovels = async searchTerm => {
});
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.top-novel-block').each(function (result) {
- const novelName = $(this).find('.top-novel-header > h2 > a').text();
- const novelCover = $(this).find('img').attr('src');
+ loadedCheerio('.top-novel-block').each(function () {
+ const novelName = loadedCheerio(this)
+ .find('.top-novel-header > h2 > a')
+ .text();
+ const novelCover = loadedCheerio(this).find('img').attr('src');
- const novelUrl = $(this)
+ const novelUrl = loadedCheerio(this)
.find('.top-novel-header > h2 > a')
.attr('href')
.replace(`${baseUrl}/`, '');
diff --git a/src/sources/en/readlightnovelcc.js b/src/sources/en/readlightnovelcc.js
index da3c628a..375a2c9b 100644
--- a/src/sources/en/readlightnovelcc.js
+++ b/src/sources/en/readlightnovelcc.js
@@ -7,15 +7,15 @@ const popularNovels = async page => {
const result = await fetch(baseUrl);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.section-item').each(function (result) {
- const novelName = $(this).find('.book-name').text();
- const novelCover = $(this).find('img').attr('src');
+ loadedCheerio('.section-item').each(function () {
+ const novelName = loadedCheerio(this).find('.book-name').text();
+ const novelCover = loadedCheerio(this).find('img').attr('src');
- let novelUrl = $(this).find('a').attr('href').slice(1);
+ let novelUrl = loadedCheerio(this).find('a').attr('href').slice(1);
const novel = {
sourceId: 19,
@@ -36,7 +36,7 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novel = {};
@@ -48,25 +48,25 @@ const parseNovelAndChapters = async novelUrl => {
novel.novelUrl = novelUrl;
- novel.novelName = $('.book-name').text();
+ novel.novelName = loadedCheerio('.book-name').text();
- novel.novelCover = $('div.book-img > img').attr('src');
+ novel.novelCover = loadedCheerio('div.book-img > img').attr('src');
- novel.genre = $('div.book-catalog > span.txt').text();
+ novel.genre = loadedCheerio('div.book-catalog > span.txt').text();
- novel.status = $('div.book-state > span.txt').text();
+ novel.status = loadedCheerio('div.book-state > span.txt').text();
- novel.author = $('div.author > span.name').text();
+ novel.author = loadedCheerio('div.author > span.name').text();
- novelSummary = $('div.content > p.desc').text();
+ const novelSummary = loadedCheerio('div.content > p.desc').text();
novel.summary = novelSummary.trim();
let novelChapters = [];
- $('.chapter-item').each(function (result) {
- const chapterName = $(this).find('.chapter-name').text();
+ loadedCheerio('.chapter-item').each(function () {
+ const chapterName = loadedCheerio(this).find('.chapter-name').text();
const releaseDate = null;
- const chapterUrl = $(this).attr('href').slice(1);
+ const chapterUrl = loadedCheerio(this).attr('href').slice(1);
novelChapters.push({
chapterName,
@@ -86,10 +86,10 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
- const chapterName = $('h1.chapter-title').text();
- let chapterText = $('div.chapter-entity').html();
+ const chapterName = loadedCheerio('h1.chapter-title').text();
+ let chapterText = loadedCheerio('div.chapter-entity').html();
const chapter = {
sourceId: 19,
novelUrl,
@@ -107,17 +107,17 @@ const searchNovels = async searchTerm => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.list-item').each(function (result) {
- $(this).find('font').remove();
+ loadedCheerio('.list-item').each(function () {
+ loadedCheerio(this).find('font').remove();
- const novelName = $(this).find('.book-name').text();
- const novelCover = $(this).find('img').attr('src');
+ const novelName = loadedCheerio(this).find('.book-name').text();
+ const novelCover = loadedCheerio(this).find('img').attr('src');
- let novelUrl = $(this).find('a').attr('href').slice(1);
+ let novelUrl = loadedCheerio(this).find('a').attr('href').slice(1);
const novel = {
sourceId: 19,
diff --git a/src/sources/en/readnovelfull.js b/src/sources/en/readnovelfull.js
index e05aca0d..9a12c163 100644
--- a/src/sources/en/readnovelfull.js
+++ b/src/sources/en/readnovelfull.js
@@ -9,20 +9,20 @@ const popularNovels = async page => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('div.col-novel-main > div.list-novel > .row').each(function (result) {
- let novelUrl = $(this)
+ loadedCheerio('div.col-novel-main > div.list-novel > .row').each(function () {
+ let novelUrl = loadedCheerio(this)
.find('h3.novel-title > a')
.attr('href')
.replace('.html', '')
.substring(1);
novelUrl = `${novelUrl}/`;
- const novelName = $(this).find('h3.novel-title > a').text();
- const novelCover = $(this).find('img').attr('src');
+ const novelName = loadedCheerio(this).find('h3.novel-title > a').text();
+ const novelCover = loadedCheerio(this).find('img').attr('src');
const novel = {
sourceId: 4,
@@ -43,7 +43,7 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novel = {};
@@ -55,54 +55,54 @@ const parseNovelAndChapters = async novelUrl => {
novel.novelUrl = novelUrl;
- novel.novelName = $('div.book > img').attr('alt');
+ novel.novelName = loadedCheerio('div.book > img').attr('alt');
- novel.novelCover = $('div.book > img').attr('src');
+ novel.novelCover = loadedCheerio('div.book > img').attr('src');
- novel.summary = $('div.desc-text').text().trim();
+ novel.summary = loadedCheerio('div.desc-text').text().trim();
- novel.author = $('li > h3')
+ novel.author = loadedCheerio('li > h3')
.filter(function () {
- return $(this).text().trim() === 'Author:';
+ return loadedCheerio(this).text().trim() === 'Author:';
})
.siblings()
.text();
- novel.genre = $('li')
+ novel.genre = loadedCheerio('li')
.filter(function () {
- return $(this).find('h3').text().trim() === 'Genre:';
+ return loadedCheerio(this).find('h3').text().trim() === 'Genre:';
})
.text()
.replace('Genre:', '');
novel.artist = null;
- novel.status = $('li > h3')
+ novel.status = loadedCheerio('li > h3')
.filter(function () {
- return $(this).text().trim() === 'Status:';
+ return loadedCheerio(this).text().trim() === 'Status:';
})
.siblings()
.text();
- const novelId = $('#rating').attr('data-novel-id');
+ const novelId = loadedCheerio('#rating').attr('data-novel-id');
- const getChapters = async novelId => {
+ const getChapters = async id => {
const chapterListUrl =
- 'https://readnovelfull.com/ajax/chapter-archive?novelId=' + novelId;
+ 'https://readnovelfull.com/ajax/chapter-archive?novelId=' + id;
const data = await fetch(chapterListUrl);
const chapters = await data.text();
- $ = cheerio.load(chapters);
+ loadedCheerio = cheerio.load(chapters);
let novelChapters = [];
- $('.panel-body')
+ loadedCheerio('.panel-body')
.find('li')
- .each(function (result) {
- let chapterName = $(this).find('a').attr('title');
+ .each(function () {
+ let chapterName = loadedCheerio(this).find('a').attr('title');
let releaseDate = null;
- let chapterUrl = $(this).find('a').attr('href');
+ let chapterUrl = loadedCheerio(this).find('a').attr('href');
chapterUrl = chapterUrl.replace(`/${novelUrl}`, '');
novelChapters.push({
@@ -125,10 +125,10 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
- const chapterName = $('.chr-title').attr('title');
- let chapterText = $('#chr-content').html();
+ const chapterName = loadedCheerio('.chr-title').attr('title');
+ let chapterText = loadedCheerio('#chr-content').html();
const chapter = {
sourceId: 4,
novelUrl,
@@ -141,27 +141,27 @@ const parseChapter = async (novelUrl, chapterUrl) => {
};
const searchNovels = async searchTerm => {
- const searchUrl = `https://readnovelfull.com/search?keyword=`;
+ const searchUrl = 'https://readnovelfull.com/search?keyword=';
const url = `${searchUrl}${searchTerm}`;
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('div.col-novel-main > div.list-novel > .row').each(function (result) {
- let novelUrl = $(this)
+ loadedCheerio('div.col-novel-main > div.list-novel > .row').each(function () {
+ let novelUrl = loadedCheerio(this)
.find('h3.novel-title > a')
.attr('href')
.replace('.html', '')
.substring(1);
novelUrl = `${novelUrl}/`;
- const novelName = $(this).find('h3.novel-title > a').text();
- const novelCover = $(this).find('img').attr('src');
+ const novelName = loadedCheerio(this).find('h3.novel-title > a').text();
+ const novelCover = loadedCheerio(this).find('img').attr('src');
const novel = {
sourceId: 4,
diff --git a/src/sources/en/readwn.js b/src/sources/en/readwn.js
index 3a38575b..db268728 100644
--- a/src/sources/en/readwn.js
+++ b/src/sources/en/readwn.js
@@ -19,18 +19,22 @@ const popularNovels = async page => {
const result = await fetch(url, {method: 'GET', headers});
const body = await result.text();
- console.log(body);
+ // console.log(body);
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('li.novel-item').each(function () {
- const novelName = $(this).find('h4').text();
- const novelUrl = $(this).find('a').attr('href').split('/').pop();
+ loadedCheerio('li.novel-item').each(function () {
+ const novelName = loadedCheerio(this).find('h4').text();
+ const novelUrl = loadedCheerio(this)
+ .find('a')
+ .attr('href')
+ .split('/')
+ .pop();
const novelCover =
- baseUrl + $(this).find('.novel-cover > img').attr('data-src');
+ baseUrl + loadedCheerio(this).find('.novel-cover > img').attr('data-src');
const novel = {
sourceId,
@@ -55,7 +59,7 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url, {method: 'GET', headers});
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novel = {
sourceId,
@@ -66,33 +70,34 @@ const parseNovelAndChapters = async novelUrl => {
novel.novelUrl = novelUrl;
- novel.novelName = $('h1.novel-title').text();
+ novel.novelName = loadedCheerio('h1.novel-title').text();
- novel.novelCover = baseUrl + $('figure.cover > img').attr('data-src');
+ novel.novelCover =
+ baseUrl + loadedCheerio('figure.cover > img').attr('data-src');
- novel.summary = $('p.description').text().trim();
+ novel.summary = loadedCheerio('p.description').text().trim();
novel.genre = '';
- $('div.categories > ul > li').each(function () {
- novel.genre += $(this).text().trim() + ',';
+ loadedCheerio('div.categories > ul > li').each(function () {
+ novel.genre += loadedCheerio(this).text().trim() + ',';
});
- $('div.header-stats > span').each(function () {
- if ($(this).find('small').text() === 'Status') {
- novel.status = $(this).find('strong').text();
+ loadedCheerio('div.header-stats > span').each(function () {
+ if (loadedCheerio(this).find('small').text() === 'Status') {
+ novel.status = loadedCheerio(this).find('strong').text();
}
});
novel.genre = novel.genre.slice(0, -1);
- novel.author = $('span[itemprop=author]').text();
+ novel.author = loadedCheerio('span[itemprop=author]').text();
let novelChapters = [];
const novelId = novelUrl.split('/').pop().replace('.html', '');
- const latestChapterNumber = $('.header-stats')
+ const latestChapterNumber = loadedCheerio('.header-stats')
.find('span > strong')
.first()
.text()
@@ -124,10 +129,10 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url, {method: 'GET', headers});
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
- const chapterName = $('.titles > h2').text();
- let chapterText = $('.chapter-content').html();
+ const chapterName = loadedCheerio('.titles > h2').text();
+ let chapterText = loadedCheerio('.chapter-content').html();
const chapter = {
sourceId,
@@ -161,14 +166,18 @@ const searchNovels = async searchTerm => {
});
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('li.novel-item').each(function () {
- const novelName = $(this).find('h4').text();
- const novelCover = baseUrl + $(this).find('img').attr('src');
- const novelUrl = $(this).find('a').attr('href').split('/').pop();
+ loadedCheerio('li.novel-item').each(function () {
+ const novelName = loadedCheerio(this).find('h4').text();
+ const novelCover = baseUrl + loadedCheerio(this).find('img').attr('src');
+ const novelUrl = loadedCheerio(this)
+ .find('a')
+ .attr('href')
+ .split('/')
+ .pop();
const novel = {
sourceId,
diff --git a/src/sources/en/reaperscans.js b/src/sources/en/reaperscans.js
index 76330403..5fc3a213 100644
--- a/src/sources/en/reaperscans.js
+++ b/src/sources/en/reaperscans.js
@@ -13,15 +13,20 @@ const popularNovels = async page => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.page-item-detail').each(function (result) {
- const novelName = $(this).find('.item-summary h3').text().trim();
- const novelCover = $(this).find('.img-responsive').attr('data-src');
+ loadedCheerio('.page-item-detail').each(function () {
+ const novelName = loadedCheerio(this)
+ .find('.item-summary h3')
+ .text()
+ .trim();
+ const novelCover = loadedCheerio(this)
+ .find('.img-responsive')
+ .attr('data-src');
- let novelUrl = $(this).find('div > a').attr('href');
+ let novelUrl = loadedCheerio(this).find('div > a').attr('href');
novelUrl = novelUrl.replace(`${baseUrl}/`, '');
const novel = {
@@ -43,21 +48,24 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novel = {sourceId, url, sourceName};
- $('.post-title > h3 > span').remove();
+ loadedCheerio('.post-title > h3 > span').remove();
novel.novelUrl = novelUrl;
- novel.novelName = $('.post-title > h1').text().trim();
+ novel.novelName = loadedCheerio('.post-title > h1').text().trim();
- novel.novelCover = $('.summary_image > a > img').attr('data-src');
+ novel.novelCover = loadedCheerio('.summary_image > a > img').attr('data-src');
- $('.post-content_item').each(function () {
- const detailName = $(this).find('.summary-heading > h5').text().trim();
- const detail = $(this).find('.summary-content').text().trim();
+ loadedCheerio('.post-content_item').each(function () {
+ const detailName = loadedCheerio(this)
+ .find('.summary-heading > h5')
+ .text()
+ .trim();
+ const detail = loadedCheerio(this).find('.summary-content').text().trim();
switch (detailName) {
case 'Genre(s)':
@@ -74,20 +82,25 @@ const parseNovelAndChapters = async novelUrl => {
}
});
- $('.description-summary > div.summary__content').find('em').remove();
- $('.premium-block').remove();
+ loadedCheerio('.description-summary > div.summary__content')
+ .find('em')
+ .remove();
+ loadedCheerio('.premium-block').remove();
- novel.summary = $('div.summary__content').text().trim();
+ novel.summary = loadedCheerio('div.summary__content').text().trim();
let novelChapters = [];
- $('.wp-manga-chapter').each(function (result) {
- $('i').remove();
+ loadedCheerio('.wp-manga-chapter').each(function () {
+ loadedCheerio('i').remove();
- const chapterName = $(this).find('a').text().trim();
+ const chapterName = loadedCheerio(this).find('a').text().trim();
const releaseDate = null;
- const chapterUrl = $(this).find('a').attr('href').replace(url, '');
+ const chapterUrl = loadedCheerio(this)
+ .find('a')
+ .attr('href')
+ .replace(url, '');
const chapter = {chapterName, releaseDate, chapterUrl};
@@ -105,10 +118,10 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
- const chapterName = $('#chapter-heading').text();
- let chapterText = $('.reading-content').html();
+ const chapterName = loadedCheerio('#chapter-heading').text();
+ let chapterText = loadedCheerio('.reading-content').html();
const chapter = {
sourceId,
novelUrl,
@@ -126,15 +139,20 @@ const searchNovels = async searchTerm => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.c-tabs-item__content').each(function (result) {
- const novelName = $(this).find('.post-title > h3').text().trim();
- const novelCover = $(this).find('div > div > a > img').attr('data-src');
+ loadedCheerio('.c-tabs-item__content').each(function () {
+ const novelName = loadedCheerio(this)
+ .find('.post-title > h3')
+ .text()
+ .trim();
+ const novelCover = loadedCheerio(this)
+ .find('div > div > a > img')
+ .attr('data-src');
- let novelUrl = $(this).find('div > div > a').attr('href');
+ let novelUrl = loadedCheerio(this).find('div > div > a').attr('href');
novelUrl = novelUrl.replace(`${baseUrl}/`, '');
const novel = {
diff --git a/src/sources/en/royalroad.js b/src/sources/en/royalroad.js
index 1b9014be..8987493b 100644
--- a/src/sources/en/royalroad.js
+++ b/src/sources/en/royalroad.js
@@ -12,19 +12,22 @@ const popularNovels = async page => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('div.fiction-list-item.row').each(function () {
- const novelName = $(this).find('h2.fiction-title').text().trim();
- let novelCover = $(this).find('img').attr('src');
+ loadedCheerio('div.fiction-list-item.row').each(function () {
+ const novelName = loadedCheerio(this)
+ .find('h2.fiction-title')
+ .text()
+ .trim();
+ let novelCover = loadedCheerio(this).find('img').attr('src');
if (novelCover === '/Content/Images/nocover-new-min.png') {
novelCover =
'https://github.com/LNReader/lnreader-sources/blob/main/src/coverNotAvailable.jpg?raw=true';
}
- let novelUrl = $(this)
+ let novelUrl = loadedCheerio(this)
.find('h2.fiction-title > a')
.attr('href')
.replace('/fiction/', '');
@@ -48,7 +51,7 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novel = {};
@@ -60,10 +63,10 @@ const parseNovelAndChapters = async novelUrl => {
novel.novelUrl = novelUrl;
- novelName = $('h1').text();
+ let novelName = loadedCheerio('h1').text();
novel.novelName = novelName;
- let novelCover = $('img.thumbnail').attr('src');
+ let novelCover = loadedCheerio('img.thumbnail').attr('src');
if (novelCover === '/Content/Images/nocover-new-min.png') {
novelCover =
@@ -72,12 +75,14 @@ const parseNovelAndChapters = async novelUrl => {
novel.novelCover = novelCover;
- novel.summary = $('div.description').text().trim();
+ novel.summary = loadedCheerio('div.description').text().trim();
- novel.author = $('h1').next().text().replace('by ', '').trim();
- novel.genre = $('span.tags').text().trim().replace(/\n\s+/g, ',');
+ novel.author = loadedCheerio('h1').next().text().replace('by ', '').trim();
+ novel.genre = loadedCheerio('span.tags').text().trim().replace(/\n\s+/g, ',');
novel.status =
- $('div.fiction-info > div.portlet > .col-md-8 > .margin-bottom-10 > span')
+ loadedCheerio(
+ 'div.fiction-info > div.portlet > .col-md-8 > .margin-bottom-10 > span',
+ )
.first()
.next()
.text()
@@ -87,14 +92,19 @@ const parseNovelAndChapters = async novelUrl => {
let novelChapters = [];
- $('table#chapters > tbody')
+ loadedCheerio('table#chapters > tbody')
.find('tr')
.each(function () {
- const chapterName = $(this).find('td').first().text().trim();
- let releaseDate = $(this).find('td').first().next().text().trim();
+ const chapterName = loadedCheerio(this).find('td').first().text().trim();
+ let releaseDate = loadedCheerio(this)
+ .find('td')
+ .first()
+ .next()
+ .text()
+ .trim();
releaseDate = releaseDate && parseMadaraDate(releaseDate);
- const chapterUrl = $(this)
+ const chapterUrl = loadedCheerio(this)
.find('td')
.first()
.find('a')
@@ -119,11 +129,11 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
- let chapterName = $('div.chapter-content').find('strong').text();
+ let chapterName = loadedCheerio('div.chapter-content').find('strong').text();
- let chapterText = $('div.chapter-content').html();
+ let chapterText = loadedCheerio('div.chapter-content').html();
const chapter = {
sourceId: 34,
@@ -142,19 +152,22 @@ const searchNovels = async searchTerm => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('div.fiction-list-item.row').each(function () {
- const novelName = $(this).find('h2.fiction-title').text().trim();
- let novelCover = $(this).find('img').attr('src');
+ loadedCheerio('div.fiction-list-item.row').each(function () {
+ const novelName = loadedCheerio(this)
+ .find('h2.fiction-title')
+ .text()
+ .trim();
+ let novelCover = loadedCheerio(this).find('img').attr('src');
if (novelCover.includes('Content')) {
novelCover = baseUrl + novelCover;
}
- let novelUrl = $(this)
+ let novelUrl = loadedCheerio(this)
.find('h2.fiction-title > a')
.attr('href')
.replace('/fiction/', '');
diff --git a/src/sources/en/scribblehub.js b/src/sources/en/scribblehub.js
index d4638c3e..c150fa45 100644
--- a/src/sources/en/scribblehub.js
+++ b/src/sources/en/scribblehub.js
@@ -9,15 +9,19 @@ const popularNovels = async page => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('div.search_main_box').each(function (result) {
- const novelName = $(this).find('div.search_title > a').text();
- const novelCover = $(this).find('div.search_img > img').attr('src');
+ loadedCheerio('div.search_main_box').each(function () {
+ const novelName = loadedCheerio(this).find('div.search_title > a').text();
+ const novelCover = loadedCheerio(this)
+ .find('div.search_img > img')
+ .attr('src');
- let novelUrl = $(this).find('div.search_title > a').attr('href');
+ let novelUrl = loadedCheerio(this)
+ .find('div.search_title > a')
+ .attr('href');
novelUrl = novelUrl.split('/');
novelUrl = novelUrl[4] + '-' + novelUrl[5];
@@ -40,7 +44,7 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novel = {};
@@ -52,27 +56,30 @@ const parseNovelAndChapters = async novelUrl => {
novel.novelUrl = novelUrl;
- novel.novelName = $('div.fic_title').text();
+ novel.novelName = loadedCheerio('div.fic_title').text();
- novel.novelCover = $('div.fic_image > img').attr('src');
+ novel.novelCover = loadedCheerio('div.fic_image > img').attr('src');
- novel.summary = $('div.wi_fic_desc').text();
+ novel.summary = loadedCheerio('div.wi_fic_desc').text();
novel.genre = '';
- $('span.wi_fic_genre')
+ loadedCheerio('span.wi_fic_genre')
.find('span')
.each(function (res) {
- novel.genre += $(this).text() + ',';
+ novel.genre += loadedCheerio(this).text() + ',';
});
if (novel.genre) {
novel.genre = novel.genre.slice(0, -1);
}
- novel.status = $('span.rnd_stats').next().text().includes('Ongoing')
+ novel.status = loadedCheerio('span.rnd_stats')
+ .next()
+ .text()
+ .includes('Ongoing')
? 'Ongoing'
: 'Completed';
- novel.author = $('span.auth_name_fic').text();
+ novel.author = loadedCheerio('span.auth_name_fic').text();
let formData = new FormData();
formData.append('action', 'wi_getreleases_pagination');
@@ -88,15 +95,15 @@ const parseNovelAndChapters = async novelUrl => {
);
const text = await data.text();
- $ = cheerio.load(text);
+ loadedCheerio = cheerio.load(text);
let novelChapters = [];
- $('.toc_w').each(function (result) {
- const chapterName = $(this).find('.toc_a').text();
- const releaseDate = $(this).find('.fic_date_pub').text();
+ loadedCheerio('.toc_w').each(function () {
+ const chapterName = loadedCheerio(this).find('.toc_a').text();
+ const releaseDate = loadedCheerio(this).find('.fic_date_pub').text();
- const chapterUrl = $(this).find('a').attr('href').split('/')[6];
+ const chapterUrl = loadedCheerio(this).find('a').attr('href').split('/')[6];
// .replace("/novel/" + novelUrl + "/", "");
novelChapters.push({
@@ -117,11 +124,11 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
- let chapterName = $('div.chapter-title').text();
+ let chapterName = loadedCheerio('div.chapter-title').text();
- let chapterText = $('div.chp_raw').html();
+ let chapterText = loadedCheerio('div.chp_raw').html();
const chapter = {
sourceId: 35,
novelUrl,
@@ -140,15 +147,19 @@ const searchNovels = async searchTerm => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('div.search_main_box').each(function (result) {
- const novelName = $(this).find('div.search_title > a').text();
- const novelCover = $(this).find('div.search_img > img').attr('src');
+ loadedCheerio('div.search_main_box').each(function () {
+ const novelName = loadedCheerio(this).find('div.search_title > a').text();
+ const novelCover = loadedCheerio(this)
+ .find('div.search_img > img')
+ .attr('src');
- let novelUrl = $(this).find('div.search_title > a').attr('href');
+ let novelUrl = loadedCheerio(this)
+ .find('div.search_title > a')
+ .attr('href');
novelUrl = novelUrl.split('/');
novelUrl = novelUrl[4] + '-' + novelUrl[5];
diff --git a/src/sources/en/tapread.js b/src/sources/en/tapread.js
index 78b5c713..3ff510d3 100644
--- a/src/sources/en/tapread.js
+++ b/src/sources/en/tapread.js
@@ -2,10 +2,10 @@ import cheerio from 'react-native-cheerio';
const baseUrl = 'http://www.tapread.com';
-let headers = new Headers({
- 'User-Agent':
- "'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36",
-});
+// let headers = new Headers({
+// 'User-Agent':
+// "'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36",
+// });
const popularNovels = async page => {
let totalPages = 0;
@@ -13,14 +13,14 @@ const popularNovels = async page => {
const result = await fetch(baseUrl);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.section-item[data-classify="1"]').each(function (result) {
- const novelName = $(this).find('.book-name').text();
- const novelCover = 'http:' + $(this).find('img').attr('src');
- let novelUrl = $(this).attr('data-id');
+ loadedCheerio('.section-item[data-classify="1"]').each(function () {
+ const novelName = loadedCheerio(this).find('.book-name').text();
+ const novelCover = 'http:' + loadedCheerio(this).find('img').attr('src');
+ let novelUrl = loadedCheerio(this).attr('data-id');
const novel = {
sourceId: 17,
@@ -38,12 +38,12 @@ const popularNovels = async page => {
const parseNovelAndChapters = async novelUrl => {
const url = `${baseUrl}/book/detail/${novelUrl}`;
- console.log(url);
+ // console.log(url);
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novel = {};
@@ -55,17 +55,17 @@ const parseNovelAndChapters = async novelUrl => {
novel.novelUrl = novelUrl;
- novel.novelName = $('.book-name').text();
+ novel.novelName = loadedCheerio('.book-name').text();
- novel.novelCover = 'http:' + $('div.book-img > img').attr('src');
+ novel.novelCover = 'http:' + loadedCheerio('div.book-img > img').attr('src');
- novel.genre = $('div.book-catalog > span.txt').text();
+ novel.genre = loadedCheerio('div.book-catalog > span.txt').text();
- novel.status = $('div.book-state > span.txt').text();
+ novel.status = loadedCheerio('div.book-state > span.txt').text();
- novel.author = $('div.author > span.name').text();
+ novel.author = loadedCheerio('div.author > span.name').text();
- novel.summary = $('div.content > p.desc').text();
+ novel.summary = loadedCheerio('div.content > p.desc').text();
const getChapters = async novelId => {
const chapterListUrl = 'http://www.tapread.com/ajax/book/contents';
diff --git a/src/sources/en/travistranslations.js b/src/sources/en/travistranslations.js
index bdf7ea76..d5f44d7e 100644
--- a/src/sources/en/travistranslations.js
+++ b/src/sources/en/travistranslations.js
@@ -18,14 +18,15 @@ const popularNovels = async page => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.group').each(function () {
- const novelName = $(this).find('h3').text();
- const novelCover = 'https://' + $(this).find('img').attr('data-src');
- const novelUrl = $(this).find(' a').attr('href');
+ loadedCheerio('.group').each(function () {
+ const novelName = loadedCheerio(this).find('h3').text();
+ const novelCover =
+ 'https://' + loadedCheerio(this).find('img').attr('data-src');
+ const novelUrl = loadedCheerio(this).find(' a').attr('href');
const novel = {
sourceId,
@@ -46,41 +47,48 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novel = {sourceId, sourceName, url, novelUrl};
- novel.novelName = $('h1').text().trim();
+ novel.novelName = loadedCheerio('h1').text().trim();
- novel.novelCover = 'https://' + $('img.object-cover').attr('data-src');
+ novel.novelCover =
+ 'https://' + loadedCheerio('img.object-cover').attr('data-src');
- novel.summary = $('div[property=description]').text().trim();
+ novel.summary = loadedCheerio('div[property=description]').text().trim();
novel.genre = '';
- $('div.flex.flex-col.mt-3.text-center > ul > li').each(function () {
- novel.genre +=
- $(this)
- .text()
- .replace(/[\t\n]/g, '') + ',';
- });
- $('div.header-stats > span').each(function () {
- if ($(this).find('small').text() === 'Status') {
- novel.status = $(this).find('strong').text();
+ loadedCheerio('div.flex.flex-col.mt-3.text-center > ul > li').each(
+ function () {
+ novel.genre +=
+ loadedCheerio(this)
+ .text()
+ .replace(/[\t\n]/g, '') + ',';
+ },
+ );
+ loadedCheerio('div.header-stats > span').each(function () {
+ if (loadedCheerio(this).find('small').text() === 'Status') {
+ novel.status = loadedCheerio(this).find('strong').text();
}
});
novel.genre = novel.genre.slice(0, -1);
- novel.author = $('.author > a > span').text();
+ novel.author = loadedCheerio('.author > a > span').text();
let novelChapters = [];
- $('.tab_content > ul.grid')
+ loadedCheerio('.tab_content > ul.grid')
.find('li')
.each(function () {
- const chapterName = $(this).find('span').first().text().trim();
+ const chapterName = loadedCheerio(this)
+ .find('span')
+ .first()
+ .text()
+ .trim();
const releaseDate = null;
- const chapterUrl = $(this).find('a').attr('href');
+ const chapterUrl = loadedCheerio(this).find('a').attr('href');
novelChapters.push({chapterName, releaseDate, chapterUrl});
});
@@ -94,9 +102,9 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(chapterUrl);
let body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
- const chapterId = $('input[name=id]').attr('value');
+ const chapterId = loadedCheerio('input[name=id]').attr('value');
const url = 'https://travistranslations.com/wp-json/wp/v2/posts/' + chapterId;
@@ -123,14 +131,15 @@ const searchNovels = async searchTerm => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.group').each(function () {
- const novelName = $(this).find('h3').text();
- const novelCover = 'https://' + $(this).find('img').attr('data-src');
- const novelUrl = $(this).find(' a').attr('href');
+ loadedCheerio('.group').each(function () {
+ const novelName = loadedCheerio(this).find('h3').text();
+ const novelCover =
+ 'https://' + loadedCheerio(this).find('img').attr('data-src');
+ const novelUrl = loadedCheerio(this).find(' a').attr('href');
const novel = {
sourceId,
diff --git a/src/sources/en/vipnovel.js b/src/sources/en/vipnovel.js
index 1de46ca6..0b3a4678 100644
--- a/src/sources/en/vipnovel.js
+++ b/src/sources/en/vipnovel.js
@@ -9,15 +9,15 @@ const popularNovels = async page => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.page-item-detail').each(function (result) {
- const novelName = $(this).find('.h5 > a').text();
- const novelCover = $(this).find('img').attr('src');
+ loadedCheerio('.page-item-detail').each(function () {
+ const novelName = loadedCheerio(this).find('.h5 > a').text();
+ const novelCover = loadedCheerio(this).find('img').attr('src');
- let novelUrl = $(this).find('.h5 > a').attr('href');
+ let novelUrl = loadedCheerio(this).find('.h5 > a').attr('href');
novelUrl = novelUrl.replace(`${baseUrl}vipnovel/`, '');
const novel = {
@@ -36,12 +36,12 @@ const popularNovels = async page => {
const parseNovelAndChapters = async novelUrl => {
const url = `${baseUrl}vipnovel/${novelUrl}`;
- console.log(url);
+ // console.log(url);
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novel = {};
@@ -53,19 +53,19 @@ const parseNovelAndChapters = async novelUrl => {
novel.novelUrl = novelUrl;
- novel.novelName = $('.post-title > h3')
+ novel.novelName = loadedCheerio('.post-title > h3')
.text()
.replace(/[\t\n]/g, '')
.trim();
- novel.novelCover = $('.summary_image > a > img').attr('src');
- $('.post-content_item').each(function (result) {
- detailName = $(this)
+ novel.novelCover = loadedCheerio('.summary_image > a > img').attr('src');
+ loadedCheerio('.post-content_item').each(function () {
+ let detailName = loadedCheerio(this)
.find('.summary-heading > h5')
.text()
.replace(/[\t\n]/g, '')
.trim();
- detail = $(this)
+ let detail = loadedCheerio(this)
.find('.summary-content')
.text()
.replace(/[\t\n]/g, '')
@@ -84,9 +84,11 @@ const parseNovelAndChapters = async novelUrl => {
}
});
- $('.summary__content > p').first().remove();
+ loadedCheerio('.summary__content > p').first().remove();
- let novelSummary = $('.description-summary > div.summary__content')
+ let novelSummary = loadedCheerio(
+ '.description-summary > div.summary__content',
+ )
.text()
.replace('Synopsis', '');
@@ -94,24 +96,27 @@ const parseNovelAndChapters = async novelUrl => {
let novelChapters = [];
- $('.wp-manga-chapter').each(function (result) {
- const chapterName = $(this)
+ loadedCheerio('.wp-manga-chapter').each(function () {
+ const chapterName = loadedCheerio(this)
.find('a')
.text()
.replace(/[\t\n]/g, '')
.trim();
- const releaseDate = $(this)
+ const releaseDate = loadedCheerio(this)
.find('span')
.text()
.replace(/[\t\n]/g, '')
.trim();
- const chapterUrl = $(this).find('a').attr('href').replace(url, '');
+ const chapterUrl = loadedCheerio(this)
+ .find('a')
+ .attr('href')
+ .replace(url, '');
const chapter = {chapterName, releaseDate, chapterUrl};
- console.log(chapterUrl);
+ // console.log(chapterUrl);
novelChapters.push(chapter);
});
@@ -124,20 +129,20 @@ const parseNovelAndChapters = async novelUrl => {
const parseChapter = async (novelUrl, chapterUrl) => {
const url = baseUrl + 'vipnovel/' + novelUrl + chapterUrl;
- console.log(url);
+ // console.log(url);
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
- let chapterName = $('.text-center').text();
+ let chapterName = loadedCheerio('.text-center').text();
if (!chapterName) {
- chapterName = $('.text-left > div> h3').text();
+ chapterName = loadedCheerio('.text-left > div> h3').text();
}
- let chapterText = $('.text-left').html();
+ let chapterText = loadedCheerio('.text-left').html();
const chapter = {
sourceId: 10,
novelUrl,
@@ -155,15 +160,15 @@ const searchNovels = async searchTerm => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.c-tabs-item__content').each(function (result) {
- const novelName = $(this).find('h4 > a').text();
- const novelCover = $(this).find('img').attr('src');
+ loadedCheerio('.c-tabs-item__content').each(function () {
+ const novelName = loadedCheerio(this).find('h4 > a').text();
+ const novelCover = loadedCheerio(this).find('img').attr('src');
- let novelUrl = $(this).find('h4 > a').attr('href');
+ let novelUrl = loadedCheerio(this).find('h4 > a').attr('href');
novelUrl = novelUrl.replace(`${baseUrl}vipnovel/`, '');
const novel = {
diff --git a/src/sources/en/wlnupdates.js b/src/sources/en/wlnupdates.js
index 642bcbad..6cdad57a 100644
--- a/src/sources/en/wlnupdates.js
+++ b/src/sources/en/wlnupdates.js
@@ -23,19 +23,20 @@ const popularNovels = async page => {
});
const body = await result.text();
- const $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
const novels = [];
- $('table').find('tr').first().remove();
+ loadedCheerio('table').find('tr').first().remove();
- $('tr').each(function (res) {
+ loadedCheerio('tr').each(function (res) {
const novelCover =
'https://github.com/LNReader/lnreader-sources/blob/main/src/coverNotAvailable.jpg?raw=true';
- const novelName = $(this).find('td > a').text();
+ const novelName = loadedCheerio(this).find('td > a').text();
const novelUrl =
- 'https://www.wlnupdates.com' + $(this).find('td > a').attr('href');
+ 'https://www.wlnupdates.com' +
+ loadedCheerio(this).find('td > a').attr('href');
const novel = {
sourceId,
@@ -59,7 +60,7 @@ const parseNovelAndChapters = async novelUrl => {
});
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novel = {
sourceId,
@@ -68,47 +69,53 @@ const parseNovelAndChapters = async novelUrl => {
novelUrl,
};
- novel.novelName = $('h2').text();
+ novel.novelName = loadedCheerio('h2').text();
novel.novelCover =
'https://github.com/LNReader/lnreader-sources/blob/main/src/coverNotAvailable.jpg?raw=true';
- novel.author = $('.multiitem#author')
+ novel.author = loadedCheerio('.multiitem#author')
.text()
.trim()
.replace(/[\t\n]/g, '');
- novel.genre = $('.multiitem#genre')
+ novel.genre = loadedCheerio('.multiitem#genre')
.text()
.trim()
.replace(/[\t\n]/g, '');
novel.status = Status.UNKNOWN;
- let summary = $('#description').text().trim();
+ let summary = loadedCheerio('#description').text().trim();
novel.summary = summary;
let novelChapters = [];
- $('#release-entry').each(function () {
+ loadedCheerio('#release-entry').each(function () {
let chapterName;
- if ($(this).find('td.numeric').length > 1) {
+ if (loadedCheerio(this).find('td.numeric').length > 1) {
chapterName =
'Volume ' +
- $(this).find(' td:nth-child(3)').text().trim() +
+ loadedCheerio(this).find(' td:nth-child(3)').text().trim() +
' Chapter ' +
- $(this).find(' td:nth-child(4)').text().trim();
- } else if ($(this).find('td.numeric').length > 0) {
- chapterName = 'Chapter ' + $(this).find('td.numeric').text().trim();
+ loadedCheerio(this).find(' td:nth-child(4)').text().trim();
+ } else if (loadedCheerio(this).find('td.numeric').length > 0) {
+ chapterName =
+ 'Chapter ' + loadedCheerio(this).find('td.numeric').text().trim();
} else {
- chapterName = $(this).find('td.postfix').text().trim();
+ chapterName = loadedCheerio(this).find('td.postfix').text().trim();
}
- const releaseDate = $(this).find('.release-entry-cell').text().trim();
+ const releaseDate = loadedCheerio(this)
+ .find('.release-entry-cell')
+ .text()
+ .trim();
- const chapterUrl = $(this).find('td:nth-child(1) > a').attr('href');
+ const chapterUrl = loadedCheerio(this)
+ .find('td:nth-child(1) > a')
+ .attr('href');
novelChapters.push({chapterName, releaseDate, chapterUrl});
});
@@ -144,16 +151,17 @@ const searchNovels = async searchTerm => {
});
const body = await res.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('tr').each(function (res) {
+ loadedCheerio('tr').each(function () {
const novelCover =
'https://github.com/LNReader/lnreader-sources/blob/main/src/coverNotAvailable.jpg?raw=true';
- const novelName = $(this).find('td > a').text();
+ const novelName = loadedCheerio(this).find('td > a').text();
const novelUrl =
- 'https://www.wlnupdates.com' + $(this).find('td > a').attr('href');
+ 'https://www.wlnupdates.com' +
+ loadedCheerio(this).find('td > a').attr('href');
const novel = {
sourceId,
diff --git a/src/sources/en/woopread.js b/src/sources/en/woopread.js
index acf7b216..87c58d5b 100644
--- a/src/sources/en/woopread.js
+++ b/src/sources/en/woopread.js
@@ -9,15 +9,15 @@ const popularNovels = async page => {
const result = await fetch(url);
const body = await result.text();
- const $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.page-item-detail').each(function () {
- const novelName = $(this).find('.h5 > a').text();
- const novelCover = $(this).find('img').attr('data-src');
+ loadedCheerio('.page-item-detail').each(function () {
+ const novelName = loadedCheerio(this).find('.h5 > a').text();
+ const novelCover = loadedCheerio(this).find('img').attr('data-src');
- let novelUrl = $(this).find('.h5 > a').attr('href');
+ let novelUrl = loadedCheerio(this).find('.h5 > a').attr('href');
novelUrl = novelUrl.replace(baseUrl + 'series/', '');
const novel = {
@@ -39,7 +39,7 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- let $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novel = {};
@@ -51,16 +51,19 @@ const parseNovelAndChapters = async novelUrl => {
novel.novelUrl = novelUrl;
- novel.novelName = $('.post-title > h1')
+ novel.novelName = loadedCheerio('.post-title > h1')
.text()
.replace(/[\t\n]/g, '')
.trim();
- novel.novelCover = $('.summary_image > a > img').attr('data-src');
+ novel.novelCover = loadedCheerio('.summary_image > a > img').attr('data-src');
- $('.post-content_item').each(function () {
- const detailName = $(this).find('.summary-heading > h5').text().trim();
- const detail = $(this).find('.summary-content').text().trim();
+ loadedCheerio('.post-content_item').each(function () {
+ const detailName = loadedCheerio(this)
+ .find('.summary-heading > h5')
+ .text()
+ .trim();
+ const detail = loadedCheerio(this).find('.summary-content').text().trim();
switch (detailName) {
case 'Genre(s)':
@@ -74,9 +77,11 @@ const parseNovelAndChapters = async novelUrl => {
break;
}
});
- $('.description-summary > div.summary__content').find('em').remove();
+ loadedCheerio('.description-summary > div.summary__content')
+ .find('em')
+ .remove();
- novel.summary = $('.description-summary > div.summary__content')
+ novel.summary = loadedCheerio('.description-summary > div.summary__content')
.text()
.trim();
@@ -86,12 +91,19 @@ const parseNovelAndChapters = async novelUrl => {
const data = await fetch(`${url}ajax/chapters/`, {method: 'POST'});
const text = await data.text();
- $ = cheerio.load(text);
+ loadedCheerio = cheerio.load(text);
- $('.wp-manga-chapter.free-chap').each(function () {
- const chapterName = $(this).find('a').text().trim();
- const releaseDate = $(this).find('span').text().replace('Free', '').trim();
- const chapterUrl = $(this).find('a').attr('href').replace(url, '');
+ loadedCheerio('.wp-manga-chapter.free-chap').each(function () {
+ const chapterName = loadedCheerio(this).find('a').text().trim();
+ const releaseDate = loadedCheerio(this)
+ .find('span')
+ .text()
+ .replace('Free', '')
+ .trim();
+ const chapterUrl = loadedCheerio(this)
+ .find('a')
+ .attr('href')
+ .replace(url, '');
novelChapters.push({chapterName, releaseDate, chapterUrl});
});
@@ -107,11 +119,11 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url);
const body = await result.text();
- const $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
- const chapterName = $('h1#chapter-heading').text();
+ const chapterName = loadedCheerio('h1#chapter-heading').text();
- let chapterText = $('.reading-content').html();
+ let chapterText = loadedCheerio('.reading-content').html();
const chapter = {
sourceId: 21,
@@ -130,15 +142,15 @@ const searchNovels = async searchTerm => {
const result = await fetch(url);
const body = await result.text();
- const $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.c-tabs-item__content').each(function () {
- const novelName = $(this).find('.h4 > a').text();
- const novelCover = $(this).find('img').attr('src');
+ loadedCheerio('.c-tabs-item__content').each(function () {
+ const novelName = loadedCheerio(this).find('.h4 > a').text();
+ const novelCover = loadedCheerio(this).find('img').attr('src');
- let novelUrl = $(this).find('.h4 > a').attr('href');
+ let novelUrl = loadedCheerio(this).find('.h4 > a').attr('href');
novelUrl = novelUrl.replace(`${baseUrl}series/`, '');
const novel = {
diff --git a/src/sources/en/wuxiablog.js b/src/sources/en/wuxiablog.js
index e4a7320c..4935119d 100644
--- a/src/sources/en/wuxiablog.js
+++ b/src/sources/en/wuxiablog.js
@@ -13,21 +13,21 @@ const popularNovels = async page => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('div.panel-body > table')
+ loadedCheerio('div.panel-body > table')
.find('tr')
.each(function () {
- const novelName = $(this).find('td.novel').text();
+ const novelName = loadedCheerio(this).find('td.novel').text();
if (novelName) {
- const novelId = $(this).find('td:nth-child(1)').text();
+ const novelId = loadedCheerio(this).find('td:nth-child(1)').text();
const novelCover = baseUrl + '/data/image/' + novelId + '.jpg';
- let novelUrl = $(this)
+ let novelUrl = loadedCheerio(this)
.find('td.novel > a')
.attr('href')
.replace('/novel/', '');
@@ -52,7 +52,7 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novel = {
sourceId,
@@ -61,31 +61,39 @@ const parseNovelAndChapters = async novelUrl => {
novelUrl,
};
- novel.novelName = $(
+ novel.novelName = loadedCheerio(
'body > div.container-fluid.text-center > div.row.content > div.col-sm-8.text-left > div:nth-child(6) > div.panel-heading.clearfix > h4',
).text();
- novel.novelCover = $('img[itemprop="image"]').attr('src');
+ novel.novelCover = loadedCheerio('img[itemprop="image"]').attr('src');
- novel.author = $(
+ novel.author = loadedCheerio(
'div.col-md-6 > div > div:nth-child(2) > div > div:nth-child(2) > a',
).text();
- novel.genre = $('div.row > div.col-md-6 > div > a:nth-child(4)').text();
+ novel.genre = loadedCheerio(
+ 'div.row > div.col-md-6 > div > a:nth-child(4)',
+ ).text();
- novel.summary = $('div[itemprop="description"]').find('p').text().trim();
+ novel.summary = loadedCheerio('div[itemprop="description"]')
+ .find('p')
+ .text()
+ .trim();
let novelChapters = [];
- $('table#chplist > #chapters > tr').each(function () {
- const chapterName = $(this).find('a').text();
+ loadedCheerio('table#chplist > #chapters > tr').each(function () {
+ const chapterName = loadedCheerio(this).find('a').text();
- const releaseDate = $(this)
+ const releaseDate = loadedCheerio(this)
.find('td:nth-child(2)')
.text()
.replace(/-/g, '/');
- const chapterUrl = $(this).find('a').attr('href').replace(url, '');
+ const chapterUrl = loadedCheerio(this)
+ .find('a')
+ .attr('href')
+ .replace(url, '');
const chapter = {
chapterName,
@@ -99,22 +107,22 @@ const parseNovelAndChapters = async novelUrl => {
let moreChaptersUrl =
baseUrl +
'temphtml/_tempChapterList_all_' +
- $('div#more').attr('data-nid') +
+ loadedCheerio('div#more').attr('data-nid') +
'.html';
let moreChapters = await fetch(moreChaptersUrl);
let moreChaptersString = await moreChapters.text();
- $ = cheerio.load(moreChaptersString);
+ loadedCheerio = cheerio.load(moreChaptersString);
- $('a').each(function () {
- const chapterName = $(this).text();
+ loadedCheerio('a').each(function () {
+ const chapterName = loadedCheerio(this).text();
- const releaseDate = $(this)[0]
+ const releaseDate = loadedCheerio(this)[0]
.nextSibling.nodeValue.replace(/-/g, '/')
.trim();
- const chapterUrl = $(this).attr('href').replace(url, '');
+ const chapterUrl = loadedCheerio(this).attr('href').replace(url, '');
const chapter = {
chapterName,
@@ -136,13 +144,13 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
- let chapterName = $('div.panel-body.article').find('h4').text();
+ let chapterName = loadedCheerio('div.panel-body.article').find('h4').text();
- $('ul.pager').remove();
+ loadedCheerio('ul.pager').remove();
- let chapterText = $('div.panel-body.article')
+ let chapterText = loadedCheerio('div.panel-body.article')
.html()
.replace(/(.*?)<\/span>/g, '');
@@ -163,19 +171,19 @@ const searchNovels = async searchTerm => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('#table')
+ loadedCheerio('#table')
.find('tr')
.each(function () {
- const novelName = $(this).find('a').text().trim();
+ const novelName = loadedCheerio(this).find('a').text().trim();
if (novelName) {
- const novelCover = $(this).find('img').attr('src');
+ const novelCover = loadedCheerio(this).find('img').attr('src');
- let novelUrl = $(this)
+ let novelUrl = loadedCheerio(this)
.find('a')
.attr('href')
.replace(baseUrl + 'novel/', '');
diff --git a/src/sources/en/wuxiacity.js b/src/sources/en/wuxiacity.js
index 6df815d0..f7699025 100644
--- a/src/sources/en/wuxiacity.js
+++ b/src/sources/en/wuxiacity.js
@@ -15,14 +15,17 @@ const popularNovels = async page => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.section-item.card').each(function () {
- const novelName = $(this).find('.book-name').text();
- const novelCover = $(this).find('img').attr('src');
- const novelUrl = $(this).find('a').attr('href').replace('/book/', '');
+ loadedCheerio('.section-item.card').each(function () {
+ const novelName = loadedCheerio(this).find('.book-name').text();
+ const novelCover = loadedCheerio(this).find('img').attr('src');
+ const novelUrl = loadedCheerio(this)
+ .find('a')
+ .attr('href')
+ .replace('/book/', '');
const novel = {
sourceId,
@@ -43,7 +46,7 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- let $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novel = {
sourceId,
@@ -52,27 +55,30 @@ const parseNovelAndChapters = async novelUrl => {
novelUrl,
};
- novel.novelName = $('h1.book-name').text();
+ novel.novelName = loadedCheerio('h1.book-name').text();
- novel.novelCover = $('div.book-img > img').attr('src');
+ novel.novelCover = loadedCheerio('div.book-img > img').attr('src');
- novel.author = $('dl.author > dd').text();
+ novel.author = loadedCheerio('dl.author > dd').text();
- novel.genre = $('.book-generes').text().trim();
+ novel.genre = loadedCheerio('.book-generes').text().trim();
- novel.summary = $('.book-synopsis').text().replace('Synopsis', '').trim();
+ novel.summary = loadedCheerio('.book-synopsis')
+ .text()
+ .replace('Synopsis', '')
+ .trim();
const chapterListUrl = `${baseUrl}book/${novelUrl}/chapter-list`;
const chaptersHtml = await fetch(chapterListUrl);
const chapterHtmlToString = await chaptersHtml.text();
- $ = cheerio.load(chapterHtmlToString);
+ loadedCheerio = cheerio.load(chapterHtmlToString);
let novelChapters = [];
- $('ul.chapters > li').each(function () {
- const chapterName = $(this)
+ loadedCheerio('ul.chapters > li').each(function () {
+ const chapterName = loadedCheerio(this)
.find('.chapter-name')
.text()
.trim()
@@ -80,7 +86,7 @@ const parseNovelAndChapters = async novelUrl => {
let releaseDate = new Date();
- let timeAgo = $(this).find('.chapter-time').text();
+ let timeAgo = loadedCheerio(this).find('.chapter-time').text();
timeAgo = timeAgo.replace('one', 1);
@@ -96,7 +102,11 @@ const parseNovelAndChapters = async novelUrl => {
releaseDate = moment(releaseDate).format('MM/DD/YY');
- const chapterUrl = $(this).find('a').attr('href').split('/').pop();
+ const chapterUrl = loadedCheerio(this)
+ .find('a')
+ .attr('href')
+ .split('/')
+ .pop();
const chapter = {
chapterName,
@@ -118,11 +128,11 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
- let chapterName = $('.chapter-name').text();
+ let chapterName = loadedCheerio('.chapter-name').text();
- let chapterText = $('.chapter-content').html();
+ let chapterText = loadedCheerio('.chapter-content').html();
const chapter = {
sourceId,
novelUrl,
@@ -140,15 +150,18 @@ const searchNovels = async searchTerm => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.section-item').each(function () {
- const novelName = $(this).find('.book-name').text().trim();
- const novelCover = $(this).find('img').attr('src');
+ loadedCheerio('.section-item').each(function () {
+ const novelName = loadedCheerio(this).find('.book-name').text().trim();
+ const novelCover = loadedCheerio(this).find('img').attr('src');
- let novelUrl = $(this).find('a').attr('href').replace('/book/', '');
+ let novelUrl = loadedCheerio(this)
+ .find('a')
+ .attr('href')
+ .replace('/book/', '');
const novel = {
sourceId,
diff --git a/src/sources/en/wuxiaworld.js b/src/sources/en/wuxiaworld.js
index d9cca545..be3d8b58 100644
--- a/src/sources/en/wuxiaworld.js
+++ b/src/sources/en/wuxiaworld.js
@@ -33,7 +33,7 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novel = {};
@@ -45,31 +45,31 @@ const parseNovelAndChapters = async novelUrl => {
novel.novelUrl = novelUrl;
- novel.novelName = $('h2').text();
+ novel.novelName = loadedCheerio('h2').text();
- novel.novelCover = $('img.img-thumbnail').attr('src');
+ novel.novelCover = loadedCheerio('img.img-thumbnail').attr('src');
- novel.summary = $('h3')
+ novel.summary = loadedCheerio('h3')
.filter(function () {
- return $(this).text().trim() === 'Synopsis';
+ return loadedCheerio(this).text().trim() === 'Synopsis';
})
.next()
.text()
.trim();
- novel.author = $('div > dt')
+ novel.author = loadedCheerio('div > dt')
.filter(function () {
- return $(this).text().trim() === 'Author:';
+ return loadedCheerio(this).text().trim() === 'Author:';
})
.next()
.text();
let genres = [];
- $('.genres')
+ loadedCheerio('.genres')
.find('div')
.each(function (res) {
- genres.push($(this).find('a').text());
+ genres.push(loadedCheerio(this).find('a').text());
});
novel.genre = genres.join(',');
@@ -78,19 +78,19 @@ const parseNovelAndChapters = async novelUrl => {
novel.status = null;
- novel.status = $('div.fr-view.pt-10').text().includes('Complete')
+ novel.status = loadedCheerio('div.fr-view.pt-10').text().includes('Complete')
? 'Completed'
: 'Ongoing';
let novelChapters = [];
- $('.chapter-item').each(function (result) {
- let chapterName = $(this).text();
+ loadedCheerio('.chapter-item').each(function () {
+ let chapterName = loadedCheerio(this).text();
chapterName = chapterName.replace(/[\t\n]/g, '');
const releaseDate = null;
- let chapterUrl = $(this).find('a').attr('href');
+ let chapterUrl = loadedCheerio(this).find('a').attr('href');
chapterUrl = chapterUrl.replace(`/novel/${novelUrl}/`, '');
const chapter = {
@@ -113,16 +113,16 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
- $('.chapter-nav').remove();
+ loadedCheerio('.chapter-nav').remove();
- let chapterName = $('#sidebar-toggler-container').next().text();
+ let chapterName = loadedCheerio('#sidebar-toggler-container').next().text();
chapterName = chapterName.replace(/[\t\n]/g, '');
- $('#chapter-content > script').remove();
+ loadedCheerio('#chapter-content > script').remove();
- let chapterText = $('#chapter-content').html();
+ let chapterText = loadedCheerio('#chapter-content').html();
const chapter = {
sourceId: 7,
@@ -136,7 +136,7 @@ const parseChapter = async (novelUrl, chapterUrl) => {
};
const searchNovels = async searchTerm => {
- const searchUrl = `https://www.wuxiaworld.com/api/novels/search?query=`;
+ const searchUrl = 'https://www.wuxiaworld.com/api/novels/search?query=';
const url = `${searchUrl}${searchTerm}`;
diff --git a/src/sources/en/wuxiaworldcloud.js b/src/sources/en/wuxiaworldcloud.js
index 429da792..b1917a31 100644
--- a/src/sources/en/wuxiaworldcloud.js
+++ b/src/sources/en/wuxiaworldcloud.js
@@ -9,19 +9,19 @@ const popularNovels = async page => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('div.col-novel-main > div.list-novel > .row').each(function (result) {
- let novelUrl = $(this)
+ loadedCheerio('div.col-novel-main > div.list-novel > .row').each(function () {
+ let novelUrl = loadedCheerio(this)
.find('h3.novel-title > a')
.attr('href')
.replace(baseUrl + 'novel/', '');
novelUrl = `${novelUrl}/`;
- const novelName = $(this).find('h3.novel-title > a').text();
- const novelCover = $(this).find('img').attr('src');
+ const novelName = loadedCheerio(this).find('h3.novel-title > a').text();
+ const novelCover = loadedCheerio(this).find('img').attr('src');
const novel = {
sourceId: 20,
@@ -42,7 +42,7 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novel = {};
@@ -54,22 +54,22 @@ const parseNovelAndChapters = async novelUrl => {
novel.novelUrl = novelUrl;
- novel.novelName = $('div.book > img').attr('alt');
+ novel.novelName = loadedCheerio('div.book > img').attr('alt');
- novel.novelCover = $('div.book > img').attr('src');
+ novel.novelCover = loadedCheerio('div.book > img').attr('src');
- novel.summary = $('div.desc-text').text().trim();
+ novel.summary = loadedCheerio('div.desc-text').text().trim();
- novel.author = $('div.info > div > h3')
+ novel.author = loadedCheerio('div.info > div > h3')
.filter(function () {
- return $(this).text().trim() === 'Author:';
+ return loadedCheerio(this).text().trim() === 'Author:';
})
.siblings()
.text();
- novel.genre = $('div.info > div')
+ novel.genre = loadedCheerio('div.info > div')
.filter(function () {
- return $(this).find('h3').text().trim() === 'Genre:';
+ return loadedCheerio(this).find('h3').text().trim() === 'Genre:';
})
.text()
.replace('Genre:', '')
@@ -77,30 +77,30 @@ const parseNovelAndChapters = async novelUrl => {
novel.artist = null;
- novel.status = $('div.info > div')
+ novel.status = loadedCheerio('div.info > div')
.filter(function () {
- return $(this).find('h3').text().trim() === 'Status:';
+ return loadedCheerio(this).find('h3').text().trim() === 'Status:';
})
.text()
.replace('Status:', '')
.replace(/\s/g, '');
- const novelId = $('#rating').attr('data-novel-id');
+ const novelId = loadedCheerio('#rating').attr('data-novel-id');
- const getChapters = async novelId => {
- const chapterListUrl = baseUrl + 'ajax/chapter-option?novelId=' + novelId;
+ const getChapters = async id => {
+ const chapterListUrl = baseUrl + 'ajax/chapter-option?novelId=' + id;
const data = await fetch(chapterListUrl);
const chapters = await data.text();
- $ = cheerio.load(chapters);
+ loadedCheerio = cheerio.load(chapters);
let novelChapters = [];
- $('select > option').each(function (result) {
- let chapterName = $(this).text();
+ loadedCheerio('select > option').each(function () {
+ let chapterName = loadedCheerio(this).text();
let releaseDate = null;
- let chapterUrl = $(this).attr('value');
+ let chapterUrl = loadedCheerio(this).attr('value');
chapterUrl = chapterUrl.replace(baseUrl, '');
novelChapters.push({
@@ -125,10 +125,10 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
- const chapterName = $('.chr-title').attr('title');
- let chapterText = $('#chr-content').html();
+ const chapterName = loadedCheerio('.chr-title').attr('title');
+ let chapterText = loadedCheerio('#chr-content').html();
const chapter = {
sourceId: 20,
novelUrl,
@@ -141,26 +141,26 @@ const parseChapter = async (novelUrl, chapterUrl) => {
};
const searchNovels = async searchTerm => {
- const searchUrl = `http://wuxiaworld.cloud/search?keyword=`;
+ const searchUrl = 'http://wuxiaworld.cloud/search?keyword=';
const url = `${searchUrl}${searchTerm}`;
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('div.col-novel-main > div.list-novel > .row').each(function (result) {
- let novelUrl = $(this)
+ loadedCheerio('div.col-novel-main > div.list-novel > .row').each(function () {
+ let novelUrl = loadedCheerio(this)
.find('h3.novel-title > a')
.attr('href')
.replace(baseUrl + 'novel/', '');
novelUrl = `${novelUrl}/`;
- const novelName = $(this).find('h3.novel-title > a').text();
- const novelCover = $(this).find('img').attr('src');
+ const novelName = loadedCheerio(this).find('h3.novel-title > a').text();
+ const novelCover = loadedCheerio(this).find('img').attr('src');
const novel = {
sourceId: 20,
diff --git a/src/sources/en/wuxiaworldco.js b/src/sources/en/wuxiaworldco.js
index 17207f7f..382c8c36 100644
--- a/src/sources/en/wuxiaworldco.js
+++ b/src/sources/en/wuxiaworldco.js
@@ -7,15 +7,15 @@ const popularNovels = async page => {
const result = await fetch(baseUrl);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.section-item').each(function (result) {
- const novelName = $(this).find('.book-name').text();
- const novelCover = $(this).find('img').attr('src');
+ loadedCheerio('.section-item').each(function () {
+ const novelName = loadedCheerio(this).find('.book-name').text();
+ const novelCover = loadedCheerio(this).find('img').attr('src');
- let novelUrl = $(this).find('a').attr('href').slice(1);
+ let novelUrl = loadedCheerio(this).find('a').attr('href').slice(1);
const novel = {
sourceId: 16,
@@ -36,7 +36,7 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novel = {};
@@ -48,25 +48,25 @@ const parseNovelAndChapters = async novelUrl => {
novel.novelUrl = novelUrl;
- novel.novelName = $('.book-name').text();
+ novel.novelName = loadedCheerio('.book-name').text();
- novel.novelCover = $('div.book-img > img').attr('src');
+ novel.novelCover = loadedCheerio('div.book-img > img').attr('src');
- novel.genre = $('div.book-catalog > span.txt').text();
+ novel.genre = loadedCheerio('div.book-catalog > span.txt').text();
- novel.status = $('div.book-state > span.txt').text();
+ novel.status = loadedCheerio('div.book-state > span.txt').text();
- novel.author = $('div.author > span.name').text();
+ novel.author = loadedCheerio('div.author > span.name').text();
- novelSummary = $('div.content > p.desc').html();
+ const novelSummary = loadedCheerio('div.content > p.desc').html();
novel.summary = novelSummary.trim();
let novelChapters = [];
- $('.chapter-item').each(function (result) {
- const chapterName = $(this).find('.chapter-name').text();
+ loadedCheerio('.chapter-item').each(function () {
+ const chapterName = loadedCheerio(this).find('.chapter-name').text();
const releaseDate = null;
- const chapterUrl = $(this).attr('href').split('/')[2];
+ const chapterUrl = loadedCheerio(this).attr('href').split('/')[2];
novelChapters.push({
chapterName,
@@ -86,10 +86,10 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
- const chapterName = $('h1.chapter-title').text();
- let chapterText = $('div.chapter-entity').html();
+ const chapterName = loadedCheerio('h1.chapter-title').text();
+ let chapterText = loadedCheerio('div.chapter-entity').html();
const chapter = {
sourceId: 16,
novelUrl,
@@ -107,17 +107,17 @@ const searchNovels = async searchTerm => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.list-item').each(function (result) {
- $(this).find('font').remove();
+ loadedCheerio('.list-item').each(function () {
+ loadedCheerio(this).find('font').remove();
- const novelName = $(this).find('.book-name').text();
- const novelCover = $(this).find('img').attr('src');
+ const novelName = loadedCheerio(this).find('.book-name').text();
+ const novelCover = loadedCheerio(this).find('img').attr('src');
- let novelUrl = $(this).find('a').attr('href').slice(1);
+ let novelUrl = loadedCheerio(this).find('a').attr('href').slice(1);
const novel = {
sourceId: 16,
diff --git a/src/sources/en/wuxiaworldsite.js b/src/sources/en/wuxiaworldsite.js
index ac72f53e..0708b5c8 100644
--- a/src/sources/en/wuxiaworldsite.js
+++ b/src/sources/en/wuxiaworldsite.js
@@ -5,7 +5,7 @@ const searchUrl = 'https://wuxiaworldsite.co/search/';
const popularNovels = async page => {
let totalPages = 222;
- const url = `https://wuxiaworldsite.co/ajax-story-power.ajax`;
+ const url = 'https://wuxiaworldsite.co/ajax-story-power.ajax';
const formData = new FormData();
formData.append('page', page);
@@ -19,16 +19,16 @@ const popularNovels = async page => {
const result = await fetch(url, {method: 'POST', body: formData});
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.a_item').each((i, el) => {
- const novelName = $(el).find('a').attr('title');
- const novelCover = baseUrl + $(el).find('a > img').attr('src');
+ loadedCheerio('.a_item').each((i, el) => {
+ const novelName = loadedCheerio(el).find('a').attr('title');
+ const novelCover = baseUrl + loadedCheerio(el).find('a > img').attr('src');
- let novelUrl = $(el).find('.name_views > a').attr('href');
- novelId = novelUrl.split('/');
+ let novelUrl = loadedCheerio(el).find('.name_views > a').attr('href');
+ const novelId = novelUrl.split('/');
novelUrl = novelId[2] + '/';
const novel = {
@@ -50,9 +50,9 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
- $('.category_list').remove();
+ loadedCheerio('.category_list').remove();
let novel = {};
@@ -64,20 +64,20 @@ const parseNovelAndChapters = async novelUrl => {
novel.novelUrl = novelUrl;
- novel.novelName = $('.content-reading > h1').text().trim();
+ novel.novelName = loadedCheerio('.content-reading > h1').text().trim();
- novel.novelCover = baseUrl + $('.img-read> img').attr('src');
+ novel.novelCover = baseUrl + loadedCheerio('.img-read> img').attr('src');
- novel.summary = $('.story-introduction-content').text();
+ novel.summary = loadedCheerio('.story-introduction-content').text();
- novel.author = $('.content-reading > p').text().trim();
+ novel.author = loadedCheerio('.content-reading > p').text().trim();
novel.artist = null;
novel.genre = '';
- $('.a_tag_item').each((i, el) => {
- novel.genre += $(el).text() + ',';
+ loadedCheerio('.a_tag_item').each((i, el) => {
+ novel.genre += loadedCheerio(el).text() + ',';
});
novel.genre = novel.genre.split(',');
@@ -87,31 +87,31 @@ const parseNovelAndChapters = async novelUrl => {
novel.genre = novel.genre.join(',');
- const novelID = $('.show-more-list').attr('data-id');
+ const novelID = loadedCheerio('.show-more-list').attr('data-id');
- const getChapters = async novelID => {
- const chapterListUrl = baseUrl + '/get-full-list.ajax?id=' + novelID;
+ const getChapters = async id => {
+ const chapterListUrl = baseUrl + '/get-full-list.ajax?id=' + id;
const data = await fetch(chapterListUrl);
const chapters = await data.text();
- $ = cheerio.load(chapters);
+ loadedCheerio = cheerio.load(chapters);
let novelChapters = [];
- $('.new-update-content').each((i, el) => {
- let chapterName = $(el).text().split(/\t+/);
+ loadedCheerio('.new-update-content').each((i, el) => {
+ let chapterName = loadedCheerio(el).text().split(/\t+/);
const releaseDate = chapterName.pop();
chapterName = chapterName[0];
- let chapterUrl = $(el).attr('href');
+ let chapterUrl = loadedCheerio(el).attr('href');
chapterUrl = chapterUrl.split('/').pop();
- const novel = {
+ const chapter = {
chapterName,
releaseDate,
chapterUrl,
};
- novelChapters.push(novel);
+ novelChapters.push(chapter);
});
return novelChapters;
};
@@ -127,10 +127,10 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
- let chapterName = $('h1.text-center.heading_read').text();
- let chapterText = $('.content-story').html();
+ let chapterName = loadedCheerio('h1.text-center.heading_read').text();
+ let chapterText = loadedCheerio('.content-story').html();
novelUrl += '/';
chapterUrl += '/';
@@ -152,15 +152,15 @@ const searchNovels = async searchTerm => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.a_item').each((i, el) => {
- const novelName = $(el).find('.name_views > a').attr('title');
- const novelCover = baseUrl + $(el).find('a > img').attr('src');
- let novelUrl = $(el).find('.name_views > a').attr('href');
- novelId = novelUrl.split('/');
+ loadedCheerio('.a_item').each((i, el) => {
+ const novelName = loadedCheerio(el).find('.name_views > a').attr('title');
+ const novelCover = baseUrl + loadedCheerio(el).find('a > img').attr('src');
+ let novelUrl = loadedCheerio(el).find('.name_views > a').attr('href');
+ const novelId = novelUrl.split('/');
novelUrl = novelId[2] + '/';
const novel = {
diff --git a/src/sources/es/einherjarproject.js b/src/sources/es/einherjarproject.js
index e60cd2f2..48a891a5 100644
--- a/src/sources/es/einherjarproject.js
+++ b/src/sources/es/einherjarproject.js
@@ -9,15 +9,15 @@ const popularNovels = async page => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novels = [];
- $('.wp-block-media-text').each(function (result) {
- const novelName = $(this).find('a').text();
- const novelCover = $(this).find('img').attr('src');
+ loadedCheerio('.wp-block-media-text').each(function () {
+ const novelName = loadedCheerio(this).find('a').text();
+ const novelCover = loadedCheerio(this).find('img').attr('src');
- let novelUrl = $(this)
+ let novelUrl = loadedCheerio(this)
.find('.wp-block-media-text__content')
.find('a')
.attr('href');
@@ -42,7 +42,7 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novel = {};
@@ -54,44 +54,59 @@ const parseNovelAndChapters = async novelUrl => {
novel.novelUrl = novelUrl;
- novel.novelName = $('h1').text();
+ novel.novelName = loadedCheerio('h1').text();
- novel.novelCover = $('img').attr('src');
+ novel.novelCover = loadedCheerio('img').attr('src');
- $('.wp-block-columns')
+ loadedCheerio('.wp-block-columns')
.find('li')
- .each(function (result) {
- if ($(this).text().includes('Autor:')) {
- novel.author = $(this).text().replace('Autor:', '').slice(0, -1);
+ .each(function () {
+ if (loadedCheerio(this).text().includes('Autor:')) {
+ novel.author = loadedCheerio(this)
+ .text()
+ .replace('Autor:', '')
+ .slice(0, -1);
}
- if ($(this).text().includes('Ilustrador: ')) {
- novel.artist = $(this).text().replace('Ilustrador: ', '').slice(0, -1);
+ if (loadedCheerio(this).text().includes('Ilustrador: ')) {
+ novel.artist = loadedCheerio(this)
+ .text()
+ .replace('Ilustrador: ', '')
+ .slice(0, -1);
}
- if ($(this).text().includes('Estado: ')) {
- novel.status = $(this).text().replace('Estado: ', '').slice(0, -1);
+ if (loadedCheerio(this).text().includes('Estado: ')) {
+ novel.status = loadedCheerio(this)
+ .text()
+ .replace('Estado: ', '')
+ .slice(0, -1);
}
});
- novel.genre = $('.post-content > h6')
+ novel.genre = loadedCheerio('.post-content > h6')
.text()
.replace(/GÉNEROS: /, '')
.replace(/,\s/g, ',');
- let novelSummary = $('.post-content > .has-text-align-center').html();
+ let novelSummary = loadedCheerio(
+ '.post-content > .has-text-align-center',
+ ).html();
novel.summary = novelSummary.trim();
let novelChapters = [];
- $('.wp-block-media-text')
+ loadedCheerio('.wp-block-media-text')
.find('p')
- .each(function (result) {
- if ($(this).find('a').text()) {
- const chapterName = $(this).text();
+ .each(function () {
+ if (loadedCheerio(this).find('a').text()) {
+ const chapterName = loadedCheerio(this).text();
const releaseDate = null;
- let chapterUrl = $(this).find('a').attr('href').replace(baseUrl, '');
- if (chapterUrl.includes(novelUrl + '/'))
+ let chapterUrl = loadedCheerio(this)
+ .find('a')
+ .attr('href')
+ .replace(baseUrl, '');
+ if (chapterUrl.includes(novelUrl + '/')) {
chapterUrl = chapterUrl.replace(novelUrl + '/', '');
+ }
const chapter = {chapterName, releaseDate, chapterUrl};
@@ -110,11 +125,11 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
- let chapterName = $('h1.post-title').text();
+ let chapterName = loadedCheerio('h1.post-title').text();
- let chapterText = $('.post-content').html();
+ let chapterText = loadedCheerio('.post-content').html();
novelUrl = novelUrl + '/';
chapterUrl = chapterUrl + '/';
@@ -135,22 +150,28 @@ const searchNovels = async searchTerm => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.post-container')
+ loadedCheerio('.post-container')
.find('div.type-page')
- .each(function (result) {
- const novelName = $(this).find('.post-header').text().replace(/\n/g, '');
+ .each(function () {
+ const novelName = loadedCheerio(this)
+ .find('.post-header')
+ .text()
+ .replace(/\n/g, '');
if (
!novelName.includes('EPUBs') &&
!novelName.includes('Proyectos Activos') &&
!novelName.includes('Chapter')
) {
- const novelCover = $(this).find('img').attr('src');
+ const novelCover = loadedCheerio(this).find('img').attr('src');
- let novelUrl = $(this).find('a').attr('href').replace(baseUrl, '');
+ let novelUrl = loadedCheerio(this)
+ .find('a')
+ .attr('href')
+ .replace(baseUrl, '');
const novel = {
sourceId: 25,
diff --git a/src/sources/es/hasutl.js b/src/sources/es/hasutl.js
index 0df9fec2..7c95d488 100644
--- a/src/sources/es/hasutl.js
+++ b/src/sources/es/hasutl.js
@@ -9,15 +9,17 @@ const popularNovels = async page => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novels = [];
- $('div.wp-block-columns').each(function (result) {
- const novelName = $(this).find('.wp-block-button').text();
- const novelCover = $(this).find('img').attr('src');
+ loadedCheerio('div.wp-block-columns').each(function () {
+ const novelName = loadedCheerio(this).find('.wp-block-button').text();
+ const novelCover = loadedCheerio(this).find('img').attr('src');
- let novelUrl = $(this).find('.wp-block-button > a').attr('href');
+ let novelUrl = loadedCheerio(this)
+ .find('.wp-block-button > a')
+ .attr('href');
novelUrl = novelUrl.replace(baseUrl, '');
const novel = {
@@ -39,7 +41,7 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novel = {};
@@ -51,13 +53,13 @@ const parseNovelAndChapters = async novelUrl => {
novel.novelUrl = novelUrl;
- novel.novelName = $('.post-header').text();
+ novel.novelName = loadedCheerio('.post-header').text();
- novel.novelCover = $('.featured-media > img').attr('src');
+ novel.novelCover = loadedCheerio('.featured-media > img').attr('src');
- let details = $('.post-content').find('p').html();
+ let details = loadedCheerio('.post-content').find('p').html();
- detailName = details.match(/(.|\n)*?<\/strong>/g);
+ const detailName = details.match(/(.|\n)*?<\/strong>/g);
details = details.match(/<\/strong>(.|\n)*?
/g);
details = details.map(detail => detail.replace(/<\/strong>|
/g, ''));
@@ -75,19 +77,19 @@ const parseNovelAndChapters = async novelUrl => {
}
});
- let novelSummary = $('.post-content').find('p').html();
+ let novelSummary = loadedCheerio('.post-content').find('p').html();
novel.summary = novelSummary;
let novelChapters = [];
- $('.wp-block-media-text__content')
+ loadedCheerio('.wp-block-media-text__content')
.find('a')
- .each(function (result) {
- const chapterName = $(this).text().trim();
+ .each(function () {
+ const chapterName = loadedCheerio(this).text().trim();
const releaseDate = null;
- let chapterUrl = $(this).attr('href').split('/');
+ let chapterUrl = loadedCheerio(this).attr('href').split('/');
chapterUrl = chapterUrl[chapterUrl.length - 2];
const chapter = {chapterName, releaseDate, chapterUrl};
@@ -106,11 +108,11 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
- let chapterName = $('.post-title').text();
+ let chapterName = loadedCheerio('.post-title').text();
- let chapterText = $('.post-content').html();
+ let chapterText = loadedCheerio('.post-content').html();
novelUrl = novelUrl + '/';
chapterUrl = chapterUrl;
@@ -131,20 +133,20 @@ const searchNovels = async searchTerm => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novels = [];
- $('.post-container ').each(function (result) {
- const novelName = $(this).find('.post-header').text();
+ loadedCheerio('.post-container ').each(function () {
+ const novelName = loadedCheerio(this).find('.post-header').text();
if (
!novelName.includes('Cap') &&
!novelName.includes('Vol') &&
!novelName.includes('Light Novels')
) {
- const novelCover = $(this).find('img').attr('src');
+ const novelCover = loadedCheerio(this).find('img').attr('src');
- let novelUrl = $(this).find('a').attr('href');
+ let novelUrl = loadedCheerio(this).find('a').attr('href');
novelUrl = novelUrl.replace(baseUrl, '');
const novel = {
diff --git a/src/sources/es/novelasligera.js b/src/sources/es/novelasligera.js
index ca3657bd..4d90a22d 100644
--- a/src/sources/es/novelasligera.js
+++ b/src/sources/es/novelasligera.js
@@ -10,18 +10,18 @@ const popularNovels = async page => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novels = [];
- $('.elementor-column').each(function (result) {
- const novelName = $(this)
+ loadedCheerio('.elementor-column').each(function () {
+ const novelName = loadedCheerio(this)
.find('.widget-image-caption.wp-caption-text')
.text();
if (novelName) {
- const novelCover = $(this).find('img').attr('src');
+ const novelCover = loadedCheerio(this).find('img').attr('src');
- let novelUrl = $(this).find('a').attr('href');
+ let novelUrl = loadedCheerio(this).find('a').attr('href');
novelUrl = novelUrl.replace(baseUrl, '');
novelUrl = novelUrl.replace('novela/', '');
@@ -42,12 +42,12 @@ const popularNovels = async page => {
const parseNovelAndChapters = async novelUrl => {
const url = baseUrl + 'novela/' + novelUrl;
- console.log(url);
+ // console.log(url);
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novel = {};
@@ -59,40 +59,47 @@ const parseNovelAndChapters = async novelUrl => {
novel.novelUrl = novelUrl;
- novel.novelName = $('h1').text();
+ novel.novelName = loadedCheerio('h1').text();
- novel.novelCover = $('.elementor-widget-container').find('img').attr('src');
+ novel.novelCover = loadedCheerio('.elementor-widget-container')
+ .find('img')
+ .attr('src');
- $('.elementor-row')
+ loadedCheerio('.elementor-row')
.find('p')
- .each(function (result) {
- if ($(this).text().includes('Autor:')) {
- novel.author = $(this).text().replace('Autor:', '').trim();
+ .each(function () {
+ if (loadedCheerio(this).text().includes('Autor:')) {
+ novel.author = loadedCheerio(this).text().replace('Autor:', '').trim();
}
- if ($(this).text().includes('Estado:')) {
- novel.status = $(this).text().replace('Estado: ', '').trim();
+ if (loadedCheerio(this).text().includes('Estado:')) {
+ novel.status = loadedCheerio(this)
+ .text()
+ .replace('Estado: ', '')
+ .trim();
}
- if ($(this).text().includes('Género:')) {
- $(this).find('span').remove();
- novel.genre = $(this).text().replace(/,\s/g, ',');
+ if (loadedCheerio(this).text().includes('Género:')) {
+ loadedCheerio(this).find('span').remove();
+ novel.genre = loadedCheerio(this).text().replace(/,\s/g, ',');
}
});
novel.artist = null;
- novel.novelSummary = $('.elementor-text-editor.elementor-clearfix').text();
+ novel.novelSummary = loadedCheerio(
+ '.elementor-text-editor.elementor-clearfix',
+ ).text();
let novelChapters = [];
- $('.elementor-accordion-item').remove();
+ loadedCheerio('.elementor-accordion-item').remove();
- $('.elementor-tab-content')
+ loadedCheerio('.elementor-tab-content')
.find('li')
- .each(function (result) {
- const chapterName = $(this).text();
+ .each(function () {
+ const chapterName = loadedCheerio(this).text();
const releaseDate = null;
- const chapterUrl = $(this)
+ const chapterUrl = loadedCheerio(this)
.find('a')
.attr('href')
.replace(baseUrl + 'novela/', '');
@@ -109,22 +116,22 @@ const parseNovelAndChapters = async novelUrl => {
const parseChapter = async (novelUrl, chapterUrl) => {
const url = baseUrl + 'novela/' + chapterUrl;
- console.log(url);
+ // console.log(url);
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
- let chapterName = $('h1.entry-title').text();
+ let chapterName = loadedCheerio('h1.entry-title').text();
- $('.osny-nightmode.osny-nightmode--left').remove();
- $('.code-block.code-block-1').remove();
- $('.adsb30').remove();
- $('.saboxplugin-wrap').remove();
- $('.wp-post-navigation').remove();
+ loadedCheerio('.osny-nightmode.osny-nightmode--left').remove();
+ loadedCheerio('.code-block.code-block-1').remove();
+ loadedCheerio('.adsb30').remove();
+ loadedCheerio('.saboxplugin-wrap').remove();
+ loadedCheerio('.wp-post-navigation').remove();
- let chapterText = $('.entry-content').html();
+ let chapterText = loadedCheerio('.entry-content').html();
chapterText = htmlToText(chapterText, {preserveNewlines: true});
const chapter = {
@@ -140,18 +147,18 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const searchNovels = async searchTerm => {
const url = baseUrl + '?s=' + searchTerm + '&post_type=wp-manga';
- console.log(url);
+ // console.log(url);
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novels = [];
- $('.inside-article').each(function (result) {
- const novelCover = $(this).find('img').attr('src');
- let novelUrl = $(this).find('a').attr('href').split('/')[4];
+ loadedCheerio('.inside-article').each(function () {
+ const novelCover = loadedCheerio(this).find('img').attr('src');
+ let novelUrl = loadedCheerio(this).find('a').attr('href').split('/')[4];
let novelName;
diff --git a/src/sources/es/novelawuxia.js b/src/sources/es/novelawuxia.js
index 50ce8594..9973bce3 100644
--- a/src/sources/es/novelawuxia.js
+++ b/src/sources/es/novelawuxia.js
@@ -21,22 +21,22 @@ const popularNovels = async page => {
});
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novels = [];
- $('.post-body.entry-content')
+ loadedCheerio('.post-body.entry-content')
.find('a')
- .each(function (result) {
- let novelName = $(this)
+ .each(function () {
+ let novelName = loadedCheerio(this)
.attr('href')
.split('/')
.pop()
.replace('.html', '');
novelName = getNovelName(novelName);
- const novelCover = $(this).find('img').attr('src');
+ const novelCover = loadedCheerio(this).find('img').attr('src');
- let novelUrl = $(this).attr('href');
+ let novelUrl = loadedCheerio(this).attr('href');
novelUrl = novelUrl.replace(`${baseUrl}p/`, '') + '/';
const novel = {
@@ -58,7 +58,7 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novel = {};
@@ -70,16 +70,16 @@ const parseNovelAndChapters = async novelUrl => {
novel.novelUrl = novelUrl;
- novel.novelName = $('h1.post-title').text().trim();
+ novel.novelName = loadedCheerio('h1.post-title').text().trim();
- novel.novelCover = $('div.separator').find('a').attr('href');
+ novel.novelCover = loadedCheerio('div.separator').find('a').attr('href');
novel.artist = '';
novel.status = '';
- $('div > b').each(function (result) {
- const detailName = $(this).text();
- let detail = $(this)[0].nextSibling;
+ loadedCheerio('div > b').each(function () {
+ const detailName = loadedCheerio(this).text();
+ let detail = loadedCheerio(this)[0].nextSibling;
if (detailName && detail) {
detail = detail.nodeValue;
@@ -99,21 +99,26 @@ const parseNovelAndChapters = async novelUrl => {
let novelChapters = [];
- $('div').each(function (result) {
- const detailName = $(this).text();
+ loadedCheerio('div').each(function () {
+ const detailName = loadedCheerio(this).text();
if (detailName.includes('Sinopsis')) {
novel.summary =
- $(this).next().text() !== ''
- ? $(this).next().text().replace('Sinopsis', '').trim()
- : $(this).next().next().text().replace('Sinopsis', '').trim();
+ loadedCheerio(this).next().text() !== ''
+ ? loadedCheerio(this).next().text().replace('Sinopsis', '').trim()
+ : loadedCheerio(this)
+ .next()
+ .next()
+ .text()
+ .replace('Sinopsis', '')
+ .trim();
}
if (detailName.includes('Lista de Capítulos')) {
- $(this)
+ loadedCheerio(this)
.find('a')
.each(function (res) {
- const chapterName = $(this).text();
- let chapterUrl = $(this).attr('href');
+ const chapterName = loadedCheerio(this).text();
+ let chapterUrl = loadedCheerio(this).attr('href');
const releaseDate = null;
if (
@@ -147,11 +152,11 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
- let chapterName = $('h1.post-title').text().trim();
+ let chapterName = loadedCheerio('h1.post-title').text().trim();
- let chapterText = $('.post-body.entry-content').html();
+ let chapterText = loadedCheerio('.post-body.entry-content').html();
novelUrl = novelUrl + '/';
chapterUrl = chapterUrl + '/';
@@ -172,12 +177,12 @@ const searchNovels = async searchTerm => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novels = [];
- $('.date-outer').each(function (result) {
- let novelName = $(this)
+ loadedCheerio('.date-outer').each(function () {
+ let novelName = loadedCheerio(this)
.find('a')
.attr('href')
.split('/')
diff --git a/src/sources/es/oasistranslations.js b/src/sources/es/oasistranslations.js
index 46030ea2..e824b3dc 100644
--- a/src/sources/es/oasistranslations.js
+++ b/src/sources/es/oasistranslations.js
@@ -10,18 +10,18 @@ const popularNovels = async page => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novels = [];
- $('.menu-item-1819')
+ loadedCheerio('.menu-item-1819')
.find('.sub-menu > li')
- .each(function (result) {
- const novelName = $(this).text();
+ .each(function () {
+ const novelName = loadedCheerio(this).text();
if (!novelName.match(/Activas|Finalizadas|Dropeadas/)) {
- const novelCover = $(this).find('img').attr('src');
+ const novelCover = loadedCheerio(this).find('img').attr('src');
- let novelUrl = $(this).find('a').attr('href');
+ let novelUrl = loadedCheerio(this).find('a').attr('href');
novelUrl = novelUrl.split('/');
novelUrl = novelUrl[novelUrl.length - 2] + '/';
@@ -45,7 +45,7 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novel = {};
@@ -57,16 +57,16 @@ const parseNovelAndChapters = async novelUrl => {
novel.novelUrl = novelUrl;
- novel.novelName = $('h1.entry-title')
+ novel.novelName = loadedCheerio('h1.entry-title')
.text()
.replace(/[\t\n]/g, '')
.trim();
- novel.novelCover = $('img[loading="lazy"]').attr('src');
+ novel.novelCover = loadedCheerio('img[loading="lazy"]').attr('src');
- $('.entry-content > p').each(function (res) {
- if ($(this).text().includes('Autor')) {
- let details = $(this).html();
+ loadedCheerio('.entry-content > p').each(function (res) {
+ if (loadedCheerio(this).text().includes('Autor')) {
+ let details = loadedCheerio(this).html();
details = details.match(/<\/strong>(.|\n)*?
/g);
details = details.map(detail =>
detail.replace(/|<\/strong>|
|:\s/g, ''),
@@ -86,13 +86,13 @@ const parseNovelAndChapters = async novelUrl => {
let novelChapters = [];
// if ($(".entry-content").find("li").length) {
- $('.entry-content')
+ loadedCheerio('.entry-content')
.find('a')
- .each(function (result) {
- let chapterUrl = $(this).attr('href');
+ .each(function () {
+ let chapterUrl = loadedCheerio(this).attr('href');
if (chapterUrl && chapterUrl.includes(baseUrl)) {
- const chapterName = $(this).text();
+ const chapterName = loadedCheerio(this).text();
const releaseDate = null;
chapterUrl = chapterUrl.split('/');
@@ -134,13 +134,13 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
- let chapterName = $('h1.entry-title').text();
+ let chapterName = loadedCheerio('h1.entry-title').text();
- $('div#jp-post-flair').remove();
+ loadedCheerio('div#jp-post-flair').remove();
- let chapterText = $('.entry-content').html();
+ let chapterText = loadedCheerio('.entry-content').html();
novelUrl = novelUrl + '/';
chapterUrl = chapterUrl + '/';
@@ -163,17 +163,17 @@ const searchNovels = async searchTerm => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novels = [];
- $('.menu-item-1819')
+ loadedCheerio('.menu-item-1819')
.find('.sub-menu > li')
- .each(function (result) {
- const novelName = $(this).text();
+ .each(function () {
+ const novelName = loadedCheerio(this).text();
if (!novelName.match(/Activas|Finalizadas|Dropeadas/)) {
- const novelCover = $(this).find('img').attr('src');
+ const novelCover = loadedCheerio(this).find('img').attr('src');
- let novelUrl = $(this).find('a').attr('href');
+ let novelUrl = loadedCheerio(this).find('a').attr('href');
novelUrl = novelUrl.split('/');
novelUrl = novelUrl[novelUrl.length - 2] + '/';
diff --git a/src/sources/es/tunovelaligera.js b/src/sources/es/tunovelaligera.js
index d0efb636..811a5786 100644
--- a/src/sources/es/tunovelaligera.js
+++ b/src/sources/es/tunovelaligera.js
@@ -13,15 +13,18 @@ const popularNovels = async page => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novels = [];
- $('.page-item-detail').each(function () {
- const novelName = $(this).find('.h5 > a').text();
- const novelCover = $(this).find('img').attr('src');
+ loadedCheerio('.page-item-detail').each(function () {
+ const novelName = loadedCheerio(this).find('.h5 > a').text();
+ const novelCover = loadedCheerio(this).find('img').attr('src');
- let novelUrl = $(this).find('.h5 > a').attr('href').split('/')[4];
+ let novelUrl = loadedCheerio(this)
+ .find('.h5 > a')
+ .attr('href')
+ .split('/')[4];
novelUrl += '/';
const novel = {
@@ -43,24 +46,27 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novel = {sourceId, sourceName, url};
novel.novelUrl = novelUrl;
- $('.manga-title-badges').remove();
+ loadedCheerio('.manga-title-badges').remove();
- novel.novelName = $('.post-title > h1').text().trim();
+ novel.novelName = loadedCheerio('.post-title > h1').text().trim();
- novelCover = $('.summary_image > a > img');
+ let novelCover = loadedCheerio('.summary_image > a > img');
novel.novelCover =
novelCover.attr('data-src') || novelCover.attr('src') || defaultCoverUri;
- $('.post-content_item').each(function () {
- const detailName = $(this).find('.summary-heading > h5').text().trim();
- const detail = $(this).find('.summary-content').text().trim();
+ loadedCheerio('.post-content_item').each(function () {
+ const detailName = loadedCheerio(this)
+ .find('.summary-heading > h5')
+ .text()
+ .trim();
+ const detail = loadedCheerio(this).find('.summary-content').text().trim();
switch (detailName) {
case 'Generos':
@@ -78,13 +84,13 @@ const parseNovelAndChapters = async novelUrl => {
}
});
- novel.summary = $('div.summary__content > p').text().trim();
+ novel.summary = loadedCheerio('div.summary__content > p').text().trim();
let novelChapters = [];
const novelId =
- $('.rating-post-id').attr('value') ||
- $('#manga-chapters-holder').attr('data-id');
+ loadedCheerio('.rating-post-id').attr('value') ||
+ loadedCheerio('#manga-chapters-holder').attr('data-id');
let formData = new FormData();
formData.append('action', 'manga_get_chapters');
@@ -99,18 +105,18 @@ const parseNovelAndChapters = async novelUrl => {
);
const text = await data.text();
- $ = cheerio.load(text);
+ loadedCheerio = cheerio.load(text);
- $('.wp-manga-chapter').each(function (result) {
- chapterName = $(this)
+ loadedCheerio('.wp-manga-chapter').each(function () {
+ const chapterName = loadedCheerio(this)
.find('a')
.text()
.replace(/[\t\n]/g, '')
.trim();
- releaseDate = $(this).find('span').text().trim();
+ const releaseDate = loadedCheerio(this).find('span').text().trim();
- chapterUrl = $(this).find('a').attr('href').split('/');
+ let chapterUrl = loadedCheerio(this).find('a').attr('href').split('/');
chapterUrl[6]
? (chapterUrl = chapterUrl[5] + '/' + chapterUrl[6])
@@ -130,11 +136,11 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
- let chapterName = $('h1#chapter-heading').text();
+ let chapterName = loadedCheerio('h1#chapter-heading').text();
- let chapterText = $('.text-left').html();
+ let chapterText = loadedCheerio('.text-left').html();
novelUrl = novelUrl + '/';
const chapter = {
@@ -154,15 +160,15 @@ const searchNovels = async searchTerm => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novels = [];
- $('.c-tabs-item__content').each(function (result) {
- const novelName = $(this).find('.h4 > a').text();
- const novelCover = $(this).find('img').attr('src');
+ loadedCheerio('.c-tabs-item__content').each(function () {
+ const novelName = loadedCheerio(this).find('.h4 > a').text();
+ const novelCover = loadedCheerio(this).find('img').attr('src');
- let novelUrl = $(this).find('.h4 > a').attr('href');
+ let novelUrl = loadedCheerio(this).find('.h4 > a').attr('href');
novelUrl = novelUrl.replace(`${baseUrl}novelas/`, '');
const novel = {
diff --git a/src/sources/es/yuukitls.js b/src/sources/es/yuukitls.js
index 4f1e4eca..dde7a8c6 100644
--- a/src/sources/es/yuukitls.js
+++ b/src/sources/es/yuukitls.js
@@ -9,17 +9,17 @@ const popularNovels = async page => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novels = [];
- $('.menu-item-2869')
+ loadedCheerio('.menu-item-2869')
.find('.menu-item.menu-item-type-post_type.menu-item-object-post')
- .each(function (result) {
- const novelName = $(this).text();
- const novelCover = $(this).find('img').attr('src');
+ .each(function () {
+ const novelName = loadedCheerio(this).text();
+ const novelCover = loadedCheerio(this).find('img').attr('src');
- let novelUrl = $(this).find('a').attr('href');
+ let novelUrl = loadedCheerio(this).find('a').attr('href');
novelUrl = novelUrl.split('/');
novelUrl = novelUrl[novelUrl.length - 2] + '/';
@@ -42,7 +42,7 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novel = {};
@@ -54,44 +54,50 @@ const parseNovelAndChapters = async novelUrl => {
novel.novelUrl = novelUrl;
- novel.novelName = $('h1.entry-title')
+ novel.novelName = loadedCheerio('h1.entry-title')
.text()
.replace(/[\t\n]/g, '')
.trim();
- novel.novelCover = $('img[loading="lazy"]').attr('src');
+ novel.novelCover = loadedCheerio('img[loading="lazy"]').attr('src');
- $('.entry-content')
+ loadedCheerio('.entry-content')
.find('div')
- .each(function (result) {
- if ($(this).text().includes('Escritor:')) {
- novel.author = $(this).text().replace('Escritor: ', '').trim();
+ .each(function () {
+ if (loadedCheerio(this).text().includes('Escritor:')) {
+ novel.author = loadedCheerio(this)
+ .text()
+ .replace('Escritor: ', '')
+ .trim();
}
- if ($(this).text().includes('Ilustrador:')) {
- novel.artist = $(this).text().replace('Ilustrador: ', '').trim();
+ if (loadedCheerio(this).text().includes('Ilustrador:')) {
+ novel.artist = loadedCheerio(this)
+ .text()
+ .replace('Ilustrador: ', '')
+ .trim();
}
- if ($(this).text().includes('Género:')) {
- novel.genre = $(this)
+ if (loadedCheerio(this).text().includes('Género:')) {
+ novel.genre = loadedCheerio(this)
.text()
.replace(/Género: |\s/g, '');
}
- if ($(this).text().includes('Sinopsis:')) {
- novel.summary = $(this).next().text();
+ if (loadedCheerio(this).text().includes('Sinopsis:')) {
+ novel.summary = loadedCheerio(this).next().text();
}
});
let novelChapters = [];
- if ($('.entry-content').find('li').length) {
- $('.entry-content')
+ if (loadedCheerio('.entry-content').find('li').length) {
+ loadedCheerio('.entry-content')
.find('li')
- .each(function (result) {
- let chapterUrl = $(this).find('a').attr('href');
+ .each(function () {
+ let chapterUrl = loadedCheerio(this).find('a').attr('href');
if (chapterUrl && chapterUrl.includes(baseUrl)) {
- const chapterName = $(this).text();
+ const chapterName = loadedCheerio(this).text();
const releaseDate = null;
chapterUrl = chapterUrl.split('/');
@@ -103,13 +109,13 @@ const parseNovelAndChapters = async novelUrl => {
}
});
} else {
- $('.entry-content')
+ loadedCheerio('.entry-content')
.find('p')
- .each(function (result) {
- let chapterUrl = $(this).find('a').attr('href');
+ .each(function () {
+ let chapterUrl = loadedCheerio(this).find('a').attr('href');
if (chapterUrl && chapterUrl.includes(baseUrl)) {
- const chapterName = $(this).text();
+ const chapterName = loadedCheerio(this).text();
const releaseDate = null;
chapterUrl = chapterUrl.split('/');
@@ -133,11 +139,11 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
- let chapterName = $('h3').text();
+ let chapterName = loadedCheerio('h3').text();
- let chapterText = $('.entry-content').html();
+ let chapterText = loadedCheerio('.entry-content').html();
novelUrl = novelUrl + '/';
chapterUrl = chapterUrl + '/';
@@ -160,17 +166,17 @@ const searchNovels = async searchTerm => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novels = [];
- $('.menu-item-2869')
+ loadedCheerio('.menu-item-2869')
.find('.menu-item.menu-item-type-post_type.menu-item-object-post')
- .each(function (result) {
- const novelName = $(this).text();
- const novelCover = $(this).find('img').attr('src');
+ .each(function () {
+ const novelName = loadedCheerio(this).text();
+ const novelCover = loadedCheerio(this).find('img').attr('src');
- let novelUrl = $(this).find('a').attr('href');
+ let novelUrl = loadedCheerio(this).find('a').attr('href');
novelUrl = novelUrl.split('/');
novelUrl = novelUrl[novelUrl.length - 2] + '/';
diff --git a/src/sources/fr/noveldeglace.js b/src/sources/fr/noveldeglace.js
index 105fa0b9..4ccb48b1 100644
--- a/src/sources/fr/noveldeglace.js
+++ b/src/sources/fr/noveldeglace.js
@@ -14,14 +14,17 @@ const popularNovels = async page => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novels = [];
- $('article').each(function () {
- const novelName = $(this).find('h2').text().trim();
- const novelCover = $(this).find('img').attr('src');
- const novelUrl = $(this).find('h2 > a').attr('href').split('/')[4];
+ loadedCheerio('article').each(function () {
+ const novelName = loadedCheerio(this).find('h2').text().trim();
+ const novelCover = loadedCheerio(this).find('img').attr('src');
+ const novelUrl = loadedCheerio(this)
+ .find('h2 > a')
+ .attr('href')
+ .split('/')[4];
const novel = {
sourceId,
@@ -42,41 +45,44 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novel = {sourceId, sourceName, url, novelUrl};
- novel.novelName = $(
+ novel.novelName = loadedCheerio(
'div.entry-content > div > strong',
)[0].nextSibling.nodeValue.trim();
- novel.novelCover = $('.su-row > div > div > img').attr('src');
+ novel.novelCover = loadedCheerio('.su-row > div > div > img').attr('src');
- novel.summary = $('div[data-title=Synopsis]').text();
+ novel.summary = loadedCheerio('div[data-title=Synopsis]').text();
- author = $(
+ const author = loadedCheerio(
'div.romans > div.project-large > div.su-row > div.su-column.su-column-size-3-4 > div > div:nth-child(3) > strong',
)[0];
novel.author = author ? author.nextSibling.nodeValue.trim() : null;
- novel.genre = $('.genre').text().replace('Genre : ', '').replace(/, /g, ',');
+ novel.genre = loadedCheerio('.genre')
+ .text()
+ .replace('Genre : ', '')
+ .replace(/, /g, ',');
let novelChapters = [];
- $('.chpt').each(function () {
- const chapterName = $(this).find('a').text().trim();
+ loadedCheerio('.chpt').each(function () {
+ const chapterName = loadedCheerio(this).find('a').text().trim();
const releaseDate = null;
- const chapterUrl = $(this).find('a').attr('href');
+ const chapterUrl = loadedCheerio(this).find('a').attr('href');
- const novel = {
+ const chapter = {
sourceId,
chapterName,
releaseDate,
chapterUrl,
};
- novelChapters.push(novel);
+ novelChapters.push(chapter);
});
novel.chapters = novelChapters;
@@ -90,10 +96,10 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
- let chapterName = $('h2.western').text();
- let chapterText = $('.chapter-content').html();
+ let chapterName = loadedCheerio('h2.western').text();
+ let chapterText = loadedCheerio('.chapter-content').html();
const chapter = {
sourceId,
@@ -112,14 +118,17 @@ const searchNovels = async searchTerm => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novels = [];
- $('article').each(function () {
- const novelName = $(this).find('h2').text().trim();
- const novelCover = $(this).find('img').attr('src');
- const novelUrl = $(this).find('h2 > a').attr('href').split('/')[4];
+ loadedCheerio('article').each(function () {
+ const novelName = loadedCheerio(this).find('h2').text().trim();
+ const novelCover = loadedCheerio(this).find('img').attr('src');
+ const novelUrl = loadedCheerio(this)
+ .find('h2 > a')
+ .attr('href')
+ .split('/')[4];
const novel = {
sourceId,
diff --git a/src/sources/helpers/htmlToText.js b/src/sources/helpers/htmlToText.js
index 6bf00604..ff4faf37 100644
--- a/src/sources/helpers/htmlToText.js
+++ b/src/sources/helpers/htmlToText.js
@@ -116,8 +116,8 @@ const htmlToText = (html, options = {}) => {
const decodeHtmlEntity = (m, n) => {
let code;
- if (n.substr(0, 1) == '#') {
- if (n.substr(1, 1) == 'x') {
+ if (n.substr(0, 1) === '#') {
+ if (n.substr(1, 1) === 'x') {
code = parseInt(n.substr(2), 16);
} else {
code = parseInt(n.substr(1), 10);
@@ -126,7 +126,7 @@ const decodeHtmlEntity = (m, n) => {
code = ENTITIES_MAP[n];
}
- return code === undefined || code === NaN
+ return code === undefined || isNaN(code)
? '&' + n + ';'
: String.fromCharCode(code);
};
diff --git a/src/sources/id/idmtlnovel.js b/src/sources/id/idmtlnovel.js
index f0a0076b..a0e92a07 100644
--- a/src/sources/id/idmtlnovel.js
+++ b/src/sources/id/idmtlnovel.js
@@ -19,15 +19,15 @@ const popularNovels = async page => {
});
const body = await result.text();
- let $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novels = [];
- $('div.box.wide').each(function () {
- const novelName = $(this).find('a.list-title').text().slice(4);
- const novelCover = $(this).find('amp-img').attr('src');
+ loadedCheerio('div.box.wide').each(function () {
+ const novelName = loadedCheerio(this).find('a.list-title').text().slice(4);
+ const novelCover = loadedCheerio(this).find('amp-img').attr('src');
- let novelUrl = $(this).find('a.list-title').attr('href');
+ let novelUrl = loadedCheerio(this).find('a.list-title').attr('href');
novelUrl = novelUrl.replace('https://id.mtlnovel.com/', '');
const novel = {
@@ -58,37 +58,37 @@ const parseNovelAndChapters = async novelUrl => {
});
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novel = {sourceId, url, novelUrl};
novel.sourceName = 'MTLNovel';
- novel.novelName = $('h1.entry-title').text();
+ novel.novelName = loadedCheerio('h1.entry-title').text();
- novel.novelCover = $('.nov-head > amp-img').attr('src');
+ novel.novelCover = loadedCheerio('.nov-head > amp-img').attr('src');
- novel.summary = $('div.desc > h2').next().text();
+ novel.summary = loadedCheerio('div.desc > h2').next().text();
- novel.author = $('tr > td')
+ novel.author = loadedCheerio('tr > td')
.filter(function () {
- return $(this).prev().text().trim() === 'Author';
+ return loadedCheerio(this).prev().text().trim() === 'Author';
})
.next()
.text()
.replace('Auhtor:', '');
- novel.status = $('tr > td')
+ novel.status = loadedCheerio('tr > td')
.filter(function () {
- return $(this).prev().text().trim() === 'Status';
+ return loadedCheerio(this).prev().text().trim() === 'Status';
})
.next()
.text()
.replace('Status:', '');
- novel.genre = $('td')
+ novel.genre = loadedCheerio('td')
.filter(function () {
- return $(this).prev().text().trim() === 'Genre';
+ return loadedCheerio(this).prev().text().trim() === 'Genre';
})
.next()
.text()
@@ -99,20 +99,20 @@ const parseNovelAndChapters = async novelUrl => {
const chapterListUrl = url + '/chapter-list/';
const getChapters = async () => {
- const result = await fetch(chapterListUrl);
- const body = await result.text();
+ const listResult = await fetch(chapterListUrl);
+ const listBody = await listResult.text();
- $ = cheerio.load(body);
+ loadedCheerio = cheerio.load(listBody);
let novelChapters = [];
- $('div.ch-list')
+ loadedCheerio('div.ch-list')
.find('a.ch-link')
- .each(function (result) {
- const chapterName = $(this).text().replace('~ ', '');
+ .each(function () {
+ const chapterName = loadedCheerio(this).text().replace('~ ', '');
const releaseDate = null;
- let chapterUrl = $(this).attr('href');
+ let chapterUrl = loadedCheerio(this).attr('href');
chapterUrl = chapterUrl.replace(
`https://id.mtlnovel.com/${novelUrl}`,
'',
@@ -138,10 +138,10 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
- const chapterName = $('h1.main-title').text();
- let chapterText = $('div.par').html();
+ const chapterName = loadedCheerio('h1.main-title').text();
+ let chapterText = loadedCheerio('div.par').html();
const chapter = {
sourceId,
novelUrl,
@@ -162,9 +162,9 @@ const searchNovels = async searchTerm => {
const res = await fetch(searchUrl);
const result = await res.text();
- $ = cheerio.load(result);
+ let loadedCheerio = cheerio.load(result);
- let body = JSON.parse($('body').text());
+ let body = JSON.parse(loadedCheerio('body').text());
let novels = [];
diff --git a/src/sources/jp/syosetu.js b/src/sources/jp/syosetu.js
index 5603cfb7..14f516d9 100644
--- a/src/sources/jp/syosetu.js
+++ b/src/sources/jp/syosetu.js
@@ -1,21 +1,19 @@
import cheerio from 'react-native-cheerio';
-import moment from 'moment';
-
-const baseUrl = 'https://syosetu.com'; // base url for syosetu.com
-
// get given page of search (if pagenum is 0 or >100 (max possible on site) see first page)
const searchUrl = (pagenum, order) => {
return `https://yomou.syosetu.com/search.php?order=${order || 'hyoka'}${
- !isNaN((pagenum = parseInt(pagenum))) // check if pagenum is a number
+ !isNaN((pagenum = parseInt(pagenum, 10))) // check if pagenum is a number
? `&p=${pagenum <= 1 || pagenum > 100 ? '1' : pagenum}` // check if pagenum is between 1 and 100
: '' // if isn't don't set ?p
}`;
};
// get the Syosetu ID of the chapter
-const getLastPartOfUrl = url =>
- (ex = /.*(?=\/)(.{2,})$/.exec(url)) ? ex[1].replace(/\//g, '') : null;
+const getLastPartOfUrl = url => {
+ let temp = /.*(?=\/)(.{2,})$/.exec(url);
+ return temp ? temp[1].replace(/\//g, '') : null;
+};
// get novelUrl from Syosetu ID
const getNovelUrl = id => `https://ncode.syosetu.com/${id}`;
@@ -36,8 +34,7 @@ const sourceName = 'Syosetu';
// there are 20 mangas per page
// this is number of pages loaded in the first "batch" of loads
-// TOOD: in-app dynamic loading on scroll
-const maxPageLoad = 3;
+// const maxPageLoad = 3;
const popularNovels = async page => {
const totalPages = 100;
@@ -129,9 +126,9 @@ const parseNovelAndChapters = async novelUrl => {
*/
// get summary for oneshot chapter
- const result = await fetch(searchUrl() + `&word=${novel.novelName}`);
- const body = await result.text();
- const summaryQuery = cheerio.load(body, {decodeEntities: false});
+ const nameResult = await fetch(searchUrl() + `&word=${novel.novelName}`);
+ const nameBody = await nameResult.text();
+ const summaryQuery = cheerio.load(nameBody, {decodeEntities: false});
const foundText = summaryQuery('.searchkekka_box')
.first()
.find('.ex')
@@ -175,17 +172,14 @@ let parseChapter = async (novelUrl, chapterUrl) => {
chapterText,
};
- if (chapterUrl === 'oneshot')
+ if (chapterUrl === 'oneshot') {
// oneshot get name
chapter.chapterName = cheerioQuery('#novel_title').text();
- else {
+ } else {
// single chapter
// get name
chapter.chapterName = cheerioQuery('.novel_subtitle').first().text();
-
- // get next/prev buttons
- const chapterButtons = cheerioQuery('#novel_contents .novel_bn').first();
}
return chapter;
@@ -197,8 +191,6 @@ let searchNovels = async searchTerm => {
// array of all the novels
let novels = [];
- let isNext = true;
-
// returns list of novels from given page
let getNovelsFromPage = async pagenumber => {
// load page
@@ -209,8 +201,6 @@ let searchNovels = async searchTerm => {
// Cheerio it!
const cheerioQuery = cheerio.load(body, {decodeEntities: false});
- if (cheerioQuery('.nextlink').length === 0) isNext = false;
-
let pageNovels = [];
// find class=searchkekka_box
cheerioQuery('.searchkekka_box').each(function (i, e) {
diff --git a/src/sources/multisrc/madara/MadaraScraper.js b/src/sources/multisrc/madara/MadaraScraper.js
index e0d3f982..cea564cf 100644
--- a/src/sources/multisrc/madara/MadaraScraper.js
+++ b/src/sources/multisrc/madara/MadaraScraper.js
@@ -20,18 +20,18 @@ class MadaraScraper {
const result = await fetch(url);
const body = await result.text();
- const $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('.manga-title-badges').remove();
+ loadedCheerio('.manga-title-badges').remove();
- $('.page-item-detail').each(function () {
- const novelName = $(this).find('.post-title').text().trim();
- let image = $(this).find('img');
+ loadedCheerio('.page-item-detail').each(function () {
+ const novelName = loadedCheerio(this).find('.post-title').text().trim();
+ let image = loadedCheerio(this).find('img');
const novelCover = image.attr('data-src') || image.attr('src');
- let novelUrl = $(this)
+ let novelUrl = loadedCheerio(this)
.find('.post-title')
.find('a')
.attr('href')
@@ -56,7 +56,7 @@ class MadaraScraper {
const result = await fetch(url);
const body = await result.text();
- let $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novel = {};
@@ -68,18 +68,21 @@ class MadaraScraper {
novel.novelUrl = novelUrl;
- $('.manga-title-badges').remove();
+ loadedCheerio('.manga-title-badges').remove();
- novel.novelName = $('.post-title > h1').text().trim();
+ novel.novelName = loadedCheerio('.post-title > h1').text().trim();
novel.novelCover =
- $('.summary_image > a > img').attr('data-src') ||
- $('.summary_image > a > img').attr('src') ||
+ loadedCheerio('.summary_image > a > img').attr('data-src') ||
+ loadedCheerio('.summary_image > a > img').attr('src') ||
defaultCoverUri;
- $('.post-content_item').each(function () {
- const detailName = $(this).find('.summary-heading > h5').text().trim();
- const detail = $(this).find('.summary-content').text().trim();
+ loadedCheerio('.post-content_item').each(function () {
+ const detailName = loadedCheerio(this)
+ .find('.summary-heading > h5')
+ .text()
+ .trim();
+ const detail = loadedCheerio(this).find('.summary-content').text().trim();
switch (detailName) {
case 'Genre(s)':
@@ -96,7 +99,7 @@ class MadaraScraper {
}
});
- novel.summary = $('div.summary__content').text().trim();
+ novel.summary = loadedCheerio('div.summary__content').text().trim();
let novelChapters = [];
@@ -115,18 +118,21 @@ class MadaraScraper {
const text = await data.text();
if (text !== '0') {
- $ = cheerio.load(text);
+ loadedCheerio = cheerio.load(text);
}
- $('.wp-manga-chapter').each(function () {
- const chapterName = $(this)
+ loadedCheerio('.wp-manga-chapter').each(function () {
+ const chapterName = loadedCheerio(this)
.find('a')
.text()
.replace(/[\t\n]/g, '')
.trim();
let releaseDate = null;
- releaseDate = $(this).find('span.chapter-release-date').text().trim();
+ releaseDate = loadedCheerio(this)
+ .find('span.chapter-release-date')
+ .text()
+ .trim();
if (releaseDate) {
releaseDate = parseMadaraDate(releaseDate);
@@ -138,7 +144,10 @@ class MadaraScraper {
releaseDate = moment().format('MMMM DD, YYYY');
}
- const chapterUrl = $(this).find('a').attr('href').split('/')[5];
+ const chapterUrl = loadedCheerio(this)
+ .find('a')
+ .attr('href')
+ .split('/')[5];
novelChapters.push({chapterName, releaseDate, chapterUrl});
});
@@ -156,11 +165,13 @@ class MadaraScraper {
const result = await fetch(url);
const body = await result.text();
- const $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
- let chapterName = $('.text-center').text() || $('#chapter-heading').text();
+ let chapterName =
+ loadedCheerio('.text-center').text() ||
+ loadedCheerio('#chapter-heading').text();
- let chapterText = $('.text-left').html();
+ let chapterText = loadedCheerio('.text-left').html();
const chapter = {
sourceId,
@@ -179,18 +190,18 @@ class MadaraScraper {
const result = await fetch(url);
const body = await result.text();
- const $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
let sourceId = this.sourceId;
- $('.c-tabs-item__content').each(function () {
- const novelName = $(this).find('.post-title').text().trim();
+ loadedCheerio('.c-tabs-item__content').each(function () {
+ const novelName = loadedCheerio(this).find('.post-title').text().trim();
- let image = $(this).find('img');
+ let image = loadedCheerio(this).find('img');
const novelCover = image.attr('data-src') || image.attr('src');
- let novelUrl = $(this)
+ let novelUrl = loadedCheerio(this)
.find('.post-title')
.find('a')
.attr('href')
diff --git a/src/sources/multisrc/wpmangastream/WPMangaStreamScraper.js b/src/sources/multisrc/wpmangastream/WPMangaStreamScraper.js
index 049777b7..68438272 100644
--- a/src/sources/multisrc/wpmangastream/WPMangaStreamScraper.js
+++ b/src/sources/multisrc/wpmangastream/WPMangaStreamScraper.js
@@ -15,16 +15,16 @@ class WPMangaStreamScraper {
const result = await fetch(url);
const body = await result.text();
- const $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
- $('article.bs').each(function () {
- const novelName = $(this).find('.ntitle').text().trim();
- let image = $(this).find('img');
+ loadedCheerio('article.bs').each(function () {
+ const novelName = loadedCheerio(this).find('.ntitle').text().trim();
+ let image = loadedCheerio(this).find('img');
const novelCover = image.attr('src');
- let novelUrl = $(this).find('a').attr('href').split('/')[4];
+ let novelUrl = loadedCheerio(this).find('a').attr('href').split('/')[4];
const novel = {
sourceId,
@@ -45,7 +45,7 @@ class WPMangaStreamScraper {
const result = await fetch(url);
const body = await result.text();
- let $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novel = {};
@@ -57,16 +57,16 @@ class WPMangaStreamScraper {
novel.novelUrl = novelUrl;
- novel.novelName = $('.entry-title').text();
+ novel.novelName = loadedCheerio('.entry-title').text();
- novel.novelCover = $('img.wp-post-image').attr('src');
+ novel.novelCover = loadedCheerio('img.wp-post-image').attr('src');
- $('div.spe > span').each(function () {
- const detailName = $(this).find('b').text().trim();
- const detail = $(this).find('b').next().text().trim();
+ loadedCheerio('div.spe > span').each(function () {
+ const detailName = loadedCheerio(this).find('b').text().trim();
+ const detail = loadedCheerio(this).find('b').next().text().trim();
- if ($(this).text().includes('الحالة:')) {
- novel.status = $(this).text().replace('الحالة: ', '');
+ if (loadedCheerio(this).text().includes('الحالة:')) {
+ novel.status = loadedCheerio(this).text().replace('الحالة: ', '');
}
switch (detailName) {
@@ -76,23 +76,26 @@ class WPMangaStreamScraper {
}
});
- novel.genre = $('.genxed').text().replace(/\s/g, ',');
+ novel.genre = loadedCheerio('.genxed').text().replace(/\s/g, ',');
- novel.summary = $('div[itemprop="description"]').text().trim();
+ novel.summary = loadedCheerio('div[itemprop="description"]').text().trim();
let novelChapters = [];
- $('.eplister')
+ loadedCheerio('.eplister')
.find('li')
.each(function () {
const chapterName =
- $(this).find('.epl-num').text() +
+ loadedCheerio(this).find('.epl-num').text() +
' - ' +
- $(this).find('.epl-title').text();
+ loadedCheerio(this).find('.epl-title').text();
- const releaseDate = $(this).find('.epl-date').text().trim();
+ const releaseDate = loadedCheerio(this).find('.epl-date').text().trim();
- const chapterUrl = $(this).find('a').attr('href').split('/')[3];
+ const chapterUrl = loadedCheerio(this)
+ .find('a')
+ .attr('href')
+ .split('/')[3];
novelChapters.push({chapterName, releaseDate, chapterUrl});
});
@@ -110,10 +113,10 @@ class WPMangaStreamScraper {
const result = await fetch(url);
const body = await result.text();
- const $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
- let chapterName = $('.entry-title').text();
- let chapterText = $('div.epcontent').html();
+ let chapterName = loadedCheerio('.entry-title').text();
+ let chapterText = loadedCheerio('div.epcontent').html();
const chapter = {
sourceId,
@@ -132,17 +135,17 @@ class WPMangaStreamScraper {
const result = await fetch(url);
const body = await result.text();
- const $ = cheerio.load(body);
+ const loadedCheerio = cheerio.load(body);
let novels = [];
let sourceId = this.sourceId;
- $('article.bs').each(function () {
- const novelName = $(this).find('.ntitle').text().trim();
- let image = $(this).find('img');
+ loadedCheerio('article.bs').each(function () {
+ const novelName = loadedCheerio(this).find('.ntitle').text().trim();
+ let image = loadedCheerio(this).find('img');
const novelCover = image.attr('src');
- let novelUrl = $(this).find('a').attr('href').split('/')[4];
+ let novelUrl = loadedCheerio(this).find('a').attr('href').split('/')[4];
const novel = {
sourceId,
diff --git a/src/sources/ru/ranobehub.js b/src/sources/ru/ranobehub.js
index 0fbfe7a9..2312a2e7 100644
--- a/src/sources/ru/ranobehub.js
+++ b/src/sources/ru/ranobehub.js
@@ -39,21 +39,21 @@ const parseNovelAndChapters = async novelUrl => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novel = {sourceId, sourceName, url, novelUrl};
- novel.novelName = $('h1').text();
+ novel.novelName = loadedCheerio('h1').text();
- novel.novelCover = $('img.__posterbox ').attr('data-src');
+ novel.novelCover = loadedCheerio('img.__posterbox ').attr('data-src');
- novel.summary = $('.book-description__text').text().trim();
+ novel.summary = loadedCheerio('.book-description__text').text().trim();
novel.genre = '';
novel.status = Status.UNKNOWN;
- novel.author = $('.book-author').text().trim();
+ novel.author = loadedCheerio('.book-author').text().trim();
let novelChapters = [];
@@ -85,12 +85,12 @@ const parseChapter = async (novelUrl, chapterUrl) => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
- let chapterName = $(
+ let chapterName = loadedCheerio(
'body > div.pusher.container_main > div:nth-child(5) > div:nth-child(1) > div.title-wrapper > h1',
).text();
- let chapterText = $(
+ let chapterText = loadedCheerio(
'body > div.pusher.container_main > div:nth-child(5) > div:nth-child(1)',
).html();
@@ -107,7 +107,7 @@ const parseChapter = async (novelUrl, chapterUrl) => {
);
}
- console.log(chapterText);
+ // console.log(chapterText);
const chapter = {
sourceId,
diff --git a/src/sources/tr/epiknovel.js b/src/sources/tr/epiknovel.js
index 34e5a7d5..837e5fb7 100644
--- a/src/sources/tr/epiknovel.js
+++ b/src/sources/tr/epiknovel.js
@@ -13,14 +13,14 @@ const popularNovels = async page => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novels = [];
- $('div.col-lg-12.col-md-12').each(function () {
- const novelName = $(this).find('h3').text();
- const novelCover = $(this).find('img').attr('data-src');
- const novelUrl = $(this).find('h3 > a').attr('href');
+ loadedCheerio('div.col-lg-12.col-md-12').each(function () {
+ const novelName = loadedCheerio(this).find('h3').text();
+ const novelCover = loadedCheerio(this).find('img').attr('data-src');
+ const novelUrl = loadedCheerio(this).find('h3 > a').attr('href');
const novel = {
sourceId,
@@ -32,59 +32,61 @@ const popularNovels = async page => {
novels.push(novel);
});
- console.log(novels);
+ // console.log(novels);
return {novels, totalPages};
};
const parseNovelAndChapters = async novelUrl => {
const url = novelUrl;
- console.log(url);
+ // console.log(url);
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novel = {sourceId, sourceName, url, novelUrl};
- novel.novelName = $('h1#tables').text().trim();
+ novel.novelName = loadedCheerio('h1#tables').text().trim();
- novel.novelCover = $('img.manga-cover').attr('src');
+ novel.novelCover = loadedCheerio('img.manga-cover').attr('src');
- novel.summary = $(
+ novel.summary = loadedCheerio(
'#wrapper > div.row > div.col-md-9 > div:nth-child(6) > p:nth-child(3)',
)
.text()
.trim();
- novel.status = $(
+ novel.status = loadedCheerio(
'#wrapper > div.row > div.col-md-9 > div.row > div.col-md-9 > h4:nth-child(3) > a',
)
.text()
.trim();
- novel.author = $('#NovelInfo > p:nth-child(4)')
+ novel.author = loadedCheerio('#NovelInfo > p:nth-child(4)')
.text()
.replace(/Publisher:|\s/g, '')
.trim();
let novelChapters = [];
- $('table').find('tr').first().remove();
+ loadedCheerio('table').find('tr').first().remove();
- $('table')
+ loadedCheerio('table')
.find('tr')
.each(function () {
- const releaseDate = $(this).find('td:nth-child(3)').text();
+ const releaseDate = loadedCheerio(this).find('td:nth-child(3)').text();
- let chapterName = $(this).find('td:nth-child(1) > a').text();
+ let chapterName = loadedCheerio(this).find('td:nth-child(1) > a').text();
- if ($(this).find('td:nth-child(1) > span').length > 0) {
+ if (loadedCheerio(this).find('td:nth-child(1) > span').length > 0) {
chapterName = '🔒 ' + chapterName;
}
- const chapterUrl = $(this).find(' td:nth-child(1) > a').attr('href');
+ const chapterUrl = loadedCheerio(this)
+ .find(' td:nth-child(1) > a')
+ .attr('href');
novelChapters.push({
chapterName,
@@ -94,7 +96,7 @@ const parseNovelAndChapters = async novelUrl => {
});
novel.chapters = novelChapters;
- console.log(novel);
+ // console.log(novel);
return novel;
};
@@ -102,21 +104,21 @@ const parseNovelAndChapters = async novelUrl => {
const parseChapter = async (novelUrl, chapterUrl) => {
const url = chapterUrl;
- console.log(url);
+ // console.log(url);
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let chapterName, chapterText;
- if (result.url == 'https://www.epiknovel.com/login') {
+ if (result.url === 'https://www.epiknovel.com/login') {
chapterName = '';
chapterText = 'Premium Chapter';
} else {
- chapterName = $('#icerik > center > h4 > b').text();
- chapterText = $('div#icerik').html();
+ chapterName = loadedCheerio('#icerik > center > h4 > b').text();
+ chapterText = loadedCheerio('div#icerik').html();
}
const chapter = {
@@ -136,14 +138,14 @@ const searchNovels = async searchTerm => {
const result = await fetch(url);
const body = await result.text();
- $ = cheerio.load(body);
+ let loadedCheerio = cheerio.load(body);
let novels = [];
- $('div.col-lg-12.col-md-12').each(function () {
- const novelName = $(this).find('h3').text();
- const novelCover = $(this).find('img').attr('data-src');
- const novelUrl = $(this).find('h3 > a').attr('href');
+ loadedCheerio('div.col-lg-12.col-md-12').each(function () {
+ const novelName = loadedCheerio(this).find('h3').text();
+ const novelCover = loadedCheerio(this).find('img').attr('data-src');
+ const novelUrl = loadedCheerio(this).find('h3 > a').attr('href');
const novel = {
sourceId,