skillfed

extruct

Extract embedded metadata from HTML markup

extruct v0.18.0 659.4K downloads/30d#5,463 on PyPI971
Permissive license Active released

What it is and what it does

extruct is a metadata extraction library that parses HTML documents and pulls out structured data embedded in standard formats. It handles W3C Microdata (including schema.org), JSON-LD, Microformats, Open Graph tags, RDFa, and Dublin Core metadata—all through a single unified interface. You pass it an HTML string and optional base URL, and it returns a dictionary keyed by format type, each containing the extracted data.

The library wraps several specialized parsers (lxml, rdflib, mf2py, pyrdfa3) and HTML utilities (w3lib, html-text, jstyleson) to normalize their output. It's commonly used in web scraping, SEO analysis, and data integration pipelines where you need to reliably extract metadata that content publishers have embedded for search engines, social media, or semantic web applications.

Use it for:

  • Extract schema.org Microdata from e-commerce product pages to build product catalogs
  • Parse Open Graph tags from web pages for social media link previews and metadata
  • Harvest JSON-LD structured data from news articles and blog posts for content indexing
  • Extract Microformats from personal websites and social profiles for contact/event data
  • Build semantic web applications by parsing RDFa annotations from HTML documents
  • Aggregate Dublin Core metadata from institutional or library websites

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Extracts structured metadata from HTML markup in multiple formats: Microdata, JSON-LD, Microformats, Open Graph, RDFa, and Dublin Core.

Yes. extruct is actively maintained, has no known vulnerabilities, supports current Python versions (3.8–3.12), and installs with low friction. It solves a real problem—unified extraction of multiple metadata formats—that would otherwise require juggling separate parsers. The permissive license and 971 repository stars indicate solid community adoption. Install it if you need to reliably extract structured metadata from HTML in production or research contexts.

Install

extruct on PyPI

pip

pip install extruct

uv

uv add extruct

poetry

poetry add extruct

Installing extruct

Before you install

Low install friction with a pure-Python wheel. Active maintenance with recent commits and 971 repository stars. Supports Python 3.8 through 3.12.

License in practice

Permissive license allows commercial and private use without restriction.

Quickstart

pip install extruct

import extruct
from w3lib.html import get_base_url

html = '<html>...</html>'
base_url = 'https://example.com'
data = extruct.extract(html, base_url=base_url)

Verify before relying

  • Performance characteristics when processing large HTML documents or batch operations
  • Specific version compatibility matrix for each metadata format parser (mf2py, rdflib, pyrdfa3)
  • Whether experimental RDFa support is production-ready

Package facts

License not declared (permissive)
Python support supports the current Python release (>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies 8 — lxml, lxml-html-clean, rdflib, pyrdfa3, mf2py, w3lib, html-text, jstyleson
Maintenance actively maintained — 644 days since the last release
Last repo commit
First released
Downloads 659,409/month — #5,463 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: extruct-0.18.0-py2.py3-none-any.whl

Keywords: extruct

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

extract metadata from htmlparse microdata schema.orgjson-ld extractionopen graph parserhtml structured data extractionrdfa parsermicroformats parserdublin core metadata
metadata-extractionweb-scrapingstructured-data

More HTML packages