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.0.1 to 2.1.0

yarn.lock

6

index.js

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

var cache = { };
var cacheLastSet = { };

@@ -44,4 +45,5 @@ // Named queue, means that we're not working on one name more than once at a tim

if (cache.hasOwnProperty(key))
if (cache.hasOwnProperty(key) && Date.now()-cacheLastSet[key] < CACHE_TTL) {
return cb(null, cache[key][0], { match: cache[key][1].match, isCached: true })
}

@@ -58,3 +60,3 @@ queue.push({

cache[key] = [imdb_id, match]
setTimeout(function() { delete cache[key] }, CACHE_TTL)
cacheLastSet[key] = Date.now()
}

@@ -61,0 +63,0 @@

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

@@ -29,3 +29,3 @@ "main": "index.js",

"needle": "^1.1.2",
"stremio-addons": "^2.0.2"
"node-fetch": "^2.2.0"
},

@@ -32,0 +32,0 @@ "devDependencies": {

@@ -1,9 +0,9 @@

var Stremio = require("stremio-addons");
var fetch = require("node-fetch")
var helpers = require("../helpers")
// Use cinemeta to pull names of movies and series against IMDB IDs
var stremio = new Stremio.Client();
stremio.add("http://cinemeta.strem.io/stremioget/stremio/v1");
//stremio.add("http://localhost:3005/stremioget/stremio/v1");
var cinemetaUrls = {
'movie': 'https://cinemeta.strem.io/stremioget/stremio/v1/q.json?b=eyJwYXJhbXMiOltudWxsLHt9XSwibWV0aG9kIjoibmFtZXMubW92aWUiLCJpZCI6MSwianNvbnJwYyI6IjIuMCJ9',
'series': 'https://cinemeta.strem.io/stremioget/stremio/v1/q.json?b=eyJwYXJhbXMiOltudWxsLHt9XSwibWV0aG9kIjoibmFtZXMuc2VyaWVzIiwiaWQiOjEsImpzb25ycGMiOiIyLjAifQ==',
}

@@ -25,11 +25,17 @@ // Index entry in our in-mem index

// It's OK if we don't pass type and we don't fetch names, because we will go to google fallback
if (query.type && !pulled[query.type]) stremio.call("names."+query.type, { }, function(err, res) {
if (err) console.error(err);
if (res) {
if (query.type && !pulled[query.type] && cinemetaUrls[query.type]) {
fetch(cinemetaUrls[query.type])
.then(function(resp) { return resp.json() })
.then(function(resp) { return resp.result })
.then(function(res) {
res.forEach(indexEntry);
pulled[query.type] = 1;
}
match();
});
else process.nextTick(match);
})
.catch(function(e) {
console.error(e)
})
.then(function() {
match()
})
} else process.nextTick(match);

@@ -51,2 +57,2 @@ function match() {

module.exports = metadataFind
module.exports = metadataFind
var nameToImdb = require("../index");
var tape = require("tape")
tape("basic test - match from google (type not provided)", function(t) {
tape("basic test - match from imdb (type not provided)", function(t) {
nameToImdb({ name: "south park" }, function(err, res, inf) {
t.error(err);
t.equals(res, "tt0121955")
t.ok(inf)
t.ok(inf.match && inf.match.match("google"), "is matched on google");
t.ok(inf, 'has inf')
t.ok(inf.match && inf.match.match("imdbFind"), "is matched on imdb");
t.end()

@@ -11,0 +11,0 @@ //console.log(inf); // inf contains info on where we matched that name - e.g. locally, or on google

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