Skip to content

Racle/Reddit2Ebook

Repository files navigation

Reddit2Ebook

Turn any subreddit (selftext only) to an ebook.

App currently loads post starting from newest post available.

It also ignores sticky messages and non-selfpost messages.

Run via executable

Usage

  • get lastest release from releases.

  • unzip .zip folder

  • modify config.txt

  • run executable

    • Linux
      • use terminal
      • run chmod +x reddit2ebook-linux
      • run ./reddit2ebook-linux
    • Windows
      • double-click reddit2ebook-win.exe
    • Mac
      • use terminal
      • run chmod +x reddit2ebook-macos
      • run ./reddit2ebook-macos
        • if you get a MacOS System warning, go to Settings > Privacy & Security and then scroll down in the window and you should see a message about reddit2ebook.
        • click allow
        • try running ./reddit2ebook-macos from the same directory again.
  • created ebook is found at ./output/<subredditname>.epub

Run and build

Requirements

  • nodejs
    • Tested with node v10.11.0

Running locally

  • Install required packages npm i --production (you don't need archiver to be installed)
  • copy .env.default to .env OR config.default.txt to config.txt in root folder
  • modify .env file to your liking
  • run with npm run start OR node index.js
  • created ebook is found at ./output/<subredditname>.epub

NOTE: Windows users might need to run npm i --production in cmd with administrator privileges for node-gyp install to success

Building executable

  • Install required packages npm i
  • If not installed, install pkg globally npm i -g pkg
  • run npm run build-[linux|win|macos] to build Linux, Windows or macOS (x64) executables.
    • compiles executable to root folder

Required files

  • cover/Reddit2Ebook.jpg
  • .env OR config.txt
  • index.js OR executable file

.env / config.txt

# Base configuration. Subreddit OR wikipage is required.
# Base configuration. Subreddit is required.
subreddit=r/talesfromtechsupport    # Subreddit with r/
wikipage=https://www.reddit.com/r/hfy/wiki/series/calamitys_shadow  # wikipage link
wikipage_title=Calamity's Shadow                                    # wikipage title (same as ebook title)
max_pages=10                        # Maxium pages to loop trough

# Page. Values: new|top|hot|rising|controversial
# Default value is new
page=new

# Optional with page. Values: all|hour|day|month|year
# Default value is all
from=all

# Comments (optional). Also extremely slow. disabled by default.
comments_include=false              # Enable comments support
comments_min_points=2               # comments minimum points
comments_min_length=50              # comment minimum length
comments_max_parent=3               # Maxium ammount comments on top level
comments_max_replies=2              # Maxium amount of replies
comments_max_replies_indentation=3  # How deep we go. How many levels of replies we output.

[email protected]     # Your personal kindle email (NOT YET AVAILABLE)
[email protected]     # Your whitelisted email (NOT YET AVAILABLE)

NOTE: config.txt is prioritized over .env

wikipage also requires wikipage_title if wikipage is set, max_pages, page and from is ignored.

After adding comments support, configuration gets little complicated.

Here is little explanation.

As default comments_max_parent set as 3, we take 3 top level comments.

After that we check if we have comments_max_replies set. In default configuration it's 2. That means we take 2 replies for every top level comment.

After that we check how deep we go with comments_max_replies_indentation. Default is 3. That means we go two levels below first reply.

So in default configuration, if message thread have 4 indented replies, we only go to "level" 3.

TODO

  • Send to kindle support (https://www.amazon.com/gp/sendtokindle/email)
  • Add local database to remember build ebooks (and renaming ebooks with part x)
  • Add support for comments
    • if comments go over certain limit, there is change that all is not fetched.

Changelog

Release 1.3.0

2022-06-18 - Wikipage support

- added support for wikipages, ex. https://www.reddit.com/r/hfy/wiki/series/calamitys_shadow
Reddit2Ebook automatically lists all post links and download those posts

Release 1.2.0

2021-02-04 - Third release

- added reddit pages (top, hot etc.) support

Release 1.1.0

2018-10-01 - Second release

- added comments support

Release 1.0.0

2018-10-01 - First release

- Turn any subreddit to an ebook
    - Supports only selftext post, no images
- Custom ebook cover with subreddit name
- Fully opensource
- Easy to configure and use

About

Turn any subreddit (selftext only) to an ebook.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •