Text mining in Amazon product review using R. I wasn't able to extract the particular product's review

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.

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=UTF8reviewerType=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)

}

write.table(apple,apple1.txt,row.names = TRUE,col.names = TRUE,fileEncoding = utf-8-mac)

apple-read.csv(file.choose())

View(apple)

Topic document-term-matrix information-extraction sentiment-analysis text-mining r

Category Data Science


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.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.