在安装过程中从Sourceforge自动下载

时间:2010-02-24 14:35:07

标签: java download sourceforge

我有一个使用平台特定库的Java项目。它们非常大,但我可以在安装程序中弄清楚我需要哪些并下载它们。我想从Sourceforge下载它们(项目的其余部分存在)。

有没有办法从SF进行自动下载?

如何确保下载使用最佳镜像?

2 个答案:

答案 0 :(得分:4)

如果您将?use_mirror=autoselect附加到下载路径(以 http://downloads.sourceforge.net/project/ 开头),则SourceForge会发送302 Found响应以将您重定向到最近的镜像。例如:

http://downloads.sourceforge.net/project/getgnuwin32/getgnuwin32/0.6.30/GetGnuWin32-0.6.3.exe?use_mirror=autoselect

为我重定向到以下位置:

http://superb-sea2.dl.sourceforge.net/project/getgnuwin32/getgnuwin32/0.6.30/GetGnuWin32-0.6.3.exe

在下载最新版本方面,您可以解析项目文件的RSS源。

答案 1 :(得分:0)

您可以抓取下载页面(例如http://sourceforge.net/projects/cpptest/files/cpptest/cpptest-1.1.0/cpptest-1.1.0.zip/download)并使用正则表达式扫描Please use this <a href="http://downloads.sourceforge.net/project/.../...?use_mirror=..." class="direct-download">direct link</a>。然后你就会为你挑选一面镜子。