dteviot / WebToEpub

A simple Chrome (and Firefox) Extension that converts Web Novels (and other web pages) into an EPUB.
Other
740 stars 140 forks source link

Allow pasting of ToC list #258

Closed ammasakshay closed 5 years ago

ammasakshay commented 5 years ago

Their are a few reasons for this.

  1. Sometimes, W2E pulls a bad ToC Dm4time ToC As you can see to fix the ToC id have to manually delete the 2 years part line by line.
  2. The second reason is simply, uniformity. We download Webnovels from different sites and it saves chapters differently. novelspread saves chapters like
  3. chaptername 2.chaptername while wuxiaworld.online saves chapters like chapter 1 - chapter name chapter 2 - *chapter name other sites as chapter 1 chapter 2 chapter 3 and so on. creating the optional ability to simply replace the ToC with a list you have allows you to make sure the ToC is always to your preference and edit in the case of a website where it pulls the ToC incorrectly. (For the record all the LN's from lightnovel bastion are pulled like that)
dteviot commented 5 years ago

@ammasakshay I can suggest two ways you can modify Chapter Titles. Method One

  1. In W2E, click the "Edit Chapter Urls" button
  2. This gives a page that lists every chapter to fetch as a hyperlink.
  3. Copy the hyperlinks into an editor (I like Notepad++) and use it to bulk modify the text. (Using a RegEx, it's easy to remove the "2 years ago " string.)
  4. Copy the modified links back into W2E.
  5. Click "Apply Changes".

Method Two

  1. If Epub has been created, load the Epub into Calibre
  2. Open the File Browser (https://manual.calibre-ebook.com/edit.html#id3) and in the list of files, in the Miscellaneous section there's a file called "toc.ncx". That's the table of content.
  3. It's an XML file, so you have several options.
    1. Edit it in Calibre itself, using serach and replace https://manual.calibre-ebook.com/edit.html#id13
    2. Copy the file into a programming editor and modify it there with a macro, then copy it back.
    3. Use XSLT (it's a language for editing XML)

Notes,

  1. You could also use Calibre's "Generate TOC from all headings" feature.
  2. If none of the above work for you, please let me know what the problem with them is.
dteviot commented 5 years ago

@ammasakshay I've added a "Copy URLs to Clipboard" Button. Does this make things any easier? Now you don't need to:

  1. Click the "Edit Chapter URLs" button
  2. Select the text
  3. Do "Copy"
ammasakshay commented 5 years ago

this doesnt work because you still have to add <> before each name which discourages pasting a list of names. Create an option maybe where you can paste a list where each line is a chapter?

dteviot commented 5 years ago

@ammasakshay

still have to add < > before each name

I don't understand what you mean. When I try it, I get a list of hyperlinks. e.g.

<a href="https://zirusmusings.com/ldm-ch333/">Chapter 333 – The Dungeon Core Assembly</a>
<a href="https://zirusmusings.com/ldm-ch334/">Chapter 334 – The Dungeon Core Assembly 2</a>

In more detail, to get the list of links

  1. In Web Browser, open the page that shows the 1st Table of Contents you want
  2. Click on the "WebToEpub" icon on the top right of the window.
  3. Click the "Copy URLs to Clipboard" button. At this point the list of URLs is in the clipboard. And you can paste them.

So, next steps are

  1. In Web Browser, open the page that shows the 2nd Table of Contents you want
  2. Click on the "WebToEpub" icon on the top right of the window.
  3. Click the "Edit Chapter URLs" button
  4. Put mouse at top of the list of URLs showing and hit the "paste" key (Usually Ctrl + V)

Please give me a more detailed explanation of what you mean

ammasakshay commented 5 years ago

Sorry if I wasn't clear. I also misunderstood what the button did. From what I gather, the function allows you to find a website that does have a ToC you like and use it. I was actually thinking something more along the lines of, if you have a list of names Ch 1 - xxx Ch 2 -xxxx and so on, you could just paste the list and each line would be recognized as a chapter

dteviot commented 5 years ago

@ammasakshay

From what I gather, the function allows you to find a website that does have a ToC you like and use it.

Kind of. Let's try a worked example. Start with https://lightnovelstranslations.com/nidome-no-yuusha/ this begins with chapter 64. So we want the earlier chapters. Checking on NovelUpdates, we find the preceeding chapters (v2c1-v2e4) can be found at http://wn404.blogspot.com/p/misc.html And the chapters before that are at https://cardboardtranslations.com/projects/nidome-no-yuusha/ And the chapters before that... etc.

So, Steps are.

  1. Open Url with most recent chapters (https://lightnovelstranslations.com/nidome-no-yuusha/) in browser, open WebToEpub and click "Edit Chapter URL".
  2. Now open the URL with preceding chapters (http://wn404.blogspot.com/p/misc.html) 2.1 Open WebToEpub, and use "Copy URLs to Clipboard" to copy URLs to clipboard 2.2 Go back to WebToEpub you opened in step 1, and paste the links from clipboard into list. 2.3 Close WebToEpub (and page) you opened in steps 2 and 2.1
  3. Repeat steps 2 to 2.3 for next ToC URL (https://cardboardtranslations.com/projects/nidome-no-yuusha/) Rinse and Repeat for the rest of the ToC URLs, until you have a list of all chapters.
  4. Click "Pack Epub" button.

Note, instead of pasting the links into WebToEpub to build up a list, you could paste them into a programmer's edition like Notepad++ and then paste the final list into WebToEpub.