Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help in setting getInformationEpubItemChildNodes() #1519

Open
gamebeaker opened this issue Sep 27, 2024 · 2 comments
Open

Help in setting getInformationEpubItemChildNodes() #1519

gamebeaker opened this issue Sep 27, 2024 · 2 comments

Comments

@gamebeaker
Copy link
Collaborator

In a few parser i had the problem that the description of the book isn't in the dom but easily accessible.
Example:
88xiaoshuo.net
URL of dom: https://m.88xiaoshuo.net/Partlist/98781/
URL of info: https://m.88xiaoshuo.net/book/98781/
genesistudio.com
In the api request to get all Chapter is a description for the book with author etc. in the json response.

How can i get the info for example from an api request?
I think a possible solution would be to make
getInformationEpubItemChildNodes()
extractDescription()
async
to use
let data = (await HttpClient.fetchJson(dom.baseURI + "/__data.json")).json;
and extract the description.

@dteviot
Copy link
Owner

dteviot commented Sep 27, 2024

@gamebeaker
The downside of that is you'd need to update all existing implementations with an async. It's just a search/replace exercise, but numerous hits. Tedious, but not difficult.

The other obvious option (to me) is to create async versions of the two functions. And only provide an implementation if required.
Which is how getInformationEpubItemChildNodes() is used. E.g.

if (this.userPreferences.addInformationPage.value &&
this.getInformationEpubItemChildNodes !== undefined) {
epubItems.push(this.makeInformationEpubItem(this.state.firstPageDom));

Less work now, but complicates things going forward. So, I agree with making them async.

@dteviot
Copy link
Owner

dteviot commented Sep 27, 2024

Note, most implementations of getInformationEpubItemChildNodes() just get the summary, so they're duplicating extractDescription(). And, in fact, the base implementation of extractDescription is now to delegate to getInformationEpubItemChildNodes().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants