Quantcast
Channel: Data Science, Analytics and Big Data discussions - Topics tagged data_science
Viewing all articles
Browse latest Browse all 787

Web Scrapping from AMAZON.IN in R

$
0
0

@knowpallav wrote:

I'm trying to scrape reviews from Amazon using the following code in R (using CSS selector gadget)
library(rvest)
library(XML)

Amazon Reviews

aurl <- "https://www.amazon.in/Apple-MMGF2HN-13-3-inch-Integrated-Graphics/product-reviews/B01FUK9TKG/ref=cm_cr_arp_d_paging_btm_2?showViewpoints=1&pageNumber="
amazon_reviews <- NULL
for (i in 1:10){
murl <- read_html(as.character(paste(aurl,i,"")))
rev <- murl %>%
html_nodes(".review-text") %>%
html_text()
amazon_reviews <- c(amazon_reviews,rev)
}
write.table(amazon_reviews,"apple.txt")

I'm running the loop to extract from page 1 to 10, but the output is coming as page 1 pasted 10 times and not reviews from page 1 to 10.

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 787

Trending Articles