Programmatic Usage - RenegadeFox/movie-metadata GitHub Wiki
Using movie-metadata
within your project or just within a node.js
script.
Note: Assuming that
movie-metadata
is locally installed
Example: Async/Await
const { getMetadata } = require('movie-metadata')
async function getIt() {
const metadata = await getMetadata({
key: 'YOUR_API_KEY',
source: ['dead man\'s chest', 'at world\'s end', 'ralph breaks the internet', 'Ocean\'s Eight']
})
console.log(metadata)
}
getIt()
// Outputs
{ fetchedMetadata: [
{
Title: 'Pirates of the Caribbean: Dead Man\'s Chest',
Year: '2006',
Rated: 'PG-13',
Released: '07 Jul 2006',
Runtime: '151 min',
Genre: 'Action, Adventure, Fantasy',
Director: 'Gore Verbinski',
Writer: 'Ted Elliott, Terry Rossio, Ted Elliott (characters), Terry Rossio (characters), Stuart Beattie (characters), Jay Wolpert...'
Actors: 'Johnny Depp, Orlando Bloom, Keira Knightley, Jack Davenport',
Plot: 'Jack Sparrow races to recover the heart of Davy Jones to avoid enslaving his soul to Jones\' service, as other friends a...'
Language: 'English, Turkish, Greek, Mandarin, French',
Country: 'USA',
Awards: 'Won 1 Oscar. Another 42 wins & 53 nominations.',
Poster: 'https://m.media-amazon.com/images/M/MV5BMTcwODc1MTMxM15BMl5BanBnXkFtZTYwMDg1NzY3._V1_SX300.jpg',
Ratings: [Array],
Metascore: '53',
imdbRating: '7.3',
imdbVotes: '597,591',
imdbID: 'tt0383574',
Type: 'movie',
DVD: '05 Dec 2006',
BoxOffice: '$423,032,628',
Production: 'Buena Vista',
Website: 'http://pirates.movies.com',
Response: 'True'
},
...
],
notFoundMovies: [] }
Example: Promises
const { getMetadata } = require('movie-metadata')
getMetadata({
key: 'YOUR_API_KEY',
source: ['dead man\'s chest', 'at world\'s end', 'ralph breaks the internet', 'Ocean\'s Eight']
}).then(metadata => {
console.log(metadata)
})
// Same output