Skip to main content

Media Cloud Metadata Extractor

This is a package to extract a domain, title, publication date, text, and language content from the URL or text of an online news story. The methods for each are extracted from the larger Media Cloud project, but also build on numerous 3rd party libraries. The metadata extracted includes:

  • the original URL of publication
  • a normalized URL useful for de-duplication
  • the canonical domain published on
  • the date of publication
  • the primary language used in the article text
  • the title of the article
  • a normalized title useful for de-duplication
  • the text content of the news article
  • the name of the library used to extract the article content

Other often-reused methods and configuration related to the mediacloud service also live in this package.

Installation

pip install mediacloud-metadata

Usage

If you pass in a URL, it will follow redirects and fetch the HTML for you.

from mcmetadata import extract
metadata = extract(url="https://my.awesome.news/story-path")

You can also pass in HTML you already have on hand. Note that in this case it is also useful to pass in the URL because that is used for some for some of the metadata extraction.

from mcmetadata import extract
metadata = extract(url="https://my.awesome.news/story-path",
                   html_text="<html><head><title>my webpage ... </html>")

Development

If you are interested in adding code to this module, first clone the GitHub repository.

Installing

  • flit install
  • pre-commit install

Testing

pytest

Distributing a New Version

  1. Run pytest to make sure all the test pass
  2. Update the version number in pyproject.toml
  3. Make a brief note in the CHANGELOG.md about what changes
  4. Commit the changes
  5. Tag the commit with a semantic version number - v*.*.*
  6. Push to repo to GitHub

Test Cache

Test are run against fixtures by default. This can be changed with the use of '--use-cache=False' when running tests. When adding new tests, re-run 'scripts/get-test-web-content.py'

Contributors

Created as part of the Media Cloud Project. Contributes include:

  • Rahul Bhargava (Media Cloud, Northeastern University)
  • Paige Gulley (Media Cloud)
  • Phil Budne (Media Cloud)
  • Vangelis Banos (Internet Archive)

Metadata

Release files for mediacloud-metadata 2.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mediacloud-metadata 2.1.0
File Size Uploaded Provenance Actions
mediacloud_metadata-2.1.0.tar.gz 9.5 MB With provenance Details for mediacloud_metadata-2.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mediacloud-metadata 2.1.0
File Interpreter ABI Platform Actions
mediacloud_metadata-2.1.0-py3-none-any.whl Python 3 none any Details for mediacloud_metadata-2.1.0-py3-none-any.whl

Total release size: 19.2 MB

Release files / mediacloud_metadata-2.1.0.tar.gz

Download URL mediacloud_metadata-2.1.0.tar.gz
Size 9.5 MB
Tags Source
SHA-256 checksum
How to use checksums
e0a170a3c4403d3ecdbeddb5c06eb1ee2a3ac97d8a9453e07c6270ea5af74b3e
BLAKE2b-256 checksum
How to use checksums
69dc46a9b54cf26b8eb1b872ad7bf5c9bff40e2dda5ff6df3e4938868ae8b972
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.

Transparency log

Release files / mediacloud_metadata-2.1.0-py3-none-any.whl

Download URL mediacloud_metadata-2.1.0-py3-none-any.whl
Size 9.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
3aa795c3d9fbcfce7dd492093b636525baf081154dcbc22486d67ef3233ee962
BLAKE2b-256 checksum
How to use checksums
c1c8a985835fd02a49a7e5dd19435b1e2085ae3629179b7cd53f131eda3d414e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.

Transparency log

Security for mediacloud-metadata 2.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mediacloud_metadata-2.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page