At 04:27 PM 8/10/2008, you wrote:
Hash: SHA1

Rick Nakroshis wrote:
> Micah,
> If you will excuse a quick question about Wget, I'm trying to find out
> if I can use it to download a page from Yahoo that requires me to be
> logged in using my Yahoo profile name and password.  It's a display of a
> CSV file, and the only wrinkle is trying to get past the Yahoo login.
> Try as I may, I just can't seem to find anything about Wget and Yahoo.
> Any suggestions or pointers?

Hi Rick,

In the future, it's better if you post questions to the mailing list at; I don't always have time to respond.

The easiest way to do what you want may be to log in using your browser,
and then tell Wget to use the cookies from your browser, using
- --load-cookies=<path-to-browser's-cookies>. Of course, this only works
if your browser saves its cookies in the standard text format (Firefox
prior to version 3 will do this), or can export to that format (note
that someone contributed a patch to allow Wget to work with Firefox 3
cookies; it's linked from, it's
unoffocial so I can't vouch for its quality).

Otherwise, you can perform the login using Wget, saving the cookies to a
file of your choice, using --post-data=..., --save-cookies=cookies.txt,
and probably --keep-session-cookies. This will require that you know
what data to place in --post-data, which generally requires that you dig
around in the HTML to find the right form field names, and where to post

For instance, if you find a form like the following within the page
containing the log-in form:

<form action="/doLogin.php" method="POST">
  <input type="text" name="s-login">
  <input type="password" name="s-pass">

then you need to do something like:

  $ wget --post-data='s-login=USERNAME&s-pass=PASSWORD' \
    --save-cookies=my-cookies.txt --keep-session-cookies \

(Note that you _don't_ necessarily send the information to the page that
 had the login page: you send it to the spot mentioned in the "action"
attribute of the password form.)

Once this is done, you _should_ be able to perform further operations
with Wget as if you're logged in, by using

  $ wget --load-cookies=my-cookies.txt --save-cookies=my-cookies.txt \
    --keep-session-cookies ...

(I'm going to put this up on the Wgiki Faq now, at

- --
Micah J. Cowan
Programmer, musician, typesetting enthusiast, gamer.
GNU Maintainer: wget, screen, teseq
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla -



Thank you for taking the time to answer so thoroughly, and doing so promptly, too. You've given me a great boost forward, and I appreciate it.

Thank you, sir!


Reply via email to