forked from brahma-dev/metafetch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsample.js
41 lines (38 loc) · 1.26 KB
/
sample.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
var metafetch = require('metafetch');
metafetch.fetch('http://www.treehugger.com/cars/tesla-model-x-update-first-ev-towing-capability-dual-motors-falcon-wing-doors-etc.html', function (err, meta) {
if (err) {
return console.error(err);
}
console.log('Title: ', meta.title);
console.log('Description: ', meta.description);
//console.log('Type: ', meta.type);
console.log('URL: ', meta.url);
//console.log('SiteName: ', meta.siteName);
//console.log('Charset: ', meta.charset);
console.log('Image: ', meta.image);
//console.log('Meta: ', meta.meta);
console.log('Images: ', meta.images);
console.log('Links: ', meta.links);
});
/* Optional flags to disable parsing images and links and http timeout or headers
metafetch.fetch('http://www.treehugger.com/cars/tesla-model-x-update-first-ev-towing-capability-dual-motors-falcon-wing-doors-etc.html', {
flags: {
images: false,
links: false
},
http: {
timeout: 30000
}
}, function (err, meta) {
if (err) {
return console.error(err);
}
console.log('Title: ', meta.title);
console.log('Description: ', meta.description);
console.log('Type: ', meta.type);
console.log('URL: ', meta.url);
console.log('SiteName: ', meta.siteName);
console.log('Charset: ', meta.charset);
console.log('Image: ', meta.image);
});
*/