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) } }