Get title and description from a Web page
Project description
Summarify
Summarify is a small Python library to extract a title and description from a Web page.
import summarify
summary = summarify.from_url("https://github.com/")
print(summary.title)
print(summary.description)
print(summary.picture)
Output:
The world's leading software development platform · GitHub
GitHub is where people build software. More than 27 million people use GitHub to discover, fork, and contribute to over 75 million projects.
https://assets-cdn.github.com/images/modules/open_graph/github-octocat.png
Install
pip3 install summarify
Usage
import summarify
summary = summarify.from_url("https://...")
# If you already have the HTML:
# summary = summarify.from_html("...")
The Summary
object returned from summarify.from_url
has the following
attributes:
title
(str
orNone
)description
(str
orNone
)url
(str
orNone
): The URL you passed as an argument. If you usedsummary.from_markup
, it’ll try to guess it from the markup.picture
(str
orNone
): Picture URLauthor
(str
orNone
)publisher
(str
orNone
)excerpt
: AlwaysNone
for now
You can also export a summary as a dict
for e.g. JSON serialization:
dict(my_summary) # -> {"url": "...", "title": "..."}
Be aware that only the non-None
attributes are included in that dictionnary.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
summarify-0.1.0.tar.gz
(4.2 kB
view hashes)
Built Distribution
Close
Hashes for summarify-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ed3b162bf0a4793b6d30ddfaf4110540e4cdb565063fdb8e85f3f189dbd2274 |
|
MD5 | 463f44a9c47b3286d4a64cf9deacec91 |
|
BLAKE2b-256 | 86d5b9438bb734cf8be3e4969d8c73489d12068e1d0edb407c936319b150b60a |