【发布时间】:2016-01-09 05:08:31
【问题描述】:
我正在抓取页面Crickbuzz scores 以获取比赛详情。我正在使用选择器小工具来获取 css 标记。到目前为止我所做的事情是:
crickbuzz <- read_html(httr::GET("http://www.cricbuzz.com/cricket-match/live-scores"))
matches_dates <- crickbuzz %>%
html_nodes(".schedule-date:nth-child(1)") %>%
html_text()
我已获取比赛、比分和场地,但难以获取日期。 我从上面的代码得到以下结果
> matches_dates
" - " " - " " " " " " " " " " "
" " " " " " " - " " - " " - "
表示获取21个元素,也就是目前有21个匹配,但没有获取文本。
然后我看到了 html_nodes() 中的内容 它就像:
{xml_nodeset (21)}
1 <span class="schedule-date" timestamp="1452132000000" format="MMM dd'">
</span>
2 <span class="schedule-date" timestamp="1452132000000" format="MMM dd'">
</span>
3 <span class="schedule-date" timestamp="1452132000000" format="MMM dd'">
</span> and so on....
这意味着我没有从标签中获取文本。 该怎么做?
【问题讨论】: