N
N
nezzard2017-02-02 22:23:41
Node.js
nezzard, 2017-02-02 22:23:41

How to get the correct answer when parsing?

Good afternoon, I'm trying to parse kinopoisk through request, when I pull out the name of the movie, I get
'������' in response.
'������'
How to get the right answer?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
nezzard, 2017-02-02
@nezzard

var options = {
          method: 'GET',
          uri: 'https://www.kinopoisk.ru/index.php?first=no&what=&kp_query='+encodeURIComponent(filmName),
          json: true
      };

      rp(options)
          .then(function (htmlString) {        
              $ = cheerio.load(htmlString);
              var poster = $('.most_wanted>.pic>a>img').attr('title');
              var title = $('.most_wanted>.info>.name>a').html();
              console.log(title );
              var filmData = new Array({poster: poster, title: title});
              resolve(filmData);
          })
          .catch(function (err) {
              // Crawling failed... 
      });

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question