tobiaslei / cod

turn any site into a JSON api using xpath

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cod

turn any site into a JSON api using xpath

Install

pip install -r requirements.txt

How to use?

  1. run the code server
    python cod_server.py
  2. send the url and xpath that you want to crawl to the code server, it will return you the correponding xpath result.
$(function(){
    $.ajax({
        url: 'http://127.0.0.1:5000/', 
        type: 'POST',
        dataType: 'json', 
        data: {
            'url': 'https://news.ycombinator.com/', 
            'xpath': '//*[@class="storylink"]'
        },
        success: function(data){
            $('#result').html(data['result']);
        }
        });
});

TODO

  • Handle ajax rendered pages

About

turn any site into a JSON api using xpath

License:MIT License


Languages

Language:Python 59.9%Language:HTML 40.1%