Skip to main content

A simple way to transform a HTML file or URL to structured data.

Project description

Welcome to Html2Data

Author:

Description

A simple way to transform a HTML file or URL to structured data. You only need to define the xpath to the element. Optionaly you can define functions to be applied after. You can easily write XPATH using the firebug extension, copy XPATH (I recommend edit the XPATH given by firebug, making it shorter).

Example

$ from html2data import HTML2Data
$ url = "http://pypi.python.org/pypi/html2data"
>> config = [{'name': 'author', 'xpath': '//ul[@class="nodot"]}

>> h2d_instance = HTML2Data(html = html)
>> print h2d_instance.parse_one(xpath = '//head/title/text()')
'Example Page'

Requirement

  • lxml 2.0+

  • httplib2

Tests

Requirement

  • ludibrio

  • nose

Run

>> nosetests

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

html2data-0.4.tar.gz (3.3 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page