-
Notifications
You must be signed in to change notification settings - Fork 0
/
asynch.js
65 lines (62 loc) · 1.32 KB
/
asynch.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
var request = require('request'),
imagehost = 'http://dribbble.com',
mysqldb = require('./mysqldb.js');
var dribbbleRule = {
stopcase:function(counter){
if (counter > maxuse)
return true;
else
return false;
},
links:(function(maxuse){
var links = [];
var baseUrl = 'http://dribbble.com/shots/popular/';
links.push(baseUrl);
for (var i = 2; i<maxuse; i++){
links.push(baseUrl + '?page=' + i);
}
return links;
})(10)
,
info:[
{
key:'title',
keyselector:''
}
],
method:'serial',
selector:"$(\".extras img[alt=\'Attachments\']\").closest(\'.dribbble\').find(\'a.dribbble-over\')",
target:'href',
nextRule:{
selector:'$(\'.attachments ul li a\')',
target:'href',
method:'serial',
info:[
{
key:'title',
keyselector:'$(\'#screenshot-title\').text()'
},
{
key:'tags',
keyselector:'$(\'#tags li strong\').text(function(i,c){return c+\',\'}).text().replace(\',,\',\',\')'
},{
key:'color',
keyselector:'$(\'.color-chips li a\').text(function(i,c){return c+\',\'}).text().replace(\',,\',\',\')'
}
],
nextRule:{
selector:'$(\'#viewer-img img\')',
target:'src',
info:[
{
key:'imagelink',
keyselector:'$(\'#viewer-img img\').attr(\'src\')'
}
],
method:'parallel',
save:true
}
}
}
var dribbbleEngine = function(urls, rule){
}