Skip to main content

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 or None)
  • description (str or None)
  • url (str or None): The URL you passed as an argument. If you used summary.from_markup, it’ll try to guess it from the markup.
  • picture (str or None): Picture URL
  • author (str or None)
  • publisher (str or None)
  • excerpt: Always None 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


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)

Uploaded Source

Built Distribution

summarify-0.1.0-py3-none-any.whl (5.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page