花了大约一个小时从Sourceforge下载几乎每个Msys软件包后,我想知道是否还有更聪明的方法可以做到这一点。可以将wget用于此目的吗?
最佳答案
我已经成功使用了此脚本:
https://github.com/SpiritQuaddicted/sourceforge-file-download
供您使用:
sourceforge-file-downloader.sh msys
它应该先下载所有页面,然后在页面中找到实际的链接并下载最终文件。
从项目描述:
万一仓库被删除,以防万一,我会在这里发布它,因为它足够短:
#!/bin/sh
project=$1
echo "Downloading $project's files"
# download all the pages on which direct download links are
# be nice, sleep a second
wget -w 1 -np -m -A download http://sourceforge.net/projects/$project/files/
# extract those links
grep -Rh direct-download sourceforge.net/ | grep -Eo '".*" ' | sed 's/"//g' > urllist
# remove temporary files, unless you want to keep them for some reason
rm -r sourceforge.net/
# download each of the extracted URLs, put into $projectname/
while read url; do wget --content-disposition -x -nH --cut-dirs=1 "${url}"; done < urllist
rm urllist
关于wget - 如何从特定Sourceforge项目下载所有文件?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/3390379/