Skip to Main Content
Amazon Hacks
book

Amazon Hacks

by Paul Bausch
August 2003
Intermediate to advanced content levelIntermediate to advanced
304 pages
7h 33m
English
O'Reilly Media, Inc.
Content preview from Amazon Hacks

Send an Email Alert if a Review Is Added to a Product

This script keeps an eye on Amazon and notifies you when a new review is posted.

There are obviously some products you care about more than others, and it’s good to be aware of how those products are perceived. Reviews give feedback to publishers, authors, and manufacturers, help customers make buying decisions, and help other retailers decide what to stock. If you want to monitor all the reviews for a product or set of products, visiting each product detail page to see if a new review has been added is a tedious task.

Instead, you can use a script to periodically check the number of reviews for a given item, and have it send you an email when a new review is added.

The Code

You’ll need two nonstandard Perl modules to run this code: LWP::Simple to make the AWS (Amazon Web Services) request, and XML::Simple to parse the results. The combination provides a simple way to access AWS XML over HTTP with Perl [Hack #80]. Create a file called review_monitor.pl with the following code:

#!/usr/bin/perl
# review_monitor.pl
#
# Monitors products, sending email when a new review is added
# Usage: perl review_monitor.pl <asin>
use warnings;
use strict;
use LWP::Simple;
use XML::Simple;

# Your Amazon developer's token. 
my $dev_token='insert developer token';

# Your Amazon affiliate code. 
my $af_code='insert affiliate code';

# Location of sendmail and your email.
my $sendmailpath = 'insert sendmail path';
my $emailAddress = 'insert email address' ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

From ChatGPT to HackGPT: Meeting the Cybersecurity Threat of Generative AI

From ChatGPT to HackGPT: Meeting the Cybersecurity Threat of Generative AI

Karen Renaud, Merrill Warkentin, George Westerman
Incident Metrics in SRE

Incident Metrics in SRE

Stepan Davidovic

Publisher Resources

ISBN: 0596005423Supplemental ContentCatalog PageErrata