phantomjs を使用して Web サイトからデータを取得する単純な Web スクレーパーを作成します。querySelectorAll を使用して必要なコンテンツを取得すると、うまくいきません。これが私のコード全体です。
var page = require('webpage').create();
var url = 'https://www.google.com.kh/?gws_rd=cr,ssl&ei=iE7jV87UKsrF0gSDw4zAAg';
page.open(url, function(status){
if(status === 'success'){
var title = page.evaluate(function(){
return document.querySelectorAll('.logo-subtext')[0].textContent;
});
console.log(title);
}
phantom.exit();
});
これを解決するのを手伝ってください。
本当にありがとう。