Closed 0c0de closed 6 years ago
Also please convert the images to the high quality images and example is available in the lib/photo.js
also convert the image url to high quality
I'm unable to get high quality image working because return undefined the url so I cannot modify it and because of this, node server throws an error but it is strange because with a console.log I can see that all is correct and urls printed are in the correct format... :thinking: this is my code BTW. Do you know why happens this? :thinking:
function searchActor(keyword){
return request(`https://www.imdb.com/find?ref_=nv_sr_fn&q=${keyword}&s=nm`).then((data) => {
const $ = cheerio.load(data);
let result = [];
console.log(keyword);
result.push({
searchQuery: keyword
});
$('tr').each((index, element) => {
var image = $(element).find('td.primary_photo > a > img').attr('src');
var name = $(element).find('td.result_text > a').text();
image = JSON.stringify(image);
image = image.split("@._")[0] += '@._V1_UX1024_CR1024,1024,0,0_AL_.jpg"';
console.log(image);
result.push({
actorImage: image,
actorName: name
});
});
return result;
}).catch(ifError)
}
Just put in try catch block
It is ok now? :thinking:
Now have the id
Fixes issue
6