Skip to content

halfguru/lapresse-tui

Repository files navigation

lapresse-tui

A terminal-based La Presse archive reader built in Rust with ratatui.

Browse 20 years of Quebec French newspaper articles (2005–2026) through a calendar-driven interface, reading full articles with inline images rendered in the terminal.

Rust License: MIT CI

demo


Features

  • Calendar-driven navigation — browse by month/day, see article counts at a glance
  • Inline image rendering — articles display photos inline using Sixel, Kitty, iTerm2, or half-block fallback
  • Full-text search — search across all cached articles with SQLite FTS5
  • Offline-capable — local SQLite cache means browsing works without network after initial sync
  • Auto-sync on date select — navigating to a date automatically fetches articles from lapresse.ca
  • Lazy image loading — images are only downloaded when you open an article, not during sync
  • Concurrent scraping — 4 article workers + 8 image workers with exponential backoff + jitter for rate-limit resilience
  • Live sync progress — animated spinner, phase tracking, and progress bar in real-time
  • Mouse support — scroll, click to select articles, click to focus panes
  • Open in browser / copy URL — press o to open an article in your browser, y to copy its URL

Installation

# Install from source (requires Rust 1.85+)
cargo install --git https://github.com/halfguru/lapresse-tui

# Or clone and build
git clone https://github.com/halfguru/lapresse-tui.git
cd lapresse-tui
cargo build --release
./target/release/lapresse-tui

Usage

# Launch the TUI
cargo run

# Bulk sync from CLI (full date range, with images)
cargo run -- sync --from 2025-01-01 --to 2025-01-31

# Metadata-only sync (faster; images load on-demand in TUI)
cargo run -- sync --from 2005-01-01 --to 2026-12-31 --metadata-only

TUI Keybindings

Key Action
h/l Previous/next month
H/L Previous/next year
j/k Move selection / scroll
Enter Select date / open article
o Open article in browser
y Copy article URL to clipboard
c Switch to calendar
f / F Filter / clear section filter
/ Search articles
? Help
q / Esc Quit / go back

Architecture

src/
  main.rs                     — CLI entry point (TUI or bulk sync)
  app/
    mod.rs                    — App state, event loop, sync orchestration
    handlers.rs               — Key handlers for each view
    image_loader.rs           — Background image fetch + decode
  ui/
    mod.rs                    — Render dispatcher, shared helpers
    calendar.rs               — Calendar view
    article_list.rs           — Article list view
    article_reader.rs         — Article reader with virtual scrolling
    search.rs                 — Search view
    help.rs                   — Help overlay
  sync/
    mod.rs                    — Sync orchestration
    scraping.rs               — HTML parsing (day pages, article pages)
    download.rs               — HTTP fetch with retry
    progress.rs               — SyncStats
  db/
    mod.rs                    — SQLite persistence (articles, images, FTS5)
    types.rs                  — Data structs
migrations/
  V1__initial_schema.sql

Tech Stack

Library Purpose
ratatui 0.30 TUI framework
ratatui-image 10.0 Inline image rendering
crossterm 0.29 Terminal backend
rusqlite 0.39 SQLite cache
reqwest 0.13 HTTP client
scraper 0.26 HTML parsing
tokio 1.x Async runtime
clap 4.x CLI arguments

License

MIT

About

Terminal-based La Presse archive reader with inline images, built in Rust with ratatui

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors