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

WebScraping Amazons Books Names

$
0
0

I am trying to webscrape Amazon's books names:

rm(list = ls())

library(rvest)
library(XML)
library(xml2)
url_amazon <- 'https://www.amazon.com/s/browse?_encoding=UTF8&node=283155&ref_=nav_shopall-export_nav_mw_sbd_intl_books'

web_page<-read_html(url_amazon)

By CSS SELECTOR:

rank_titles<-html_text(html_nodes(web_page,".a-link-normal .a-size-base"))

BY XPATH SELECTOR:

rank_titles<-html_text(html_nodes(web_page,xpath='//span[@class="a-size-base"]'))

But the names of the books are not in order. Why? What am I doing wrong?

Any help?


Viewing all articles
Browse latest Browse all 201945

Trending Articles