-
Notifications
You must be signed in to change notification settings - Fork 0
/
movie.js
29 lines (24 loc) · 912 Bytes
/
movie.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
var request = require('request')
var movieThis = function(movie) {
var url = 'http://www.omdbapi.com/?apikey=40e9cece&t=';
if (movie.length > 1) {
for (var x = 0; x < movie.length - 1; x++) {
url += movie[x] + "+";
}
url += movie[movie.length - 1]
} else {
url += movie;
}
request(url, function(error, response, body) {
var movieData = JSON.parse(body)
console.log('Title: ' + movieData.Title)
console.log('Year: ' + movieData.Year)
console.log('IMDB Rating: ' + movieData.Ratings[0].Value)
console.log('Rotton Tomatoes Rating: ' + movieData.Ratings[1].Value)
console.log('Country: ' + movieData.Country)
console.log('Language: ' + movieData.Language)
console.log('Plot: ' + movieData.Plot)
console.log('Actors: ' + movieData.Actors)
});
}
module.exports = movieThis;