From 944f4b8d8890e8a5ee9534395bfed85e3b957814 Mon Sep 17 00:00:00 2001 From: Wise Colt Date: Sat, 25 Apr 2020 02:54:09 +0300 Subject: [PATCH] bug fix url --- lib/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/index.js b/lib/index.js index 2130763..f9b6e0e 100644 --- a/lib/index.js +++ b/lib/index.js @@ -57,7 +57,6 @@ class FlixInfo { if (netflixButton != null) { - const imdbId = ($($('[class="imdbRatingPlugin"]')).attr('data-title')); const findTitle = ($($('[property="og:title"]')).attr('content')); const splitString = findTitle.split("-"); const title = splitString[0].split("(")[0].trim(); @@ -67,12 +66,13 @@ class FlixInfo { const netflixPoster = ($($('[class="img lazyload poster"]')).attr('data-src')); - if (imdbId && language) { + if (language) { // create (find) tmdb api url const tmdbURL = theMovieDbURL + 'search/' + type + '?api_key=' + tmdbApiKey + '&language=' + language + '&query=' + title + '&first_air_date_year=' + year; - - request(tmdbURL, (err, resultBody, body) => { + + request(encodeURI(tmdbURL), (err, resultBody, body) => { // Api find all result (for get tmdb id) + const getJson = JSON.parse(resultBody.body); if (getJson.status_code > 1) { @@ -143,7 +143,7 @@ class FlixInfo { } }); } else { - returnResult = { error: 1, errorMsg: 'imdb id or language parameters not found.' }; + returnResult = { error: 1, errorMsg: 'anguage parameters not found.' }; reject(returnResult) } }