ruipgil / scraperjs

A complete and versatile web scraper.
MIT License
3.71k stars 188 forks source link

how to scrape with json response? #20

Closed atian25 closed 9 years ago

atian25 commented 9 years ago
scraperjs.StaticScraper.create()
    .get('http://echo.jsontest.com/k1/v1')
    .scrape(function($){
        // how to get response json?
        return $.html();
     }, function(result){
       return result;
     })
ruipgil commented 9 years ago

That's not the (most efficient) way to get and parse json. Just get the body of the page and do JSON.parse(body).