The script currently doesn’t work, as ereolen.dk has changed their site. The way it now works is by fetching a binary blob and decrypting it client-side. Reverse engineering shouldn’t be too hard, but I haven’t had time for a good look yet.
Turn books from ereolen.dk into proper ePub files, to make it possible to read
borrowed books with any ePub reader. ePubs created with freereolen
have been
tested and found working in FBReader on Android and Linux, on a Barnes&Noble
nook (gen1) and on a Kobo Libra H2O.
Works by grabbing pages and resources using curl, doing a bit of magic and
converting it all into an ePub using zip
and ePub XML templates rendered with
bash
.
- automagically creates ToC even for (some) really broken books
- i18n layer to translate ToC names into local languages
- fetches external resources
- lints HTML using
tidy
awk
curl
dos2unix
grep
sed
tidy
See also help text:
./run.sh
- borrow a book on ereolen.dk
- open it for reading
- open the Web Developer view and select the “Network” tab
- apply filter so that only JavaScript is shown
- browse to a new page
- find a request whose URL matches
https://streaming.pubhub.dk/publicstreaming/v3/69f63101-9caf-40b9-a31e-b2fdb5642e3d/43c44150-9d2c-4506-8fe6-c0bb904ea563/1/?callback=jQuery11100348712123123213_123123121313&_=1231313123123
(the important thing to look for is the last part of the URL before the query string) - run the program with the URL as argument, e.g. ~./run.sh ‘https://streaming.pubhub.dk/publicstreaming/v3/69f63101-9caf-40b9-a31e-b2fdb5642e3d/43c44150-9d2c-4506-8fe6-c0bb904ea563/1/?callback=jQuery11100348712123123213_123123121313&_=1231313123123’~
- doesn’t work with all books, especially graphics-heavy ones (e.g. graphic novels made from images and associated text)
- will often choke (on purpose) on links to external sites, which will need to be removed or whitelisted
- CSS tidy
- support for overdrive.com (as English language books are often only available there)
- support for automatically fetching books instead of having to manually go and find the correct URL