LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Bash Shell Programming with elinks command in linux (https://www.linuxquestions.org/questions/programming-9/bash-shell-programming-with-elinks-command-in-linux-720448/)

madmatrix 04-20-2009 12:03 PM

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

H_TeXMeX_H 04-20-2009 12:56 PM

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'.

kike_coello 04-22-2009 08:09 PM

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.


All times are GMT -5. The time now is 01:55 AM.