トプラインデータポイント(総GHG、1人当たりGHG、BTUあたりのGHG)を削り取り、次のページからRとphantom.js:Rとphantom.js:メインコンテンツブロックをスクラップできません
http://apps1.eere.energy.gov/sled/#/results/home?city=Omaha&abv=NE
これは私のコードです:CLASSは私はまだ確認されていませんクラスです
url <- "http://apps1.eere.energy.gov/sled/#/results/home?city=Omaha&abv=NE"
writeLines(sprintf("var page = require('webpage').create();
page.open('%s', function() {
console.log(page.content); //page source
phantom.exit();
});", url), con="scrape.js")
system("phantomjs scrape.js > eere.html")
pg <- read_html("eere.html")
pg %>% html_nodes("CLASS") %>% html_text()
。 Here's the html I'm getting for eere.html.ヘッダーとフッターの内容のみが含まれており、ページの本文を取得できません。
任意のアドバイスはありますか? RSelenium経由PhantomJSで
Rから直接PhantomJSを[RSelenium](https://ropensci.github.io/RSelenium/)経由で使用することができます。あるいは、そのサイトは、そのデータを再作成するための良いデータダウンロードオプションと方法論を持っています。 – alistaire
ありがとう!私はAPIを認識していますが、私はなぜ学習目的のためにスクレイプでメインコンテンツをうまく引き出していないのかを知りたいと思っています。私はRSeleniumを見ていきます。 – heyjay