Python library to extract link previews (title, description, image, etc.) from URLs. Version 0.12.1. No regular release cadence; final release was 2020.
pip install linkpreviewVerified import paths — ran on the pinned version, not inferred.
Get a link preview with title, description, and image. Use the functional API for simplicity.
Replace `get_preview(url)` with `link_preview(url)`.
Use the functional API `link_preview(url)` for simplicity, or update class usage: `preview = LinkPreview(url); preview.fetch_and_extract()`.
Pass a custom headers dictionary when using the class-based API: `LinkPreview(url, headers={'User-Agent': 'Mozilla/5.0'})` or use requests.Session.Validate the URL scheme before passing to linkpreview; skip unsupported schemes.
Use `from linkpreview import link_preview` and call `link_preview(url)`.
Ensure the URL is accessible (set a User-Agent if needed), or handle the exception gracefully.
Upgrade to the latest version (0.12.1). For the class-based API, use `LinkPreview(url, headers={'User-Agent': '...'})`. For the functional API, consider using requests.Session to set headers globally.