Skip to content

Comments

feat: multi-platform support for fav.py and new categories#37

Merged
asboyer merged 4 commits intomasterfrom
feat/multi-platform-support-for-favs
Feb 18, 2026
Merged

feat: multi-platform support for fav.py and new categories#37
asboyer merged 4 commits intomasterfrom
feat/multi-platform-support-for-favs

Conversation

@asboyer
Copy link
Owner

@asboyer asboyer commented Feb 18, 2026

Summary

  • Refactor fav.py into a data-driven category system for easy addition of new categories
  • Add multi-platform support (Spotify, YouTube, SoundCloud, arbitrary URLs) for music categories
  • Add new categories: books (Goodreads), episodes (IMDB), articles, videos, podcasts (og: meta scraping)
  • Add reusable platform-icon.liquid include for platform detection
  • Add show/show_link display for episodes, publication display for articles/podcasts
  • Hide score circle when no score is present
  • Content: add The Millionaire Next Door book

fav.py Documentation

Usage

python fav.py <url> <category> [field=value ...]

Supported Categories

Category Source Auto-scraped fields
albums Spotify, YouTube, SoundCloud, other title, creator, image, release year
songs Spotify, YouTube, SoundCloud, other title, creator, album, album_link, image, release year
playlists Spotify, YouTube, SoundCloud, other title, creator, image
artists Spotify, YouTube, SoundCloud, other title, image
movies IMDB title, director, image, release year
shows IMDB title, director, image, release year
episodes IMDB title, director, season/episode, show name, show_link, parent show image, air year
books Goodreads title, author(s), image, publication year
articles Any URL (og: tags) title, author, image, publication name, published date
podcasts Apple Podcasts / any URL title, show name, image, publication name, published date
videos Any URL (og: tags) title, image

Field Overrides

Override any auto-scraped or template field by appending key=value args:

python fav.py "https://example.com" articles title="Custom Title" creator="Custom Author"
python fav.py "https://example.com" albums redirect="https://other-url.com" score=9.5
python fav.py "https://example.com" videos img_url="https://image-url.com/img.jpg"

Adding a New Category

  1. Add an entry to CATEGORY_FIELDS dict with the frontmatter fields for that category
  2. Add the category to the appropriate scraping group (SPOTIFY_CATEGORIES, IMDB_CATEGORIES, GOODREADS_CATEGORIES, OG_SCRAPE_CATEGORIES) or add a new elif block
  3. Optionally add to SQUARE_CROP_CATEGORIES if images should be square-cropped
  4. Optionally add to PERFECT_THRESHOLDS with (field_name, threshold) for auto-perfect detection
  5. Add an icon entry in _includes/scripts/category-icon.liquid

Configuration Constants

  • CATEGORY_FIELDS — Maps each category to its extra frontmatter fields
  • SQUARE_CROP_CATEGORIES — Categories with square-cropped images (music)
  • SPOTIFY_CATEGORIES — Categories using the Spotify API
  • IMDB_CATEGORIES — Categories scraped from IMDB (movies, shows, episodes)
  • GOODREADS_CATEGORIES — Categories scraped from Goodreads (books)
  • OG_SCRAPE_CATEGORIES — Categories using generic og: meta tag scraping
  • PERFECT_THRESHOLDS — Auto-set perfect: true when score/stars meet threshold

Examples

# Spotify album
python fav.py "https://open.spotify.com/album/..." albums

# YouTube album with redirect
python fav.py "https://www.youtube.com/watch?v=..." albums redirect="https://open.spotify.com/..."

# IMDB movie
python fav.py "https://www.imdb.com/title/tt1234567/" movies

# IMDB TV episode (uses parent show image)
python fav.py "https://www.imdb.com/title/tt2301451/" episodes

# Goodreads book
python fav.py "https://www.goodreads.com/book/show/998" books

# Article from any site
python fav.py "https://www.wsj.com/some-article" articles

# Apple Podcasts episode
python fav.py "https://podcasts.apple.com/us/podcast/..." podcasts

# Song with score override
python fav.py "https://open.spotify.com/track/..." songs score=96

Test plan

  • Tested Goodreads book scraping (The Millionaire Next Door)
  • Tested IMDB episode scraping (Ozymandias - Breaking Bad)
  • Tested YouTube album with redirect override
  • Tested article scraping (WSJ)
  • Tested Apple Podcasts scraping
  • Verify Spotify categories still work as before
  • Verify IMDB movies/shows still work as before

- Add YouTube, SoundCloud, and generic URL support to fav.py with
  og:title/og:image scraping and PIL square-cropping for music categories
- Extract platform icon detection into reusable platform-icon.liquid include
- Refactor album_link icon in fav.liquid to use new include
- Hide score circle in song/album layouts when no score is set
- Add redirect field to all category templates
- Sanitize special characters from titles, filenames, and creator names
- Include exact timestamp in date field for proper sort ordering
…scraping, and data-driven category config

Refactor fav.py into a data-driven category system (CATEGORY_FIELDS, SQUARE_CROP_CATEGORIES, etc.)
for easy addition of new categories. Add support for episodes (IMDB TV episode scraping with
parent show image/link, season/episode numbers, director), books (Goodreads JSON-LD), articles,
videos, and podcasts (og: meta scraping). Add show/show_link display to fav.liquid with IMDB icon,
season/episode metadata, publication display, and episodes icon to category-icon.liquid.
@asboyer asboyer force-pushed the feat/multi-platform-support-for-favs branch from 53c129b to 1c745a6 Compare February 18, 2026 03:38
@asboyer asboyer merged commit ae7c02f into master Feb 18, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant