0
私はPhantomJSを使用して、Twitterページからいくつかのデータを取り出しています。ここで私はスクラップしようとしているサンプルコンテンツです:特定の要素名によるデータのスクラップ - PhantomJS
<span class="ProfileTweet-action--reply u-hiddenVisually">
<span class="ProfileTweet-actionCount" data-tweet-stat-count="541">
<span class="ProfileTweet-actionCountForAria" data-aria-label-part>541 replies .</span>
</span>
</span>
これは回答がカウント取得するための私のコードです:
var replyCount = page.evaluate(function(){
return document.getElementsByClassName("ProfileTweet-action--reply");
});
for (var i = 0; i < replyCount.length; i++) {
var replyInt = replyCount[i].innerText;
console.log(replyInt);
}
出力は541 replies
あるスクラップにする方法がありますdata-tweet-stat-count
の値なので、私は "541"を得ることができますか?
他の要素も同じページにあるdata-tweet-stat-count
という名前です。誰も私にこれを導くことができますか?