Closed liony0 closed 2 years ago
Site doesn't work because javascript loads the chapter content afterwards so requires an api call in the fetchChapter that creates a dom and puts chapter information inside. I don't really understand how promises work so it was difficult to debug to say the least. Ran out of time to finish it.
Is there somewhere on the parser documents that says what page (chapter vs toc) each function is going to affect?
Sorry I don't have any knowledge about this. I don't know what you are looking for.
@eeeonoo Synteresis was talking to me, not you.
@Synteresis
the parser documents that says what page (chapter vs toc) each function
I assume you're referring to https://github.com/dteviot/WebToEpub/blob/master/plugin/js/parsers/Template.js. In which case, Sorry, no there isn't. Can you create an issue to update the template, and maybe give a couple of examples of what you'd like to see?
👌I was working on tracing each function. I will make pull request in a few days when I have the time.
@Synteresis Looking at your first attempt.
url.replace("pagestage", "api-pagestage") + "/body"
Then you create an empty doc and populate with content.
example,
async fetchChapter(url) {
let jsonUrl = url.replace("pagestage", "api-pagestage") + "/body";
var json = (await HttpClient.fetchJson(jsonUrl)).json;
let newDoc = Parser.makeEmptyDocForContent(url);
let header = newDoc.dom.createElement("h1");
newDoc.content.appendChild(header);
header.textContent = json.title;
let bodyArray = json.body.split("\n").filter(s => !util.isNullOrEmpty(s));
for(let text of bodyArray) {
let p = newDoc.dom.createElement("p");
p.textContent = text;
newDoc.content.appendChild(p);
}
return newDoc.dom;
}
Note, I haven't tested this
Oh, I didn't know there were these URL functions. Thanks, I'll get started on a branch and try it out.
@eeeonoo Hey, it is completed, but will need to be merged before you can compile from source with the instructions.
@Synteresis Thank you so much! It works perfectly.
I tried using the Default Parser for the site. But I don't have any basic knowledge of JavaScript and HTML, So i failed
I tried https://pagestage.kakao.com/novels/22514217?page=5
It didn't work, and i don't know what to do.
Can you add site 'https://pagestage.kakao.com/' ?