Skip to content

Remove Unsplash and Pixabay copies after 24 hours - #29

Merged
IsraelWebDev merged 2 commits into
mainfrom
card/unsplash-cache24h
Nov 12, 2026
Merged

IsraelWebDev merged 2 commits into
mainfrom
card/unsplash-cache24h

Conversation

@IsraelWebDev

Copy link
Copy Markdown
Owner

What

Unsplash and Pixabay local copies expire 24 hours after download. Each such record carries expires_at (one day after retrieval), and image_find removes expired copies and their credit records before each run. Pexels copies have no expiry, as its terms state no limit.

  • validate_record refuses an Unsplash or Pixabay record without expires_at.
  • purge_expired(inputs, today) deletes the image and its .credit.json, and returns what it removed.
  • Tool description and docs/studio.md state the 24-hour rule. Catalog regenerated.

Scope

This is one step toward the Unsplash checklist. It does not add hotlinking, does not change when the download trigger fires, and does not put a credit line into rendered output. Those are separate changes, and the production application is not submitted.

Merge

main is merged in, including Pixabay (#28). Conflicts in tools.py, studio.md and catalog.json were resolved to keep both the expiry and the Pixabay wording.

Tests

  • tests/studio/test_stock_cache.py (4 tests): expiry on Unsplash and Pixabay records and none on Pexels, validation without expires_at, purge removes only expired Unsplash and Pixabay copies, a find run purges expired copies first.
  • Full suite on the branch (tree of 414b389): 1288 passed, 13 skipped (about 27 min).

🤖 Generated with Claude Code

Co-Authored-By: Claude Haiku 5.5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_017qYKdYke3ySSZS76W9Tp34


Generated by Claude Code

IsraelWebDev and others added 2 commits November 12, 2026 01:51
The Unsplash API terms allow a local copy for 24 hours; Pixabay asks for the
same cache limit. Each such record now carries expires_at (one day after
retrieval). validate_record refuses an Unsplash or Pixabay record without it.
image_find removes expired copies and their credit records before each run.
Pexels copies have no expiry, as its terms state no limit.

This is one step toward the Unsplash checklist. Hotlinking, the download
trigger on use, and credit text in the rendered output are separate changes.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017qYKdYke3ySSZS76W9Tp34
Brings in Pixabay (#28). Conflicts in tools.py, studio.md and catalog.json
resolved to keep both the 24-hour expiry and the Pixabay wording; the
catalog was regenerated.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017qYKdYke3ySSZS76W9Tp34
@IsraelWebDev
IsraelWebDev merged commit ea0d94b into main Nov 12, 2026
4 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.

2 participants