Skip to main content

A library to read a YML file with Xpath or CSS Selectors and extract data from HTML pages using them

Project description

selectorlib

https://img.shields.io/pypi/v/selectorlib.svg https://img.shields.io/travis/scrapehero/selectorlib.svg Documentation Status Updates

A library to read a YML file with Xpath or CSS Selectors and extract data from HTML pages using them

Example

>>> from selectorlib import Extractor
>>> yaml_string = """
    title:
        css: "h1"
        type: Text
    link:
        css: "h2 a"
        type: Link
    """
>>> extractor = Extractor.from_yaml_string(yaml_string)
>>> html = """
    <h1>Title</h1>
    <h2>Usage
        <a class="headerlink" href="http://test">¶</a>
    </h2>
    """
>>> extractor.extract(html)
{'title': 'Title', 'link': 'http://test'}

History

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

selectorlib-0.16.0.tar.gz (188.8 kB view details)

Uploaded Source

Built Distribution

selectorlib-0.16.0-py2.py3-none-any.whl (5.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file selectorlib-0.16.0.tar.gz.

File metadata

  • Download URL: selectorlib-0.16.0.tar.gz
  • Upload date:
  • Size: 188.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.1

File hashes

Hashes for selectorlib-0.16.0.tar.gz
Algorithm Hash digest
SHA256 154f7c5f39bc825a0717b24ca2cc0b95dcb2caa1669239f3d4ac6e41af398731
MD5 da86499c58c7e12a63e77ab592240e61
BLAKE2b-256 0057f1ae8c2740980eec4a142fd8b1f6603294bba079add5e29bf62f51503c96

See more details on using hashes here.

File details

Details for the file selectorlib-0.16.0-py2.py3-none-any.whl.

File metadata

  • Download URL: selectorlib-0.16.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.1

File hashes

Hashes for selectorlib-0.16.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 007c156d01ab8de86f72f0914d66d704f6fb4ebda0db0e04f204083d63e55bc6
MD5 8aa1a3ca4568c3d278192b6d8766f1e9
BLAKE2b-256 1e3e7ad0a01b07c066cf79c431324970869345e4d249242d70f20e939a5c630b

See more details on using hashes here.

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