Skip to main content

DOM Traversing utility using GraphQL

Project description

GDOM is the next generation of web-parsing, powered by GraphQL syntax and the Graphene framework.

Install it typing in your console:

pip install gdom

Usage

You can either do gdom --test for starting a test server for testing queries or

gdom QUERY_FILE

Your QUERY_FILE could look similar to this:

{
  page(url:"http://www.yelp.com/biz/amnesia-san-francisco") {
    title: text(selector:"h1")
    phone: text(selector:".biz-phone")
    address: text(selector:".address")
    reviews: query(selector:"[itemprop=review]") {
      username: text(selector:".user-name a")
      comment: text(selector:"p")
    }
  }
}

This will output the results of your query in a nice json format.

Advanced usage

If you want to generalzie your gdom query to any page, just rewrite your query file adding the $page var. So should look to something like this:

query ($page: String) {
  page(url:$page) {
    # ...
  }
}

And then, query it like:

gdom QUERY_FILE http://www.yelp.com/biz/amnesia-san-francisco

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

gdom-0.1.0.tar.gz (4.0 kB view hashes)

Uploaded Source

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