Skip to content

Commit

Permalink
fix chapter name lightnovelpub
Browse files Browse the repository at this point in the history
  • Loading branch information
K1ngfish3r committed Nov 19, 2023
1 parent b567c5c commit 7bbbbbd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
6 changes: 4 additions & 2 deletions src/sources/en/lightnovelpub.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,10 @@ const parseNovelAndChapters = async novelUrl => {
loadedCheerio = cheerio.load(chaptersHtml);

loadedCheerio('.chapter-list li').each(function () {
const chapterName = 'Chapter ';
loadedCheerio(this).find('.chapter-no').text().trim() + ' - ';
const chapterName =
'Chapter ' +
loadedCheerio(this).find('.chapter-no').text().trim() +
' - ';
loadedCheerio(this).find('.chapter-title').text().trim();

const releaseDate = loadedCheerio(this)
Expand Down
25 changes: 16 additions & 9 deletions src/sources/es/tunovelaligera.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,24 +186,31 @@ const parseChapter = async (novelUrl, chapterUrl) => {

const chapterName = loadedCheerio('h1#chapter-heading').text();

const cleanup = [
let pageText = loadedCheerio('li:contains("A")').closest('div').next();

let cleanup = [];
pageText.find('div').each((i, el) => {
let hb = loadedCheerio(el).attr('id')?.match(/hb.*/);
if (!hb) {
return;
}
let idAttr = `div[id="${hb}"]`;
cleanup.push(idAttr);
});

cleanup.push(
'center',
'.clear',
'.code-block',
'.ai-viewport-2',
'.cbxwpbkmarkwrap',
'.flagcontent-form-container',
'a:last',
'strong:last',
];
cleanup.map(tag =>
loadedCheerio('li:contains("A")').closest('div').next().find(tag).remove(),
);

const chapterText = loadedCheerio('li:contains("A")')
.closest('div')
.next()
.html();
cleanup.map(tag => pageText.find(tag).remove());

const chapterText = pageText.html();

const chapter = {
sourceId,
Expand Down

0 comments on commit 7bbbbbd

Please sign in to comment.