javascript - 使用 R 抓取 JavaScript 繁重的网页
问题描述
我希望使用 Rvest 和 V8 在 R 中抓取公开可用的地块描述。但是,我很难通过页面上的 JavaScript,因为它是高度动态的。这是我到目前为止的代码:
GISurl <- "https://hosting.tighebond.com/plainfieldct_public/##info-address"
GIS <- read_html(GISurl)
owners <- GIS %>% html_nodes("div.owner") %>% html_text()
# Create a new v8 context
ct <- v8()
#parse the html content from the js output and print it as text
read_html(ct$eval(gsub('document.write','', owners))) %>% html_text()
我不断收到一条错误消息,内容如下:
context_eval(join(src), private$context, serialize) 中的错误:ReferenceError: parcel 未定义。
据我了解,该消息正在弹出,因为 R 不知道我想要来自哪块土地的数据。我将如何从所有包裹(而不是特定的预定包裹)中提取数据?
解决方案
推荐阅读
- javascript - 如何获取被点击事件的具体日期
- android - 使用回收站视图时如何取回选择了哪个单选按钮的数据
- javascript - 如何使用 ES6 模块导入惰性加载和同位素?
- php - 从服务器(下载服务器或 s3 或任何云服务器)下载流文件的最佳方法是什么?
- mysql - MySQL:如何将大型数据表(近 800 亿行)分解为多个表
- java - Swagger:为特定@Api路径下的所有请求定义通用参数
- java - 如何使用 iText 读取 PDF 文件作为模板
- c# - C# 使用 Microsoft.Office.Interop.Excel 添加新 SERIES 与其他 WorkSheet 的范围
- excel - 即使方法存在于工作表中
- swift - Facebook GraphRequest for Swift 5 和 Facebook SDK 5