wget只保存第一行cookie


0

我想在使用wget时从特定网页下载并保存所有cookie。但是,wget只保存第一行。我希望wget中保存的Cookie与我正在查看的Cookie(例如Google Chrome开发人员工具)相同。

我使用的是:

wget "<website here>" --keep-session-cookies --save-cookies=cookies.txt

然后,当我检查cookies.txt时,它与在Google Chrome中加载“[website]”并在Developer Tools窗口中查看cookie不同。

如何在wget中下载并保存所有cookie? 谢谢。

Answers:


1

Wget只“看到”服务器设置的cookie。它不会处理JavaScript代码,因此您无法获得Google Analytics Cookie。

示例www.t3n.de: t3n Cookies Chrome

但是使用wget,这看起来像这样(没有找到cookie):

$ wget www.t3n.de -q --keep-session-cookies --save-cookies=cookies.txt -O /dev/null && cat cookies.txt
# HTTP cookie file.
# Generated by Wget on 2014-06-19 13:53:30.
# Edit at your own risk.
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.