【发布时间】:2017-05-16 22:00:41
【问题描述】:
我正在尝试从嵌入在 div 标签中的锚标签中获取文本。以下是网站链接`http://mmb.moneycontrol.com/forum-topics/stocks-1.html
我要提取的文字是Mawana Sugars
<a href="/forum-topics/stocks/mawana-sugars-245010.html" class="op_bld16 anch_pb7">Mawana Sugars</a>
所以我想提取该网站上列出的所有股票名称及其描述。
这是我在 R 中的尝试
doc <- htmlParse("http://mmb.moneycontrol.com/forum-topics/stocks-1.html")
xpathSApply(doc,"//div[@class='clearfix PR PB5']//text()",xmlValue)
但是,它不返回任何东西。我如何在 R 中做到这一点?
【问题讨论】:
标签: r