FIMFiction UserScripts 383 members · 0 stories
Comments ( 21 )
  • Viewing 1 - 50 of 21

Fimfiction already has a built-in button to generate EPUBs (it's in the menu you get by clicking the little arrow next to the view count), but its output isn't particularly rich. I wrote a userscript that intercepts clicks to that button and puts together much nicer EPUBs, which I called Fimfiction to EPUB because that's the kind of name a creative writer gives things.

If you don't know what EPUB is, it's an open standard for electronic publications, AKA e-books. If you want to read a story offline* and/or on an e-reader, you'll want it as either an EPUB or some format that can be generated from an EPUB.

Here are some things Fimfiction to EPUB includes that the native generator doesn't (copied from the README):
- Formatting, e.g. italics and centered text
- Cover image
- Inline images, including emotes
- Long description
- Table of contents
- Nice-looking apostrophes and quotation marks
- Some customization via Fimfiction's "Settings" page

If you have any problems with this script or with its output (e.g. settings don't work, the publication's formatting is messed up on your e-reader, etc.), please do report them to me. The best place to do so is on GitHub, but if you don't want to make an account there, go ahead and PM me. Note that automatic hyphens (which are set to “Don’t Specify” by default) will only work if your reading system supports them.

The script scrapes a lot of HTML, so if the site's layout changes (again), it'll break (again). I've tested it on three platforms; my primary development platform was Greasemonkey on Firefox, and I also tested it with Tampermonkey on Chromium and Greasemonkey on Pale Moon. It uses modern JavaScript features like block scope, arrow functions, and destructuring, so it won't work on old browsers. And remember—always brush your teeth!


* Come to think of it, if you wanted to read stories offline on Fimfiction itself, you could use ServiceWorker to make that possible.

Sweet! Now I can actually enjoy reading the stories I download for long road trips without internet! :pinkiehappy:

5956017
This sounds great, I'll be sure to try it out soon :yay: Thank you for making it :pinkiehappy:

5956025 Wow, it took less than five minutes for someone who uses the download EPUB button to see this? :rainbowderp:

5956067 No prob, Bob! I wanted it, so I made it.

A note: You'll probably want to keep up-to-date with the latest version of the script. I've been adding some minor improvements in places I initially overlooked. For instance, the formatting in the table of contents got a bit confusing when a chapter's title was split over multiple lines; I fixed that in the latest version, v1.0.6.

5956287 Alrighty then. I'll just reinstall it.

yrfoxtaur
Group Contributor

Hmmm.

I've been using FanFicFare (the cli version) myself. It is a bit less convenient to use, but the output is pretty good, and it will update a previously downloaded epub to include new chapters.

Of course, since the author doesn't take the time to bundle it up for redistribution, you have to have Python installed to use it. It is readily available in the package manager, though. It's also available as a plugin for calibre

5956523 Most userscript managers have a "Find Updates" feature. In Greasemonkey, you go to "Manage User Scripts...", right-click the one you want to update, and click "Find Updates". In Tampermonkey, you go to the Dashboard and click the script in question's last updated time.

5956998 Yeah, I found out about FanFicFare when I was mostly done with my own script. It has some advantages over ffn2epub, including the one you mentioned. But ffn2epub has the following features, and I can't find a way to enable any or all of them in FanFicFare:

- Images embedded in the EPUB for offline reading
- Short description
- Pretty XML
- EPUB 3 output
- Spec-compliant output

You're apparently supposed to be able to get it to 1) include a cover image if you supply your own HTML and 2) indent/double space paragraphs according to the author's intent if you supply your own CSS, but my fiddling with the INI so far hasn't been able to accomplish those things.

I'm very glad FanFicFare exists, and it's massively more configurable, but as far as Fimfiction is concerned, I think ffn2epub's output is more robust and better suited to modern e-readers. Plus, it's a lot easier to use, and I like my formatting better.

yrfoxtaur
Group Contributor

5957220 Well, I've been using it since before it got renamed from FanFicDownloader. I don't know about most of those, and I'm not sure what all I did in the config, but embedded images it does do (most of these are fimfic stories I downloaded, my copy of fanficfare resides on this server, I download the epubs into my device from here. Starscribe's Earth Without Us is a good example of embedded images). Think I had to turn off image resizing or something. As to the rest, I have no idea.

5957362 I see, you do it like this:

[epub]
include_images: true

It's in the example INI. I was looking at the wiki. It doesn't seem to handle SVGs well, though... It just assumes they're JPEGs and gives them a .jpg extension and an image/jpeg MIME type. And it looks like the OPF version is hardcoded to 2.0, so EPUB 3 is out.

Pardon me if I seem overly critical, but I have just written a script that does something similar, so of course that's the one that does everything I care about. :twilightsheepish:

And running FFF on a server is smart... I was just planning on porting ffn2epub to run on my device.

yrfoxtaur
Group Contributor

5957380 If you port ffn2epub to run on the device, I will probably switch to it. As it is, I use my desktop so rarely that it's not an option (I would use it more, were it actually on a desk). In my case, the device is my iPhone (I'm a bus driver who frequently finds himself waiting for hours in areas with no cell service), so logging in to the server with ssh, running fanficfare -u, and downloading the epub works fairly decently. The ability to have it run as a cron job, checking my unread email for story URLs and updating all the epubs that match would be better, but I have not set it up yet. If there were a way to make iCloud sync with that server, that would be even better...

Oh well. Ain't nothing perfect in this world.

I'm curious, though. What benefit does epub3 provide?
(By the way, FanFicFare does support the short description, it just doesn't do anything with it by default. As for the SVG images, that might be because no_image_processing is not set to true)

Could you add support for MOBI as well? It's what Kindle reader understands.
RIght now I'm downloading EPUB's and converting them to MOBI with ebook-convert script which is pk, but if would be even better to be able to get MOBI's from the site directly.

yrfoxtaur
Group Contributor

5958121 For you, FanFicFare might be the best choice (for now). It supports mobi, and has a web version. You do need a google account to use the web version. Whichever version you use, feed it a link to the story, and after a little bit it'll give you your ebook

So, FFF says it may be a while to get it working again with FiMfic 4.0, and this is out of commission for now. I wonder who’ll get something up and running first?

arcum42
Group Admin

5976465
Well, if nothing else, if you click on the dropdown on the far right on a fanfic, there’s still an option to download an epub there. So I suppose technically knighty is the first one to have something up and running. :twilightsmile:

--arcum42

5976481
Yeah, but that (used to) suck. I’ll see how it looks now...

It’s shit. Maybe I can get something readable by converting it in Calibre...

5976465 Tryin’ to goad me into actually fixing the script in a timely manner, eh? I’m onto you.

This script shouldn’t be hit too hard by the update, actually, especially since I had to remove author’s notes. I’ll JavaScript some JavaScript and get it working again.

5976465 Okay, v2.0.0 is out now. The Fimfiction update ought to be a pretty effective way to enforce the new, non-rule-breaking version.

5976673
It seems to work nicely! The non-linear content bits threw me, but (as I usually remove the cover image to save space on my reader) I can just drag them into position when I edit things anyway.

EDIT: Disregard the needing to drag stuff around, my reader knows what order to put them in. Awesome!

I updated the script to work with the new HTML output. Thanks to this update to Fimfiction, author's notes are back! :yay: The update also allows me to hook into the buttons on the reverse sides of story cards, so every EPUB download button I know of now works with this script, which feels nice.

So, do you know if this is something the Fimfarchive people could use the next time they update? It's always kind of bugged me that you could download everything or you could get a good download.

Comment posted by Patchwork Dreams deleted Apr 11th, 2019
  • Viewing 1 - 50 of 21