Skip to content

Latest commit

 

History

History
51 lines (35 loc) · 2.11 KB

README.md

File metadata and controls

51 lines (35 loc) · 2.11 KB

parslepy

Build Status

parslepy (pronounced "parsley-pie", /ˈpɑːslipaɪ/) is a Python implementation (built on top of lxml and cssselect) of the Parsley DSL for extracting structured data from web pages, as defined by Kyle Maxwell and Andrew Cantino (see Parsley's wiki for more details and original C implementation).

Kudos to Kyle Maxwell (@fizx) for coming up with this smart and easy syntax to define extracting rules.

Please note that this Parsley DSL is NOT the same as the Parsley parsing library at https://pypi.python.org/pypi/Parsley

Check out the official docs for more information on how to install and use parslepy. There is also some useful information at the parslepy Wiki

Here is an example of a parselet script that extracts the questions from StackOverflow first page:

{
    "first_page_questions(//div[contains(@class,'question-summary')])": [{
        "title": ".//h3/a",
        "tags": "div.tags",
        "votes": "div.votes div.mini-counts",
        "views": "div.views div.mini-counts",
        "answers": "div.status div.mini-counts"
    }]
}

Install

Install via pip with:

sudo pip install parslepy

Alternatively, you can install from the latest source code:

git clone https://github.com/redapple/parslepy.git
sudo python setup.py install

Online Resources