From a172c42b023bb73b41052b480552cede61f744f7 Mon Sep 17 00:00:00 2001 From: Alex Nault Date: Thu, 21 May 2015 19:40:25 -0400 Subject: [PATCH] Fix casting multi-lang support --- lib/projection.js | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/lib/projection.js b/lib/projection.js index 735432d..a3e1ecf 100644 --- a/lib/projection.js +++ b/lib/projection.js @@ -87,14 +87,17 @@ Projection.prototype.findMovie = function(near, movie, options, callback) { var content = m.find('.desc .info').not('.info.links').html().split('
'); - var persons = $(content[1]).text(); - //console.log(persons); - var categories = persons.split(' - '); - var director = categories[0].replace('Director: ', ''); // TODO must be multi-lang - var cast = categories[1].replace('Cast: ', '').split(', '); - var infos = formatInfos(content[0].split(' - ')); + var persons = $('
' + content[1] + '
');//.text(); + + var director = persons.find('span[itemprop="director"]').text().trim(); + + var cast = []; + persons.find('span[itemprop="actors"]').each(function(gg, a) { + cast.push($(a).text().trim()); + }); + var trailer = null; if (m.find('.info a').attr('href') && (m.find('.info a').attr('href').match(/(youtube|vimeo|daily)/))) { trailer = m.find('.info a').attr('href').replace('/url?q=', '').trim(); @@ -184,12 +187,12 @@ var formatShowtimes = function(showtimes) { }); }; -// var p = new Projection(); +var p = new Projection(); // p.findTheaters('Sherbrooke', {}, function(err, theaters) { // console.log(theaters[2].movies[0]); // }); -// p.findMovie('Sherbrooke', 'Mad Max', { hl:'fr'}, function(err, movie) { -// console.log(movie); -// }); +p.findMovie('Sherbrooke', 'Mad Max', { hl:'fr'}, function(err, movie) { + console.log(movie); +}); module.exports = Projection; \ No newline at end of file