-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsample.js
58 lines (52 loc) · 1.37 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
var shortener = require('./lib/shortener');
var s = new shortener.Shortener();
// goo.gl
(function () {
var url = 'http://www.google.com';
var key = 'KEY';
s.google(url, key, function(result) {
console.log('\nGoogle:');
console.log('Long url:', result.longUrl);
console.log('Shortened url:', result.shortUrl);
});
})();
// bit.ly
(function() {
var url = 'http://bit.ly';
var key = 'KEY';
var format = 'json';
s.bitly(url, key, format, function(result) {
console.log('\nBitly:');
console.log('Long url:', result.longUrl);
console.log('Short url:', result.shortUrl);
});
})();
// readability
(function() {
var url = 'https://www.readability.com/';
s.readability(url, function(result) {
console.log('\nReadability:');
console.log('Long url:', result.longUrl);
console.log('Short url:', result.shortUrl);
});
})();
// mtny.mobi
(function() {
var url = 'https://sites.google.com/site/mtnymobi2/';
s.mtny(url, function(result) {
console.log('\nMtny:');
console.log('Long url:', result.longUrl);
console.log('Short url:', result.shortUrl);
});
})();
// adf.ly
(function() {
var url = 'http://example.com/';
var key = 'KEY';
var uid = 'UID';
s.adfly(url, key, uid, function(result) {
console.log('\nAdf.ly:');
console.log('Long url:', result.longUrl);
console.log('Short url:', result.shortUrl);
});
})();