bug fix
This commit is contained in:
@@ -5,8 +5,8 @@ module.exports.getDetails = function (detailsId, movieOrTv, tmdbApiKey, language
|
||||
|
||||
if (movieOrTv == 'movie' || movieOrTv == 'tv') {
|
||||
|
||||
const detailURL = config.theMovieDbURL + movieOrTv + '/' + detailsId + '?api_key=' + tmdbApiKey + '&language=' + language;
|
||||
|
||||
const detailURL = config.theMovieDbURL + movieOrTv + '/' + detailsId + '?api_key=' + tmdbApiKey + '&language=' + language;
|
||||
|
||||
request(detailURL, (err, resultBody, body) => {
|
||||
if (resultBody != '') {
|
||||
const getJson = JSON.parse(resultBody.body);
|
||||
@@ -110,7 +110,7 @@ module.exports.getTrailers = function (detailsId, movieOrTv, tmdbApiKey, cb) {
|
||||
else {
|
||||
const error = null;
|
||||
const result = getJson;
|
||||
|
||||
|
||||
cb(error, result);
|
||||
}
|
||||
}
|
||||
@@ -132,28 +132,33 @@ module.exports.getImages = function (detailsId, movieOrTv, tmdbApiKey, cb) {
|
||||
|
||||
request(creditsURL, (err, resultBody, body) => {
|
||||
|
||||
const getJson = JSON.parse(resultBody.body);
|
||||
|
||||
if (getJson.status_code > 1) {
|
||||
// if wrong api key error
|
||||
const error = 'tmdb get images wrong api key error';
|
||||
const result = null;
|
||||
cb(error, result);
|
||||
}
|
||||
else {
|
||||
if (err) {
|
||||
// if thmdb api connection error
|
||||
const error = 'tmdb get images api connection error';
|
||||
if (resultBody != []) {
|
||||
const getJson = JSON.parse(resultBody.body);
|
||||
if (getJson.status_code > 1) {
|
||||
// if wrong api key error
|
||||
const error = 'tmdb get images wrong api key error';
|
||||
const result = null;
|
||||
cb(error, result);
|
||||
}
|
||||
else {
|
||||
const error = null;
|
||||
const result = getJson;
|
||||
cb(error, result);
|
||||
if (err) {
|
||||
// if thmdb api connection error
|
||||
const error = 'tmdb get images api connection error';
|
||||
const result = null;
|
||||
cb(error, result);
|
||||
}
|
||||
else {
|
||||
const error = null;
|
||||
const result = getJson;
|
||||
cb(error, result);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// if wrong api key error
|
||||
const error = 'error getting data';
|
||||
const result = null;
|
||||
cb(error, result);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "flixinfo",
|
||||
"version": "1.1.8",
|
||||
"version": "1.1.9",
|
||||
"description": "Get movie detail with netflix id",
|
||||
"main": "index.js",
|
||||
"directories": {
|
||||
|
||||
Reference in New Issue
Block a user