Skip to content

Commit

Permalink
fix: [Genesis]: Fix Chapter Content (LNReader#1190)
Browse files Browse the repository at this point in the history
* genesis: fix missing chapter content

* genesis: remove genesistls and fix NU

* genesis: revert version

* genesis: update version
  • Loading branch information
Batorian authored Sep 17, 2024
1 parent 9ed284c commit b4a779a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 19 deletions.
10 changes: 0 additions & 10 deletions scripts/multisrc/lightnovelwp/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,6 @@
"reverseChapters": true
}
},
{
"id": "genesistls",
"sourceSite": "https://genesistls.com/",
"sourceName": "GenesisTls (Deprecated)",
"options": {
"lang": "English",
"reverseChapters": false,
"customJs": "$('.genesistls-watermark').remove();$('.epcontent p').each((i, el) => { if ($(el).html() === ' ') $(el).remove(); });"
}
},
{
"id": "pandamtl",
"sourceSite": "https://pandamtl.com/",
Expand Down
25 changes: 20 additions & 5 deletions src/plugins/english/genesis.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
/* eslint-disable no-case-declarations */
import { fetchApi } from '@libs/fetch';
import { Filters, FilterTypes } from '@libs/filterInputs';
import { Plugin } from '@typings/plugin';

/**
* Example for novel API:
* https://genesistudio.com/novels/dlh/__data.json?x-sveltekit-invalidated=001
* -> to view novel remove '__data.json?x-sveltekit-invalidated=001'
*
* Example for chapter API:
* https://genesistudio.com/viewer/2443/__data.json?x-sveltekit-invalidated=001
* -> to view chapter remove '__data.json?x-sveltekit-invalidated=001'
*/

class Genesis implements Plugin.PluginBase {
id = 'genesistudio';
name = 'Genesis';
icon = 'src/en/genesis/icon.png';
customCSS = 'src/en/genesis/customCSS.css';
site = 'https://genesistudio.com';
version = '1.0.2';
version = '1.0.3';
imageRequestInit?: Plugin.ImageRequestInit | undefined = {
headers: {
'referrer': this.site,
Expand Down Expand Up @@ -75,8 +84,10 @@ class Genesis implements Plugin.PluginBase {
novel.status = data[novelData.release_days] ? 'Ongoing' : 'Completed';

const chapterData = data[data[0].chapters];
const freeChapterData = chapterData.free;
// const premiumChapterData = chapterData.premium;
const freeChapterData = chapterData.free_chapters;

/** Premium chapters not yet implemented */
// const premiumChapterData = chapterData.premium_chapters;

novel.chapters = data[freeChapterData]
.map((index: number) => data[index])
Expand All @@ -101,7 +112,11 @@ class Genesis implements Plugin.PluginBase {
.filter((node: { type: string }) => node.type === 'data')
.map((node: { data: any }) => node.data)[0];

return data[data[0].content] + data[data[0].footnotes] ?? '';
/** May change in the future */
const content = data[19];
const footnotes = data[data[0].footnotes];

return content + footnotes ?? '';
}

async searchNovels(
Expand Down
11 changes: 7 additions & 4 deletions src/plugins/english/novelupdates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Plugin } from '@typings/plugin';
class NovelUpdates implements Plugin.PluginBase {
id = 'novelupdates';
name = 'Novel Updates';
version = '0.7.8';
version = '0.7.9';
icon = 'src/en/novelupdates/icon.png';
customCSS = 'src/en/novelupdates/customCSS.css';
site = 'https://www.novelupdates.com/';
Expand Down Expand Up @@ -254,7 +254,12 @@ class NovelUpdates implements Plugin.PluginBase {
const data_genesis = nodes_genesis
.filter((node: { type: string }) => node.type === 'data')
.map((node: { data: any }) => node.data)[0];
chapterText = data_genesis[data_genesis[0].content];

/** May change in the future */
const content_genesis = data_genesis[19];
const footnotes_genesis = data_genesis[data_genesis[0].footnotes];

chapterText = content_genesis + footnotes_genesis ?? '';
break;
case 'helscans':
chapterTitle =
Expand Down Expand Up @@ -746,7 +751,6 @@ class NovelUpdates implements Plugin.PluginBase {
* - ElloMTL
* - Femme Fables
* - Gem Novels
* - Genesis Translations (Manually added)
* - Goblinslate
* - Hel Scans (Outlier)
* - ippotranslations
Expand Down Expand Up @@ -791,7 +795,6 @@ class NovelUpdates implements Plugin.PluginBase {
'.chapter-warning',
'.entry-meta',
'.ezoic-ad',
'.genesistls-watermark',
'.mb-center',
'.modern-footnotes-footnote__note',
'.patreon-widget',
Expand Down

0 comments on commit b4a779a

Please sign in to comment.