Skip to main content
PyPI Version Build Status Code Coverage

This package allows you to extract a difference between two html pages: given pages A and B, it will try to extract parts of A that are changed in B. It uses lxml.html.diff under the hood. but provides only changed parts as HTML.

It requires Python 3 currently.

License is MIT.

Installaton

You can install the package from PyPI:

pip install extract-html-diff

Usage

You can extract diff as text:

import extract_html_diff

html = '<div> <h1>My site</h1> <div>My content</div> </div>'
other_html = '<div> <h1>My site</h1> <div>Other content</div> </div>'

extract_html_diff.as_string(html, other_html)

this will give you:

'<div><div>My content</div>  </div>'

You can also get diff as a tree (an lxml.html.HtmlElement) if you plan to do additional transformations or change serialization:

extract_html_diff.as_tree(html, other_html)

You can pass input html as str or bytes (it will be parsed with lxml.html.fromstring in this case), or as an already parsed lxml.html.HtmlElement.

Release files for extract-html-diff 0.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 extract-html-diff 0.1.0
File Size Uploaded
extract-html-diff-0.1.0.tar.gz 4.5 kB Details

Release files / extract-html-diff-0.1.0.tar.gz

Download URL extract-html-diff-0.1.0.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
03f4e40b6d40689e7faf0188422e41bb6915f4be0e3c1cc3f0e0e0bcb9be15f1
BLAKE2b-256 checksum
How to use checksums
d1665d06e4425b484f4f25be50a0d5fa95689214bc3c6802d2fd403784d56220
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file

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