url_utils
URL detection, content fetching, and metadata caching utilities.
- class url_utils.URLMetadataCache(ttl=None)[source]
Bases:
objectIn-memory TTL cache for URL metadata (default 24 h).
- Parameters:
ttl (int | None)
- DEFAULT_TTL = 86400
- async url_utils.get_reddit_content(url)[source]
Fetch a Reddit post’s content + top comments.
Prefers the authenticated
oauth.reddit.com.json API whenREDDIT_CLIENT_ID/REDDIT_CLIENT_SECRETare configured (richest data, including scores). Without credentials Reddit 403-blocks the .json endpoints from this host, so it falls back to the public, unauthenticated.rssfeed (no scores, best-effort comments) so Reddit links still resolve.