dteviot / WebToEpub

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

SufficientVelocity/SpaceBattles/XenForo gives TypeError: Cannot read properties of null (reading 'parentElement') when retrieving third chapter #1237

Closed Kiradien closed 6 months ago

Kiradien commented 7 months ago

Describe the bug Failure to generate Epub on a particular fanfic. TypeError is generated when retrieving a specific chapter.

To Reproduce Steps to reproduce the behavior:

  1. Go to 'https://forums.sufficientvelocity.com/threads/a-flung-light-worm-minor-toaru-cross.124037/'
  2. Click on '....' under the Threadmarks to show hidden Threadmarks
  3. Open WebToEpub
  4. Set first chapter to "Power Curriculum" (Chapter 3)
  5. Pack EPUB
  6. See Error. (If step 4 is skipped, error still occurs when generating Power Curriculum)

Expected behavior Successful generation of epub

Screenshots image image

Desktop (please complete the following information):

Additional context This can be considered fairly low priority; this is an outlier and most fics on SV and SB work fine. I will also look into this myself when I have a bit of time.

EDIT: This is not an outlier, and seems to affect all fics on SV. SB seems unaffected.

Kiradien commented 7 months ago

Hmm, also happens on third chapter at https://forums.sufficientvelocity.com/threads/philosophers-tinker-worm.127516/

This may not be as rare as expected? I wonder the change on SV that brought this about.

ImLJS commented 7 months ago

I looked at it. Found that some chapter at spacevelocity has different format.

https://forums.sufficientvelocity.com/threads/philosophers-tinker-worm.127516/#post-30669169 - Extension Worked https://forums.sufficientvelocity.com/threads/philosophers-tinker-worm.127516/post-30724429 - Caused Error

Only difference was that the last bit does not have a hashtag. Spacebattles still use hashtag in chapter urls

I Uploaded the Trial Extension Here: Mediafire . Test it out.

Kiradien commented 7 months ago

Worked when I tried with both links, no new issues cropped up generating off SpaceBattles. Seems good so far.

masteoo commented 7 months ago

@ImLJS hello, sorry to disturb, do you think is possible to save gobi3.com previews? Thanks for your work

masteoo commented 7 months ago

@ImLJS ok thanks, but some previews are epubs. I tried this script because ebook links are similar but not working https://github.com/C0D3D3V/Ebsco-Downloader

ImLJS commented 7 months ago

It actually does not matter if the content is in epub or pdf. What matters is that the text should be present within the website and not as a whole file.

Example:

image

In above image, you can see that the text is present within website content.

image

In the above one, a file is placed as a content in the website. In the above case, we can't extract it. Only way, is to download it.

Edit: Saw the latter part, there is a fundamental difference between downloading books and scraping webnovels.

ImLJS commented 7 months ago

@masteoo Checked Now. It turns out the URL of the book is not supported by the program. So, can't do anything about that. You have to request the owner of the project to support your site.

dteviot commented 7 months ago

@masteoo Please don't post credentials here. This is viewable by the public.

dteviot commented 7 months ago

@masteoo Also, as the file you're trying to get is a pdf, you can download it with your web browser. At a high level, the steps are

  1. Obtain the URL of the pdf. (Look at the HTML source, https://www.lifewire.com/view-html-source-in-chrome-3466725) the URL is the bit in the <iframe in the clip from ImLJS above.)
  2. Type the URL into the browser.
  3. PDF will download. (Note, you may need to adjust the browser to download instead of viewing. https://www.howtogeek.com/721441/how-to-download-pdfs-instead-of-previewing-them-in-chrome-firefox-and-edge/) Remember to reverse setting when you're done. Or, once you're viewing the PDF, I think you can save it.
dteviot commented 7 months ago

@masteoo To use Chrome's developer tools, select Menu (three dots) > More tools > Developer tools.
This works when right click is disabled.

masteoo commented 7 months ago

@dteviot thanks for the suggestion but text selection on dev tool is a mess cause there are too many paragraph marks (see photo). I can also select text and Ctrl+c for every chapter but there are too many chapters to do 😅 Screenshot_20240305_084215_Kiwi Browser

dteviot commented 7 months ago

@masteoo We should take this conversation to a new issue. It's spamming the original people who raised this who don't care about Gobi. That said, I think you probably need to use a different tool.

@ImLJS Experimental version at usual place has been updated.

masteoo commented 7 months ago

Ok sorry and thanks for your time. If you think it's not possible to adapt your tool I don't open a new issue so don't waste your time

Kiradien commented 6 months ago

Just a small update regarding this - note that the fix still works, however the bug now also affects SpaceBattles as well.

It looks like this was caused by an update to XenForo, so it's possible other platforms on XenForo may run into the same issue in the future as they update their versions.

I'll rename this to hopefully reduce duplicate tickets until patch goes live.

ImLJS commented 6 months ago

@Kiradien I just looked at it. I put out fix for spacebattles and spacevelocity together. Experimental version of extension is working properly for both the websites. Try That Out.