Adds buttons to download Royal Road chapters
This script adds a "Download Chapters" button next to the already existing buttons (such as "Follow" or "Donate") to all fictions and "Download Chapter" buttons to every chapter on the Royal Road website.
When the button is pressed, the script scrapes the chosen chapters of the fiction into easily readable .html files, and packages them into a .zip file.
The .html files contain styling to emulate Royal Road's default dark mode (with font size 16 due to personal preference), and working previous/next chapter buttons on desktop using the file URI scheme.
There are some options you can change in your userscript manager:
It mostly works like on desktop, using a file:// link on a browser, but I found that to access those links on Android, they either need to be a bookmark or your homepage.
Additionally, due to Android's increased restrictions, you'll need to use a tool like adb to find the internal storage and SD card locations. In my case, my internal storage was on file:///sdcard/, but my SD card required additional permissions to access which I was unable to grant to my browser.
The apps I recommend are ones like HTTP File Server (+WebDAV) by slowscript, that create a small server in your phone so that you can access your files using any browser.
You might be able to find an app made specifically for viewing HTML files if you look hard enough, but it may not work with the Previous/Next buttons or with downloaded images.
If you want the file names to use incremental numbers as the prefix, the last version that did this is v4.8.
Tags: Royal Road, RoyalRoad, RR, Web Novel, royalroad.com