Surya-Murali / Web-Scraping-and-Amazon-Reviews-Analysis

A Web Scraping project to analyze product reviews in Amazon.com. A sentiment analysis is done and the reviews are sorted and highlighted in green or red based on the sentiment score.
https://github.com/Surya-Murali/Web-Scraping-and-Amazon-Reviews-Analysis
18 stars 10 forks source link

Error in data.frame #1

Closed HRK777 closed 4 years ago

HRK777 commented 5 years ago

Hey all,

first of all: Thank you for the development of this crawler! It should be a great help for my studies!

However, I get an error message when ultimately running the amazon_scraper command:

reviews <- amazon_scraper(doc, reviewer = F, delay = 2) #here comes the error message

Hide Traceback

Rerun with Debug

Error in data.frame(title, author, date, ver.purchase, format, stars, :

arguments imply differing number of rows: 10, 0

3.

stop(gettextf("arguments imply differing number of rows: %s",

paste(unique(nrows), collapse = ", ")), domain = NA)

2.

data.frame(title, author, date, ver.purchase, format, stars,

comments, helpful, stringsAsFactors = F) at amazonscraper.R#57

1.

amazon_scraper(doc, reviewer = F, delay = 2)

Does somebody have a clue what the reason could be? I attach my script & environment, thank you!

Script_AmazonScraper.txt

Dee107 commented 5 years ago

Hey all,

first of all: Thank you for the development of this crawler! It should be a great help for my studies!

However, I get an error message when ultimately running the amazon_scraper command:

reviews <- amazon_scraper(doc, reviewer = F, delay = 2) #here comes the error message

Hide Traceback

Rerun with Debug

Error in data.frame(title, author, date, ver.purchase, format, stars, :

arguments imply differing number of rows: 10, 0

3.

stop(gettextf("arguments imply differing number of rows: %s",

paste(unique(nrows), collapse = ", ")), domain = NA)

2.

data.frame(title, author, date, ver.purchase, format, stars,

comments, helpful, stringsAsFactors = F) at amazonscraper.R#57

1.

amazon_scraper(doc, reviewer = F, delay = 2)

Does somebody have a clue what the reason could be? I attach my script & environment, thank you!

Script_AmazonScraper.txt

i am also facing same issue

Surya-Murali commented 4 years ago

Hi, Amazon.com had changed the HTML code of the reviews page. Due to different HTML nodes, the part of the script to extract 'author', and 'helpful votes' returned nothing. The differing number of rows caused the error in the data frame.

I added the right HTML tags in the code, but still removed 'author' and 'helpful votes' from the data frame.

It should work now.