-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.js
65 lines (62 loc) · 1.37 KB
/
run.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
'use strict';
var automedia = require('./lib/automedia.js');
var selectors = new Array();
selectors['wp'] = [
{
type:'youtube',
name:'YouTube (iFrame)',
code:'iframe[src^=\'http://www.youtube.com/embed\']',
attr:'src',
postfilter:function(url) {
var u = url.split("?");
var parts = u[0].split("/");
var id = parts[parts.length-1];
var thumb = "http://i1.ytimg.com/vi/"+id+"/maxresdefault.jpg";
var o = {
id:id,
embed:u[0],
thumb:thumb
}
return o;
}
},
{
type:'image',
name:'Images (attachments)',
code:'img[class^=\'attachment\'], img[class*=\' wp-image\']',
attr:'src',
postfilter:function(url) {
var re = /\b\-\-?[0-9]+x[0-9]+\b/;
var filename=url.replace(re,'');
return filename;
}
}
];
var pages = [
{
url:'http://www.heyuguys.co.uk/lone-survivor-trailer-poster-images/',
root:'.entry-content',
type:'wp'
},
{
url:'http://www.heyuguys.co.uk/thor-the-dark-world-poster-2/',
root:'.entry-content',
type:'wp'
},
{
url:'http://www.heyuguys.co.uk/thor-the-dark-world-trailer/',
root:'.entry-content',
type:'wp'
},
{
url:'http://itskindacool.com/2013/07/30/1439/that-puppet-game-show-trailer/',
root:'section.article',
type:'wp'
}
];
for (var i = pages.length - 1; i >= 0; i--) {
var p = pages[i];
automedia.awesome(p.url,p.root,selectors[p.type],function(r) {
console.log(r.youtube);
});
};