這裏是我跑Rvest刮錯誤
library(rvest)
rootUri <- "https://github.com/rails/rails/pull/"
PR <- as.list(c(100, 200, 300))
list <- paste0(rootUri, PR)
messages <- lapply(list, function(l) {
html(l)
})
直到此時它似乎做工精細的代碼,但是當我嘗試提取文本:
html_text(messages)
我得到:
Error in xml_apply(x, XML::xmlValue, ..., .type = character(1)) :
Unknown input of class: list
試圖提取一個特定的元素:
html_text(messages[1])
不能做,要麼...
Error in xml_apply(x, XML::xmlValue, ..., .type = character(1)) :
Unknown input of class: list
於是我嘗試用不同的方式:
html_text(messages[[1]])
這似乎在數據至少可以得到,但仍然沒有成功的:
Error in UseMethod("xmlValue") :
no applicable method for 'xmlValue' applied to an object of class "c('HTMLInternalDocument', 'HTMLInternalDocument', 'XMLInternalDocument', 'XMLAbstractDocument')"
如何從列表中的每個元素中提取文本材料?
你爲什麼不使用GitHub的API?它有[pull requests](https://developer.github.com/v3/pulls/)的動詞。 – hrbrmstr 2014-12-05 18:38:07
github API將註釋分成多個類別(問題,拉取請求,提交),這意味着我必須編寫一個相對複雜的查詢。在網絡上,我將所有這些集中在一個頁面中。 – histelheim 2014-12-05 19:21:08