2016-10-06 7 views

答えて

0

は、ソリューションを自分自身を発見しました。表示されている文字を読むためには、エンコーディングをバイナリに指定する必要があります。以下のコードを参照してください。

 scraperjs.StaticScraper.create() 
     .request({ url:"http://vg.no", encoding: "binary"}) 
     .scrape(function($) { 
      return $("p").map(function() { 
       return $(this); 
      }); 
     }) 
     .then(function(domElements)......... 
0
const scraperjs = require('scraperjs'); 
const urlToScrape = 'http://www.somesite.com'; 
const selectorToScrape = "div#someId"; 
scraperjs.StaticScraper.create({ 
    url: urlToScrape, 
    encoding: "binary" 
}).scrape(function ($) { 
    return $(selectorToScrape).map(function() { 
     return $(this).text(); 
    }).get(); 
}).then(function (result) { 
console.log(result); 
}); 
関連する問題