使用 wget 下载 shtml 页面上的所有 zip 文件

Using wget to download all zip files on an shtml page

我一直在尝试将此网站上的所有 zip 文件下载到 EC2 服务器。但是,它无法识别链接,因此不会下载任何内容。我认为这是因为 shtml 文件需要启用 SSI,这在某种程度上导致了 wget 问题。但我真的不明白那些东西。

这是我一直使用失败的代码。

wget -r -l1 -H -t1 -nd -N -np -A.zip -erobots=off http://www.fec.gov/finance/disclosure/ftpdet.shtml#a2015_2016

感谢您提供的任何帮助!

源代码中没有 zip 链接,这就是为什么您无法通过 wget 下载它们,它们是通过 javascript 生成的。文件列表是 "located" inside http://fec.gov//finance/disclosure/tables/foia_files_summary.xml under node <fec_file status="Archive"></fec_file>

您可以编写脚本来解析 xml 文件并将节点转换为实际链接,因为它们有一个模式。


更新:

@cyrus所述,文件也在ftp.fec.gov/FEC/上,您可以使用wget -m镜像ftp和-A zip来限制下载压缩文件,即:

wget -A zip -m --user=anonymous --password=test@test.com ftp://ftp.fec.gov/FEC/

wget -r

wget -A zip --ftp-user=anonymous --ftp-password=test@test.com -r ftp://ftp.fec.gov/FEC/*