LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-24-2008, 07:57 AM   #1
suse_nerd
Member
 
Registered: May 2008
Distribution: SuSe
Posts: 50

Rep: Reputation: 15
amazon: logging in and saving page automatically, repeated action


Hi,

I am trying to hack up a quick script which logs into my amazon.co.uk seller account, checks the page to see if all my items are marked as low price and then sends me an email if they're not. I'm using bash at the moment.

I tried using lynx, but it comes unstuck on logging in, with amazon.co.uk claiming cookies aren't enabled. Other text-only browsers seem to not support key-stroke logs so I cannot run a session automatically like that.

The other solution would be to use perl or php. Can anybody give me any starters?

thanks

Here is my script so far by the way...

Code:
#might need absolute paths#


#do login with lynx#

#parse file#

email=0
NOITEMS=`cat list-inventory.html | grep "<strong>" | sed '$!d' |  sed -e :a -e 's/<[^>]*>//g;/</N;//ba'`

NOLOW=`cat list-inventory.html | grep "alt=\"Low Price"\" |  sed -n '$='`

#check all items are low price#

 if [ $NOITEMS = $NOLOW ]; then
               echo "All items at low price"
            else
               echo "Some items not low price!"
               let email=1

fi


#send email#

if [ $email = 1 ]; then
echo "SENDING EMAIL....";
fi

#Quick debug# 

echo $email
echo $NOLOW
echo $NOITEMS
 
Old 09-24-2008, 08:00 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
In Perl I'd use WWW::Mechanize http://search.cpan.org/~petdance/WWW...W/Mechanize.pm
 
Old 09-24-2008, 08:42 AM   #3
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Did you try start lynx with: lynx -accept_all_cookies
 
Old 09-24-2008, 10:38 AM   #4
suse_nerd
Member
 
Registered: May 2008
Distribution: SuSe
Posts: 50

Original Poster
Rep: Reputation: 15
@Keefaz. Yes I cetainly did. Perhaps I need to start at the amazon.co.uk homepage and navigate all the way through rather than just trying to link to the seller account page straight away....

Edit: No that didn't work.

Last edited by suse_nerd; 09-24-2008 at 10:41 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Dynamic Content - Page Failure Local Action LXer Syndicated Linux News 0 07-15-2008 08:50 PM
Mouse action reverts when logging back on tetpt Linux - Newbie 1 01-12-2006 10:44 AM
How do I automate saving a page on my site every day? kiltannen Linux - General 2 05-30-2005 09:12 PM
automatically logging into XWindows ironcrouton Linux - Newbie 2 12-16-2004 06:44 AM
automatically logging in? bobbens Debian 2 11-01-2004 05:49 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:59 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration