-
Notifications
You must be signed in to change notification settings - Fork 0
/
image.js~
30 lines (28 loc) · 858 Bytes
/
image.js~
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
var request = require('request'),
jsdom = require('jsdom');
var htmlfilter = function(url, func){
request({ uri:'http://www.google.com' }, function (error, response, body) {
if (error && response.statusCode !== 200) {
console.log('Error when contacting google.com')
}
jsdom.env({
html: body,
scripts: [
'jquery.js'
]
}, function (err, window) {
var $ = window.jQuery;
$('.extras').get(0).parentNode.getElementsByClassName('dribbble-link')[0].href
var queue = $('div.extras');
var nextpage, nextlink;
for (var i = 0; i < queue; i++){
nextpage = $('.extras').get(i).parentNode.getElementsByClassName('driibbble-link');
if (nextpage.length > 0){
nextlink = nextpage[0].href;
}
}
// jQuery is now loaded on the jsdom window created from 'agent.body'
console.log($('body').html());
});
});
}