Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sreeharicodes/link-preview
Get link preview of a website.
https://github.com/sreeharicodes/link-preview
link link-preview preview url
Last synced: 9 days ago
JSON representation
Get link preview of a website.
- Host: GitHub
- URL: https://github.com/sreeharicodes/link-preview
- Owner: sreeharicodes
- License: mit
- Created: 2021-09-21T06:34:53.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2021-10-14T04:52:42.000Z (about 3 years ago)
- Last Synced: 2024-10-05T22:34:42.946Z (about 1 month ago)
- Topics: link, link-preview, preview, url
- Language: Python
- Homepage:
- Size: 90.8 KB
- Stars: 9
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Preview Link
[![Build Status](
https://app.travis-ci.com/sreehari1997/link-preview.svg?branch=master
)](
https://app.travis-ci.com/sreehari1997/link-preview
)
[![Coverage Status](
https://coveralls.io/repos/github/sreehari1997/link-preview/badge.svg?branch=HEAD
)](
https://coveralls.io/github/sreehari1997/link-preview?branch=HEAD
)
[![Downloads](
https://pepy.tech/badge/previewlink
)](
https://pepy.tech/project/previewlink
)You may have seen a preview of a link with a title, image, domain, and description when you share a link on social media.
![alt text](https://github.com/sreehari1997/link-preview/blob/master/preview.png?raw=true)
This preview has a significant impact on the user's decision to click on or not click on that link.
previewlink will help you to get the preview of a link.[PyPI](https://pypi.org/project/previewlink/)
## How it works?
previewlink looks for the following tags in the page source
- [Open graph protocol](https://ogp.me/)
- [Twitter cards](https://developer.twitter.com/en/docs/twitter-for-websites/cards/guides/getting-started)
- HTML tags (title, p, img, h1, h2)## Installation
Run the following to install
```python
pip install previewlink
```
## Usage```python
>>> from previewlink import preview_link
>>> # Generate link preview
>>> preview_link("https://github.com/sreehari1997")
{
'title': 'sreehari1997 - Overview',
'description': 'Developer. sreehari1997 has 69 repositories available. Follow their code on GitHub.',
'domain': 'github.com',
'image': 'https://avatars.githubusercontent.com/u/22663556?v=4?s=400'
}
```## Developing previewlink
To install previewlink, along with the tools you need to develop and run tests,
run the following in your virtual env```shell
$ pip install -e .[dev]
```