Skip to main content

Page Parser Utils For scraping, List index update

Project description

Parse Utilities (ParseUtils)

This is a package helps you extracting python dict from html/xml contents

Installation

pip install parse-utils

Usage

from parse_utils.page_parser import PageParser
html_data = '''
<html>
    <head><title>This is title</title></head>
    <body>
        <p id="header">This is header id</p>
        <p class="content">This is content</p>
    </body>
</html>
'''
config = {
    'header': ['//p[@id="header"]/text()'],
    'content': ['//p[@class="content"]'],
}
pparser = PageParser(html_data)
item = pparser.extract_dict(config)
print(item)

Output will be:

{'header': 'This is header id', 'content': 'This is content'}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for parse-utils, version 1.1
Filename, size File type Python version Upload date Hashes
Filename, size parse-utils-1.1.tar.gz (2.2 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page