【发布时间】:2019-09-24 12:35:30
【问题描述】:
我正在尝试从website 中的时间元素获取日期,但结果为 NA。
url <- "https://www.trustpilot.com/review/www.spotify.com"
dates <- read_html(url) %>%
html_nodes("div.review-content-header__dates") %>%
html_attr("datetime")
怎么了?
提前致谢。
【问题讨论】:
-
上面没有这样的节点名!
-
你想要哪个日期?发布日期?您定位的节点包含:
<div class="review-content-header__dates"> <script type="application/json" data-initial-state="review-dates"> {"publishedDate":"2019-09-12T08:00:12Z", "updatedDate":null,"reportedDate":null} ... -
@Chelmy88 发布日期。
标签: r web-scraping rvest