我想使用WGET从某个网站的会员区下载一些图片。该网站受到密码保护。我已经成功登录并保存了cookies。然而,由于302重定向,我仍然无法下载图片。能否有人帮我看看这个问题?非常感谢。
wget --load-cookies=examplecookies http://members.example.com/membersarea/0004.jpg
--2010-12-18 18:58:50-- http://members.example.com/membersarea/0004.jpg
Resolving members.example.com... 12.34.56.78
Connecting to members.example.com|12.34.56.78|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: /login.aspx?ReturnUrl=%2fmembersarea%2f0004.jpg [following]
--2010-12-18 18:58:50-- http://members.example.com/login.aspx?ReturnUrl=%2fmembersarea%2f0004.jpg
Reusing existing connection to members.example.com:80.
HTTP request sent, awaiting response... 302 Found
Location: /membersarea/default.aspx [following]
--2010-12-18 18:58:50-- http://members.example.com/membersarea/default.aspx
Reusing existing connection to members.example.com:80.
HTTP request sent, awaiting response... 200 OK
Length: 61898 (60K) [text/html]
Saving to: `default.aspx'
100%[===================================================================================>] 61,898 --.-K/s in 0.1s
2010-12-18 18:58:51 (572 KB/s) - `default.aspx' saved [61898/61898]
default.aspx
是会员区的首页,这意味着我已经成功登录。
我进行了一些谷歌搜索,并添加了 --user-agent="Mozilla/4.0"
,但仍然无法正常工作:
wget --user-agent="Mozilla/4.0" --load-cookies=examplecookies http://members.example.com/membersarea/0004.jpg
结果是一样的。
非常感谢!