📅  最后修改于: 2022-03-11 14:56:02.250000             🧑  作者: Mango
u <- "http://stackoverflow.com/questions/tagged?tagnames=r"
doc.raw <- getURL(u)
doc <- tidyHTML(doc.raw)
html <- htmlTreeParse(doc, useInternal = TRUE)
txt <- xpathApply(html, "//body//text()[not(ancestor::script)][not(ancestor::style)][not(ancestor::noscript)]", xmlValue)
cat(unlist(txt))