bu fixes
This commit is contained in:
@@ -3,7 +3,8 @@ const GetFlix = require('../index');
|
|||||||
const getflix = new GetFlix('d9d6007d1bcf12043db5a085ae3e5bbb');
|
const getflix = new GetFlix('d9d6007d1bcf12043db5a085ae3e5bbb');
|
||||||
const getInfo = async () => {
|
const getInfo = async () => {
|
||||||
try {
|
try {
|
||||||
const info = await getflix.get(80209184, 'tr-TR');
|
const info = await getflix.get(80244780, 'tr-TR');
|
||||||
|
// info.credits.cast.forEach((f) => console.log(f.profile_path));
|
||||||
console.log(info);
|
console.log(info);
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -6,31 +6,35 @@ module.exports.getDetails = function (detailsId, movieOrTv, tmdbApiKey, language
|
|||||||
if (movieOrTv == 'movie' || movieOrTv == 'tv') {
|
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) => {
|
request(detailURL, (err, resultBody, body) => {
|
||||||
|
if (resultBody != '') {
|
||||||
|
const getJson = JSON.parse(resultBody.body);
|
||||||
|
|
||||||
const getJson = JSON.parse(resultBody.body);
|
if (getJson.status_code > 1) {
|
||||||
|
// if wrong api key error
|
||||||
if (getJson.status_code > 1) {
|
const error = 'tmdb get detail wrong api key error';
|
||||||
// if wrong api key error
|
|
||||||
const error = 'tmdb get detail wrong api key error';
|
|
||||||
const result = null;
|
|
||||||
cb(error, result);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (err) {
|
|
||||||
// if thmdb api connection error
|
|
||||||
const error = 'tmdb get detail api connection error';
|
|
||||||
const result = null;
|
const result = null;
|
||||||
cb(error, result);
|
cb(error, result);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const error = null;
|
if (err) {
|
||||||
const result = getJson;
|
// if thmdb api connection error
|
||||||
cb(error, result);
|
const error = 'tmdb get detail api connection error';
|
||||||
|
const result = null;
|
||||||
|
cb(error, result);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const error = null;
|
||||||
|
const result = getJson;
|
||||||
|
cb(error, result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
const error = 'tmdb get detail api connection error';
|
||||||
|
const result = null;
|
||||||
|
cb(error, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
Reference in New Issue
Block a user