LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 04-20-2009, 12:03 PM   #1
madmatrix
LQ Newbie
 
Registered: Apr 2009
Posts: 6

Rep: Reputation: 0
Bash Shell Programming with elinks command in linux


Hi there,

I tried elinks in Fedora 10. It's really cool text mode browser. But it seems not the one I want. What I want to do is:

1st step: Open one webpage. I can just simply write the command in my script: elinks www.myexampleweb.com

2nd step: Move to the user and password field to input user name and password to log in. Can't find the option in elinks command. I want to use one command in script to feed the form and don't want to manualy input them.

3rd step: Click one link by text. I did this in one script language in Windows OS with IE browser. But I can't find similar option in elinks.

The biggest difficult is how to write the command one by one to execute the sequential action of browsing. I mean if elinks can return the handle for the current browsing session. Then the following command can use that handle to continue to browse. Like:

$handle = `elinks www.myexampleweb.com`
elinks $handle -option1
elinks $handle -option2
....

How can I get this automatic browsing done by elinks? Any help is appreciated.

Lou
 
Old 04-20-2009, 12:56 PM   #2
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
I don't think elinks is readily capable of what you want. It can be extended via lua and other scripting languages, but I'm quite sure it cannot do what you say without plenty of modification.

I would use curl for such a thing:
http://curl.linux-mirror.org/
there's plenty of documentation on the site, you can also see 'man curl'.
 
Old 04-22-2009, 08:09 PM   #3
kike_coello
Member
 
Registered: Jul 2005
Location: maryland
Distribution: Ubuntu 9.04
Posts: 88

Rep: Reputation: 17
Well I had a similar problem that I solved with a shell script and elinks. I wanted to download a lot of guitar tabs from azchords.com instead of downloading songs individually because it was to time consuming and every song came in a separate window in Firefox. Anyways, what i did was look that the html code and figure out what parts of the links where changing with different clicks on links. Then once I got to the final page where I wanted to download something I parsed the final url into elinks and dumped it on the screen (I think the option is -dump or something, look it up in the manpages). Then, once I knew that my output was what I wanted I redirected the output from elinks into a file. So the final command in my script was something like:

elinks -dump www.whatever.com > output_file.txt

Not entirely sure about the option, I'm on Vista right now so I can't double check. Really hope that helps, if not, I'll try to see if I can find the script I used and post it here so you can run it and modify it so that it works for you.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Bash Shell Programming CheeSen Programming 5 09-07-2008 01:36 AM
Linux command shell bash for pg backroger Linux - Software 4 07-27-2008 09:03 PM
bash shell programming vivek_kumbhar Linux - General 4 04-12-2004 07:13 AM
Shell Programming (BASH) nny0000 Programming 2 01-13-2004 05:53 PM

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

All times are GMT -5. The time now is 09:28 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