I have a Java project which uses platfor开发者_运维问答m specific libraries. They are quite large but I can figure out which ones I need in an installer and download them. I'd like to download them from Sourceforge (where the rest of my project lives).
Is there a way to do automatic downloads from SF?
How do I make sure the download use the best mirror?
If you append ?use_mirror=autoselect
to the path of your download (beginning with http://downloads.sourceforge.net/project/), SourceForge will send a 302 Found response to redirect you to your closest mirror. For example:
http://downloads.sourceforge.net/project/getgnuwin32/getgnuwin32/0.6.30/GetGnuWin32-0.6.3.exe?use_mirror=autoselect
Redirects to the following location for me:
http://superb-sea2.dl.sourceforge.net/project/getgnuwin32/getgnuwin32/0.6.30/GetGnuWin32-0.6.3.exe
In terms of downloading the latest version, you can parse the RSS feed for the project's files.
You can grab a download page (like http://sourceforge.net/projects/cpptest/files/cpptest/cpptest-1.1.0/cpptest-1.1.0.zip/download) and scan for Please use this <a href="http://downloads.sourceforge.net/project/.../...?use_mirror=..." class="direct-download">direct link</a>
with a regular expression. Then you have soure forge pick a mirror for you.
精彩评论