Scripts to scrape and print The Times daily puzzles.
This repository contains two utilities:
app.js: Scrapes The Times printable puzzles page, finds puzzle PDF links, downloads them, and tracks already-downloaded dates inpuzzleScraperDatabase.json.print_crosswords.sh: Prints selected pages from a puzzle PDF based on the day of the week.
- Node.js (for
app.js) - npm
pdftk(required by the print script)- CUPS printing tools (
lp,lpstat,lpoptions)
-
Install Node.js dependencies:
npm install
-
Install
pdftk(example for Debian/Ubuntu):sudo apt-get update sudo apt-get install pdftk
-
Ensure you have a default printer configured in CUPS using
lpoptions:lpoptions -d YOUR_PRINTER_NAME
You can list available printers with:
lpstat -p -d
-
Create your local environment file and set your puzzle directory path:
cp .env.example .env
Then edit
.envand set:PUZZLE_DIR=/your/path/to/puzzles
Before running, make sure PUZZLE_DIR in .env points to your own puzzles folder.
Run:
node app.jsThis downloads newly found puzzle PDFs into the folder configured by PUZZLE_DIR and records downloaded dates in puzzleScraperDatabase.json.
Before running, make sure PUZZLE_DIR in .env points to your own puzzles folder.
Run without arguments to print today's puzzle file (expected as DDMMYY.pdf in the folder configured by PUZZLE_DIR):
./print_crosswords.shIf today's file is missing, the script will first run node app.js from this repository to fetch puzzles, then continue printing.
Run with a specific file path:
./print_crosswords.sh /path/to/your/file.pdfThe script prints a day-specific set of pages and sends the output to your default printer.