[问题]wget 问题.高手来看,菜鸟也来学学

上网、浏览、聊天、下载等
回复
ychristian
帖子: 47
注册时间: 2007-07-17 14:36

[问题]wget 问题.高手来看,菜鸟也来学学

#1

帖子 ychristian » 2008-06-04 18:09

我有一个需要登录才能下载的东西,是一个网站的后台数据库.

我想用wget,在shell里面直接下载下来.怎么做?

我想到用cookie,发现wget里有cookie的选项
-U, --user-agent=AGENT identify as AGENT instead of Wget/VERSION.
--no-http-keep-alive disable HTTP keep-alive (persistent connections).
--no-cookies 不使用cookies.
--load-cookies=FILE 在会话前从文件中读取cookies。

但是我不知道这个cookie怎么获得?比如firefox.或者ie的.

wget的man是这样写的.

--load-cookies file
Load cookies from file before the first HTTP retrieval. file is a textual file in the
format originally used by Netscape's cookies.txt file.

You will typically use this option when mirroring sites that require that you be
logged in to access some or all of their content. The login process typically works
by the web server issuing an HTTP cookie upon receiving and verifying your creden-
tials. The cookie is then resent by the browser when accessing that part of the site,
and so proves your identity.

Mirroring such a site requires Wget to send the same cookies your browser sends when
communicating with the site. This is achieved by --load-cookies---simply point Wget
to the location of the cookies.txt file, and it will send the same cookies your
browser would send in the same situation. Different browsers keep textual cookie
files in different locations:

Netscape 4.x.
The cookies are in ~/.netscape/cookies.txt.

Mozilla and Netscape 6.x.
Mozilla's cookie file is also named cookies.txt, located somewhere under
~/.mozilla, in the directory of your profile. The full path usually ends up look-
ing somewhat like ~/.mozilla/default/some-weird-string/cookies.txt.

Internet Explorer.
You can produce a cookie file Wget can use by using the File menu, Import and
Export, Export Cookies. This has been tested with Internet Explorer 5; it is not
guaranteed to work with earlier versions.

Other browsers.
If you are using a different browser to create your cookies, --load-cookies will
我试验了一下,似乎不成功阿.cookie是load了.但是还是不允许下载?

高手来解答一下?怎么办?
头像
Strange
帖子: 1824
注册时间: 2006-05-19 9:54
来自: Shanghai

#2

帖子 Strange » 2008-06-04 19:32

cookies其实就是一串字符串,你把其他网站的cookies复制到自己的文件就可以了
比如firefox
tools-option-privacy-show cookies
ニンニク入れますか?
x60 with gentoo
回复