-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathtrakt.js
32 lines (29 loc) · 906 Bytes
/
trakt.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
function scrobbleStart(imdb, type){
var url = 'https://api-v2launch.trakt.tv/scrobble/start';
makeRequest(url, function(body){
console.log(body);
})
}
function makeRequest(url, callback){
var request = require('request');
logger.Debug(url);
request.post({
url: url,
json: true,
headers: {
'Content-Type': 'application/json',
'authorization': '', //auth Bearer code
'trakt-api-version': '2',
'trakt-api-key': '' //trakt api key
},
body: {"movie": {"ids": {"imdb": 'tt0468569'}}}
}, function (error, response, body) {
if (!error && response.statusCode === 200) {
callback(body);
} else {
console.warning("Error connecting to trakt.tv and grabbing json: " + url);
return;
}
})
}
scrobbleStart('tt11358390', 'movie');