Skip to content

Instantly share code, notes, and snippets.

@jasoet
Created July 10, 2011 05:30
Show Gist options
  • Save jasoet/1074306 to your computer and use it in GitHub Desktop.
Save jasoet/1074306 to your computer and use it in GitHub Desktop.
(function() {
var http, jsdom, options, req, sys, url;
jsdom = require('jsdom');
sys = require('sys');
http = require('http');
url = 'http://www.bigoven.com/recipes/search?any_kw=salad';
options = {
host: 'www.bigoven.com',
port: 80,
path: '/recipes/search',
method: 'GET',
headers: {
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1'
}
};
req = http.request(options, function(res) {
var data;
console.log("IKI MLEBU");
data = "";
res.on('data', function(chunk) {
data = data + chunk;
});
res.on('end', function() {
jsdom.env(data, ['http://code.jquery.com/jquery-1.5.min.js'], function(error, window) {
window.$('.result').find('img').each(function() {
return console.log(window.$(this).attr('src'));
});
});
});
});
req.end('any_kw=salad');
}).call(this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment