dharmafly / noodle

A node server and module which allows for cross-domain page scraping on web documents with JSONP or POST.
https://noodle.dharmafly.com/
747 stars 69 forks source link

Node JS now requires jsdom #126

Open jurban1997 opened 7 years ago

jurban1997 commented 7 years ago

// I'm new to github. Please help me get this to where it is best utilized. //this is a revised version of the code on the noodlejs.com site

var jsdom = require('jsdom').jsdom; var document = jsdom('', {}); var window = document.defaultView; var $ = require('jquery')(window); var query = { url: 'http://google.com/search?q=corverity', type: 'html', selector: 'h3.r a', extract: 'text' }; var uriQuery = encodeURIComponent(JSON.stringify(query)); var request = 'http://127.0.0.1:8888/?q=' + uriQuery + '&callback=?'; console.log(request); // Make Ajax request to Noodle server $.getJSON(request, function (data) { console.log(data[0].results); });