A small automation script that checks unread email for substack links, uses substackprint.com to generate a newspaper from the links found, and sends it directly to a printer using CUPS.
- Automatically downloads and generates newspapers
- Sends the PDF directly to a printer
- Supports black/color printing modes
- Configurable through environment variables
- Made to run continuously on a pi or similar
The following software must be installed:
- Python 3.9+
- CUPS
Any required Python packages can be installed by running:
pip install -r requirements.txtClone the repository:
git clone https://github.com/yourusername/substack-newspaper-printer.git
cd substack-newspaper-printerInstall depedencies:
pip install -r requirements.txtCreate a configuration file:
cp .env.example .envEdit the configuration:
nano .envEnvironment variables are used for configuration. Example .env:
# EMAIL AUTHENTICATION
EMAIL_USER=youremailhere@email.com
EMAIL_PASS=youremailpasswordhere
IMAP_SERVER=yourimap.server.here
# NEWSPAPER SETTINGS
NEWSPAPER_NAME=The Substack Printer
FOOTER_TEXT="Printed with help from The Substack Printer made with <3 by Modderjoch - github.com/modderjoch"
# PRINTER SETTINGS
PRINTER_NAME=YOUR_PRINTER_NAME
PRINTER_COLOR_MODE=black
# Find your printer name by running lpstat -p
# Set PRINTER_COLOR_MODE to either black OR colorFind your printer name by running lpstat -p, then use the name returned in the .env file.
Run the script:
./run.shThe script will:
- Check the provided email adress for any unread emails with substack links in the body.
- Generate the newspaper
- Download the newspaper and save it to /output
- Send the newspaper to the configured printer
You can run it inside a screen session:
screen -S newspaper
.run/shDetach: CTRL + A + D Reattach:
screen -r newspaperExample cron job that runs every morning:
0 8 * * * /path/to/substack-newspaper-printer/run.sh