从网页中提取HTML标签-使用R进行网页搜刮

时间:2019-12-31 06:35:03

标签: html r web-scraping rvest

所以我正试图从网站中提取标记(class =“ c16H9d”),并且出于某种原因,该标记是简单的html

这是该网站的html代码段:

> `<div class="c16H9d"><a age="0" href="//www.example.com/products/wellice-ginseng_collagen-shampoo-conditioner-i132502176-s1292713295.html?search=1" title="Wellice Ginseng_Collagen Shampoo + Conditioner">Wellice Ginseng_Collagen Shampoo + Conditioner</a></div>`

请注意,该类包含在其他类(产品,根目录等)中,我尝试在我的代码中引用所有它们(一个一个),但没有一个起作用。

这是我正在尝试的代码(R)

URL = "https://www.example.com/category/?page=2"
link = read_html(URL)
link
title = html_nodes(link, "div.c16H9d")
title

标题返回“ {xml_nodeset(0)}”,而不是我尝试提取的标题。

0 个答案:

没有答案