Phantomjs与R.

时间:2017-07-10 14:39:53

标签: r phantomjs rvest

我正在尝试从网页上抓取数据。由于页面有动态内容,我使用 phantomjs 来处理。但是,根据我使用的代码,我可以下载网页上看到的数据。但是,我需要输入日期范围,然后提交以获取我想要的所有数据。

以下是我使用的代码,

library(xml2)
library(rvest)

connection <- "pr.js"  

writeLines(sprintf("var page=require('webpage').create();
var fs = require('fs');
    page.open('%s',function(){
    console.log(page.content);//page source;
    fs.write('pr.html', page.content, 'w');
    phantom.exit();
    });",url),con=connection)

system_input <- paste(path,"phantomjs"," ",connection,sep="")

system(system_input)

感谢代码,我有动态创建的网页的html输出。

正如我所说,我还需要提交日期输入。但我无法实现。

网址为:https://seffaflik.epias.com.tr/transparency/piyasalar/gop/ptf.xhtml

0 个答案:

没有答案