Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 205372

Extracting HTML tags from a webpage - Web Scraping with R

$
0
0

so I am trying to extract the tag (class = "c16H9d") from a website and for some reason the simple html

Here is the html snippet of the site:

> `<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>`

Please note that this class is enclosed in further classes (products, root etc.), and I have tried to reference all of them (one by one ) in my code but none of them worked.

Here is the code that I am trying (R)

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

The title is returning "{xml_nodeset (0)}" rather than the title I am trying to extract.


Viewing all articles
Browse latest Browse all 205372

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>