0

Text mining on Amazon product review using R Program. I wasn't able to extract the particular product's review(i.e.If iphone 11 has 6k review, I need to extract all of it.) I'm getting only one column labelled x. enter image description here

Please let me know where I need to make necessary changes. I need those for performing sentiment analysis.

install.packages("rvest")    
library(rvest)
install.packages("xml2")
library(xml2)
install.packages("magrittr")    
library(magrittr)
url <-"https://www.amazon.in/Apple-iPhone-11-128GB-Black/product-reviews/B07XVLW7YK/ref=cm_cr_dp_d_show_all_btm?ie=UTF8&reviewerType=all_reviews"
apple <- NULL    
for(i in 1:100)
    {
      murl <- read_html(as.character(paste(url,i,sep = "=")))
      rev <- murl%>%
        html_nodes(".review-text")%>%
        html_text()
      apple <- c(apple,rev)
    }
Spacedman
  • 2,042
  • 12
  • 17

1 Answers1

0

Change your url to:

url <- "https://www.amazon.in/Apple-iPhone-11-128GB-Black/product-reviews/B07XVLW7YK/ref=cm_cr_arp_d_paging_btm_next_2?ie=UTF8&reviewerType=all_reviews&pageNumber"

Otherwise, as is what your current code is doing, you keep looping only the first page of reviews.

F.X.
  • 23
  • 3