Skip to content

Instantly share code, notes, and snippets.

@captn3m0
Created September 20, 2024 05:02
Show Gist options
  • Save captn3m0/e4ff8f03c80b009b187c31402b3d0019 to your computer and use it in GitHub Desktop.
Save captn3m0/e4ff8f03c80b009b187c31402b3d0019 to your computer and use it in GitHub Desktop.
Tor.com (Reactor) Original Fiction EPUB Generation Script

Generatest EPUBs for all Original Fiction published at Reactor (earlier Tor.com) using a combination of curl, pup, ag, xargs, and url-to-epub.

Final output should be roughly 700+ EPUBs weighing around 250MB.

#!/bin/bash
curl -s 'https://reactormag.com/wp-admin/admin-ajax.php?action=listing_results' --compressed -X POST --data currentPage=1 --data sort=newest --data perPage=1000 --data term_slug=original-fiction --data taxonomy=fiction | jq -r .html > listing.html
cat listing.html | pup 'a attr{href}' | sed 's/^ //' | sort -u |ag -v comments | ag -v "reactormag.com/(author|tag|fictions|new-torcom|download|all-of-tor-coms|all-tor|2014-fiction)" > links.txt
cat links.txt | xargs url-to-epub -l en
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment