WebToEpub
WebToEpub copied to clipboard
Please add site https://developer.android.com/guide
Not a novel but I would love to read it as one..
Please note, I'm basically the only developer working on WebToEpub, and I'm not paid for doing this. (WebToEpub is completely free, and generates no money.) By asking to add a site, you're asking me to give you some of my limited free time. So, I think it's not unreasonable for me to ask you to do as much as you can to help me.
Provide URL for web page that contains Table of Contents (list of chapters) of a typical story on the site
https://developer.android.com/guide
Did you try using the Default Parser for the site? If not, why not?
Yes, It's currently running as Pack Epub 122/1280 Edit: After downloading, contents are there but not in a proper sequence with proper chapters....Please give me solution/ default parser for this one, thanks :)
Instructions for using the default parser can be found at https://dteviot.github.io/Projects/webToEpub_DefaultParser.html Yes, followed what I was able to understand: (required) CSS selector for element holding content to put into EPUB: div.devsite-article-body and CSS selector for element holding Title of Chapter: h1.devsite-page-title
Since I'm a android developer not a web developer that's all I was able to undestand
What settings did you use? What didn't work?
-
URL of first chapter https://developer.android.com/guide?hl=en
-
CSS selector for element holding content to put into EPUB div.devsite-article-body
-
CSS selector for element holding Title of Chapter h1.devsite-page-title
-
CSS selector for element(s) to remove
If the Default Parser did not work, if you have developer skills, did you try writing a new parser?
Instructions https://dteviot.github.io/Projects/webToEpub_FAQ.html#write-parser
I'm not a web developer but please accept my request to add Default Parser for it as many other website also follow similar patter it'll be help full for other developer documentations
If you don't have developer skills, can you ask a friend who does have them if they can do it for you?
I don't have any web developer friend (As I'm a self taught developers)
If you tried writing a parser, and it doesn't work. Attach the parser here.
I'm not a web developer :(
Edit: Final Results:
https://developer.android.com/guide?hl=en <---- Got awesome results for it, But definitely need help of you to make it perfect.
https://developer.android.com/guide <---- Not in sequence for this one
@LeitHunt
Edit: After downloading, contents are there but not in a proper sequence with proper chapters....Please give me solution/ default parser for this one, thanks :)
I'm not sure how much I can help you with "proper sequence".
The way WebToEpub works is it assumes you're at a "table of contents" type page, and there's a link to each web page/chapter you want in the epub.) Note, I'll use the terms web page and chapter interchangeably, as WebToEpub assumes each chapter in the packed Epub is a single web page.
So, WebToEpub collects the links on the page, and then collects each page and creates an epub chapter from the page.
A basic parser for the Android site looks something like this
"use strict";
parserFactory.register("developer.android.com", () => new DeveloperandroidParser());
class DeveloperandroidParser extends Parser{
constructor() {
super();
}
async getChapterUrls(dom, chapterUrlsUI) {
let menu = dom.querySelector(".devsite-book-nav-wrapper");
return util.hyperlinksToChapterList(menu);
}
findContent(dom) {
return dom.querySelector("div.devsite-article-body");
}
extractTitleImpl(dom) {
return dom.querySelector("h1");
}
findChapterTitle(dom) {
return dom.querySelector("h1.devsite-page-title");
}
}
I think the only complicated bit is the getChapterUrls() function. Which in this case is trying to pick the part of the page that has the links you're interested in. (So, in this case it's only taking links from the bar on the left.)
Note, you'd also need to add a script tag to popup.html for whatever file you've put the above parser into.
I've tried the above, but frankly, I think the resulting epub is a bit of a mess. The site really isn't designed for being turned into a static book.