Skip to content

Commit

Permalink
Merge pull request #1530 from gamebeaker/update-GenesiStudio
Browse files Browse the repository at this point in the history
update GenesiStudioParser
  • Loading branch information
gamebeaker authored Sep 29, 2024
2 parents 33e1b7c + b9892f0 commit a706df6
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions plugin/js/parsers/GenesiStudioParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ class GenesiStudioParser extends Parser{
async getChapterUrls(dom) {
let data = (await HttpClient.fetchJson(dom.baseURI + "/__data.json")).json;
let tmpids = data.nodes[2].data[0].chapters;
tmpids = data.nodes[2].data[tmpids].free_chapters;
let freeChapterids = data.nodes[2].data[tmpids];

let returnchapters = freeChapterids.map(e => ({
sourceUrl: `https://genesistudio.com/viewer/${data.nodes[2].data[data.nodes[2].data[e].id]}`,
title: `${data.nodes[2].data[data.nodes[2].data[e].chapter_title]}`
let jsdata = data.nodes[2].data[tmpids];
let extractfreechapter = [...jsdata.match(/'free'.*'premium'/)[0].matchAll(/'id':0.*?,/g)];
let freechapterids = extractfreechapter.map(e => Number(e[0].replace("'id':","").replace(",","")));

let returnchapters = freechapterids.map(e => ({
sourceUrl: "https://genesistudio.com/viewer/"+e,
title: "[placeholder]"
}));
return returnchapters;
}
Expand All @@ -34,8 +35,8 @@ class GenesiStudioParser extends Parser{
let newDoc = Parser.makeEmptyDocForContent(url);

this.appendElement(newDoc, "h1", this.titleFromJson(json));
let hash = json.nodes[2].data[json.nodes[2].data[0].akezmZmaAOMmegnQAlkRnalAJnr];
let content = json.nodes[2].data[json.nodes[2].data[0][hash]];
let index = json.nodes[2].data[0].content;
let content = json.nodes[2].data[index];
this.appendContent(newDoc, content);
let notes = json.nodes[2].data[json.nodes[2].data[0].footnotes];
if (notes !== null && notes != "") {
Expand Down Expand Up @@ -63,6 +64,10 @@ class GenesiStudioParser extends Parser{
findContent(dom) {
return Parser.findConstrutedContent(dom);
}

findChapterTitle(dom) {
return dom.querySelector("h1");
}

extractTitleImpl(dom) {
return dom.querySelector("h1");
Expand Down

0 comments on commit a706df6

Please sign in to comment.