Welcome aboard! We are happy you are here and wish you good net-raft!
app.get('/nodetube', function(req, res){
//Tell the request that we want to fetch youtube.com, send the results to a callback function
request({uri: 'http://youtube.com'}, function(err, response, body){
var self = this;
self.items = new Array();//I feel like I want to save my results in an array
//Just a basic error check
if(err && response.statusCode !== 200){console.log('Request error.');}
//Send the body param as the HTML code we will parse in jsdom
//also tell jsdom to attach jQuery in the scripts and loaded from jQuery.com
jsdom.env({
html: body,
scripts: ['http://code.jquery.com/jquery-1.6.min.js']
}, function(err, window){
//Use jQuery just as in a regular HTML page
var $ = window.jQuery;
console.log($('title').text());
res.end($('title').text());
});
});
});
The most helpful NODEJS solutions
get user ipNODEJS
Click to see more ...
9.4K
1.7K
how to get client netmask using node.js ?NODEJS
Click to see more ...
5.7K
557
How to get client machine name and computer name with node.js?NODEJS
Click to see more ...
12.8K
440
how to get client local ip address using node.js ?NODEJS
Click to see more ...
2.7K
311
How to get client ip address using node.jsNODEJS
Click to see more ...
2.6K
271
How to combine node.js and jquery ?NODEJS
Click to see more ...
1.9K
247
how to detect tablet, iPad, iPhone, Android and Blackberry using nodejs ?NODEJS
Click to see more ...
2.2K
161
get client region using node.js ?NODEJS
Click to see more ...
2.2K
128
get real user ip address using node.js?NODEJS
Click to see more ...
1.8K
124
get server ip address from hostname nodejsNODEJS
Click to see more ...
3.5K
122