Minor Fixes
This commit is contained in:
@@ -11,8 +11,12 @@ const db = SQLite.openDatabase('lnreader.db');
|
||||
|
||||
export const insertChapters = async (
|
||||
novelId: number,
|
||||
chapters: ChapterItem[],
|
||||
chapters?: ChapterItem[],
|
||||
) => {
|
||||
if (!chapters?.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
let insertChaptersQuery = `
|
||||
INSERT INTO chapters (
|
||||
chapterUrl, chapterName, releaseDate,
|
||||
|
||||
@@ -83,14 +83,14 @@ const JumpToChapterModal = ({
|
||||
<Text numberOfLines={1} style={{ color: theme.textColorPrimary }}>
|
||||
{item.chapterName}
|
||||
</Text>
|
||||
{item.releaseDate && (
|
||||
{item?.releaseDate ? (
|
||||
<Text
|
||||
numberOfLines={1}
|
||||
style={[{ color: theme.textColorSecondary }, styles.dateCtn]}
|
||||
>
|
||||
{item.releaseDate}
|
||||
</Text>
|
||||
)}
|
||||
) : null}
|
||||
</Pressable>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -104,9 +104,9 @@ const ChapterDrawer = ({ state: st, navigation }) => {
|
||||
<Text numberOfLines={1} style={styles.chapterNameCtn}>
|
||||
{item.chapterName}
|
||||
</Text>
|
||||
{item?.releaseDate && (
|
||||
{item?.releaseDate ? (
|
||||
<Text style={styles.releaseDateCtn}>{item.releaseDate}</Text>
|
||||
)}
|
||||
) : null}
|
||||
</Pressable>
|
||||
</View>
|
||||
);
|
||||
@@ -183,6 +183,7 @@ const ChapterDrawer = ({ state: st, navigation }) => {
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<View style={styles.drawer}>
|
||||
<Text style={styles.headerCtn}>{getString('common.chapters')}</Text>
|
||||
@@ -238,8 +239,8 @@ const createStylesheet = (theme, insets) => {
|
||||
margin: 4,
|
||||
marginLeft: 0,
|
||||
marginRight: 16,
|
||||
borderTopRightRadius: 50,
|
||||
borderBottomRightRadius: 50,
|
||||
borderRadius: 50,
|
||||
// borderBottomRightRadius: 50,
|
||||
overflow: 'hidden',
|
||||
minHeight: 48,
|
||||
},
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { fetchHtml } from '@utils/fetch/fetch';
|
||||
import * as cheerio from 'cheerio';
|
||||
|
||||
const sourceId = 3;
|
||||
const baseUrl = 'https://fastnovel.net';
|
||||
const searchUrl = 'https://fastnovel.net/search/';
|
||||
|
||||
@@ -20,7 +21,7 @@ const popularNovels = async page => {
|
||||
const novelUrl = loadedCheerio(this).find('a').attr('href').substring(1);
|
||||
|
||||
const novel = {
|
||||
sourceId: 3,
|
||||
sourceId,
|
||||
novelName,
|
||||
novelCover,
|
||||
novelUrl,
|
||||
@@ -40,7 +41,7 @@ const parseNovelAndChapters = async novelUrl => {
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novel = {
|
||||
sourceId: 3,
|
||||
sourceId,
|
||||
sourceName: 'FastNovel',
|
||||
url,
|
||||
novelUrl,
|
||||
@@ -112,7 +113,7 @@ const parseChapter = async (novelUrl, chapterUrl) => {
|
||||
|
||||
let chapterText = loadedCheerio('#chapter-body').html();
|
||||
const chapter = {
|
||||
sourceId: 3,
|
||||
sourceId,
|
||||
novelUrl,
|
||||
chapterUrl,
|
||||
chapterName,
|
||||
@@ -137,7 +138,7 @@ const searchNovels = async searchTerm => {
|
||||
const novelUrl = loadedCheerio(this).find('a').attr('href').substring(1);
|
||||
|
||||
const novel = {
|
||||
sourceId: 3,
|
||||
sourceId,
|
||||
novelName,
|
||||
novelCover,
|
||||
novelUrl,
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { fetchHtml } from '@utils/fetch/fetch';
|
||||
import * as cheerio from 'cheerio';
|
||||
|
||||
const sourceId = 22;
|
||||
const baseUrl = 'https://foxaholic.com/';
|
||||
|
||||
const popularNovels = async page => {
|
||||
|
||||
@@ -61,7 +61,7 @@ class MadaraScraper {
|
||||
async parseNovelAndChapters(novelUrl) {
|
||||
const url = `${this.baseUrl}${this.path.novel}/${novelUrl}/`;
|
||||
|
||||
const body = await fetchHtml({ url, sourceId });
|
||||
const body = await fetchHtml({ url, sourceId: this.sourceId });
|
||||
|
||||
let loadedCheerio = cheerio.load(body);
|
||||
|
||||
@@ -134,8 +134,10 @@ class MadaraScraper {
|
||||
sourceId: this.sourceId,
|
||||
});
|
||||
} else {
|
||||
const data = await fetch(url + 'ajax/chapters/', { method: 'POST' });
|
||||
html = await data.text();
|
||||
html = await fetchHtml({
|
||||
url: url + 'ajax/chapters/',
|
||||
init: { method: 'POST' },
|
||||
});
|
||||
}
|
||||
|
||||
if (html !== '0') {
|
||||
@@ -212,13 +214,13 @@ class MadaraScraper {
|
||||
|
||||
async searchNovels(searchTerm) {
|
||||
const url = `${this.baseUrl}?s=${searchTerm}&post_type=wp-manga`;
|
||||
let sourceId = this.sourceId;
|
||||
|
||||
const body = await fetchHtml({ url, sourceId });
|
||||
|
||||
const loadedCheerio = cheerio.load(body);
|
||||
|
||||
let novels = [];
|
||||
let sourceId = this.sourceId;
|
||||
|
||||
loadedCheerio('.c-tabs-item__content').each(function () {
|
||||
const novelName = loadedCheerio(this).find('.post-title').text().trim();
|
||||
|
||||
Reference in New Issue
Block a user