Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

name-to-imdb

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

name-to-imdb - npm Package Compare versions

Comparing version 2.3.2 to 3.0.0

t.js

16

index.js

@@ -18,3 +18,3 @@ var namedQueue = require('named-queue');

// Named queue, means that we're not working on one name more than once at a tim
// Named queue, means that we're not working on one name more than once at a time
// and a total of 3 names at once

@@ -52,12 +52,12 @@ var queue = new namedQueue(worker, 3)

providers: args.providers || defaultProviders,
}, function(err, imdb_id, match) {
}, function(err, res, match) {
if (err)
return cb(err)
if (imdb_id) {
cache[key] = [imdb_id, match]
if (res && res.id) {
cache[key] = [res.id, match]
cacheLastSet[key] = Date.now()
}
cb(null, imdb_id, match)
cb(null, res.id, { ...match, meta: res })
})

@@ -81,8 +81,8 @@ };

provider(task.q, function(err, id) {
provider(task.q, function(err, res) {
if (err)
return cb(err)
if (id)
return cb(null, id, { match: n })
if (res)
return cb(null, res, { match: n })
else

@@ -89,0 +89,0 @@ nextProv()

{
"name": "name-to-imdb",
"version": "2.3.2",
"version": "3.0.0",
"description": "Finds IMDB ID by movie/series name (fuzzily) and optionally year and type",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -53,3 +53,14 @@ var fetch = require("node-fetch")

})
return cb(null, m && m.imdb_id);
// Uniform the result to imdbFind provider
var res = m ? {
id: m.imdb_id,
name: m.name,
year: m.year,
type: m.type,
yearRange: undefined,
image: undefined,
starring: undefined,
similarity: undefined,
} : false;
return cb(null, res);
};

@@ -56,0 +67,0 @@ }

@@ -43,3 +43,3 @@

if (result)
cb(null, result.id, { match: url })
cb(null, result, { match: url })
else

@@ -66,3 +66,10 @@ retry()

year: result.y,
type: result.q
type: result.q,
yearRange: result.yr,
image: result.i ? {
src: result.i[0],
width: result.i[1],
height: result.i[2]
} : undefined,
starring: result.s,
}

@@ -69,0 +76,0 @@

@@ -14,11 +14,58 @@ # name-to-imdb

## Example
```javascript
## Examples
### imdbFind provider
```js
var nameToImdb = require("name-to-imdb");
nameToImdb({ name: "south park" }, function(err, res, inf) {
console.log(res); // prints "tt0121955"
console.log(inf); // inf contains info on where we matched that name - e.g. metadata, or on imdb
nameToImdb("south park", function(err, res, inf) {
console.log(res); // "tt0121955"
// inf contains info on where we matched that name - e.g. metadata, or on imdb
// and the meta object with all the available data
console.log(inf);
})
```
```js
// console.log(inf.meta)
{
id: 'tt0121955',
name: 'South Park',
year: 1997,
type: 'TV series',
yearRange: '1997-',
image: {
src: 'https://m.media-amazon.com/images/M/MV5BOGE2YWUzMDItNTg2Ny00NTUzLTlmZGYtNWMyNzVjMjQ3MThkXkEyXkFqcGdeQXVyNTA4NzY1MzY@._V1_.jpg',
width: 680,
height: 1000
},
starring: 'Trey Parker, Matt Stone',
similarity: 1
}
```
### metadata provider
```js
var nameToImdb = require("name-to-imdb");
nameToImdb({ name: "south park", type: 'series', providers: ['metadata'] }, function (err, res, inf) {
console.log(res); // "tt0121955"
// inf contains info on where we matched that name - e.g. metadata, or on imdb
// and the meta object with all the available data
console.log(inf); // inf: { match, meta }
})
```
```js
// console.log(inf.meta)
{
id: 'tt0121955',
name: 'South Park',
year: 1997,
type: 'series',
yearRange: undefined, // imdbFind only
image: undefined, // imdbFind only
starring: undefined, // imdbFind only
similarity: undefined // imdbFind only
}
```
> Note: while using "metadata" provider, you must specify the media type and the name must be in english
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc