我正在编写一个脚本,需要从sourceforge下载发布文件。如何获取正确的链接?
这个问题和它的回答在2013年已经给出,但现在不再适用了。 https://unix.stackexchange.com/questions/86971/how-do-i-download-from-sourceforge-with-wget
$ wget 'http://downloads.sourceforge.net/project/romfs/genromfs/0.5.2/genromfs-0.5.2.tar.gz'
Saving to: ‘download?use_mirror=vorboss.html’
更新:在@vookimedlo的答案后记录日志:
$ ls -ld $(which wget)
lrwxr-xr-x 1 david admin 30 Mar 29 16:17 /usr/local/bin/wget -> ../Cellar/wget/1.19.1/bin/wget
$ wget --version
GNU Wget 1.19.1 built on darwin16.4.0.
-cares +digest -gpgme +https +ipv6 -iri +large-file -metalink -nls
+ntlm +opie -psl +ssl/openssl
Wgetrc:
/Users/david/.wgetrc (user)
/usr/local/etc/wgetrc (system)
Compile:
clang -DHAVE_CONFIG_H -DSYSTEM_WGETRC="/usr/local/etc/wgetrc"
-DLOCALEDIR="/usr/local/Cellar/wget/1.19.1/share/locale" -I.
-I../lib -I../lib -I/usr/local/opt/openssl/include -DNDEBUG
Link:
clang -DNDEBUG -liconv -L/usr/local/opt/openssl/lib -lssl -lcrypto
-ldl -lz ftp-opie.o openssl.o http-ntlm.o ../lib/libgnu.a
$ wget --content-disposition -c https://sourceforge.net/projects/freetype/files/freetype2/2.8/freetype-2.8.tar.bz2
--2017-07-25 10:55:27-- https://sourceforge.net/projects/freetype/files/freetype2/2.8/freetype-2.8.tar.bz2
Resolving sourceforge.net... 216.34.181.60
Connecting to sourceforge.net|216.34.181.60|:443... connected.
HTTP request sent, awaiting response...
HTTP/1.1 302 Found
Server: nginx
Date: Tue, 25 Jul 2017 08:55:28 GMT
Content-Type: text/html; charset=UTF-8
Content-Length: 365
Connection: close
Pragma: no-cache
Cache-Control: no-cache
X-UA-Compatible: IE=edge,chrome=1
X-Frame-Options: SAMEORIGIN
Content-Security-Policy: upgrade-insecure-requests
Set-Cookie: VISITOR=2b8474db-e3d7-4710-8a3d-974b86ef1b5a; expires="Fri, 23-Jul-2027 08:55:28 GMT"; httponly; Max-Age=315360000; Path=/
Set-cookie: sourceforge=bcda7ec9e4ed439a64c5e64e590620b984ed89bcgAJ9cQEoVQVwcmVmc3ECfXEDVQ5fYWNjZXNzZWRfdGltZXEER0HWXcHgBmPgVQNrZXlxBVUkMmI4NDc0ZGItZTNkNy00NzEwLThhM2QtOTc0Yjg2ZWYxYjVhcQZVDl9jcmVhdGlvbl90aW1lcQdHQdZdweAGY9xVA19pZHEIVSA0MzRjODBmYjk0NjM0ZGNmYjU4Y2JhYWIxODdkMjVkN3EJdS4=; expires=Tue, 19-Jan-2038 03:14:07 GMT; httponly; Path=/; secure
Location: https://sourceforge.net/projects/freetype/files/freetype2/2.8/freetype-2.8.tar.bz2/download
X-Content-Type-Options: nosniff
Strict-Transport-Security: max-age=31536000
Location: https://sourceforge.net/projects/freetype/files/freetype2/2.8/freetype-2.8.tar.bz2/download [following]
--2017-07-25 10:55:28-- https://sourceforge.net/projects/freetype/files/freetype2/2.8/freetype-2.8.tar.bz2/download
Connecting to sourceforge.net|216.34.181.60|:443... connected.
HTTP request sent, awaiting response...
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 25 Jul 2017 08:55:28 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 128476
Connection: close
Pragma: no-cache
Cache-Control: no-cache
X-UA-Compatible: IE=edge,chrome=1
X-Frame-Options: SAMEORIGIN
Content-Security-Policy: upgrade-insecure-requests
Set-Cookie: VISITOR=2b8474db-e3d7-4710-8a3d-974b86ef1b5a; expires="Fri, 23-Jul-2027 08:55:28 GMT"; httponly; Max-Age=315360000; Path=/
Set-cookie: sourceforge=797e45184f27a13d79e45d16b390a5e0bc9ef06dgAJ9cQEoVQhfZXhwaXJlc3ECY2RhdGV0aW1lCmRhdGV0aW1lCnEDVQoH9gETAw4HAAAAhVJxBFUDX2lkcQVVIDQzNGM4MGZiOTQ2MzRkY2ZiNThjYmFhYjE4N2QyNWQ3cQZVBmRsaGlzdHEHXXEIfXEJKFUHcmVsZWFzZXEKfXELKFUEZGF0ZXEMaANVCgfhBQ0KNwAAAACFUnENVQpzZl9maWxlX2lkcQ5KtGSWAVUIZmlsZW5hbWVxD1gjAAAAL2ZyZWV0eXBlMi8yLjgvZnJlZXR5cGUtMi44LnRhci5iejJxEHVVB3Byb2plY3RxEX1xEihVCXNob3J0bmFtZXETWAgAAABmcmVldHlwZXEUVQVzZl9pZHEVTVUMVQRuYW1lcRZYFAAAAFRoZSBGcmVlVHlwZSBQcm9qZWN0cRd1dWFVA2tleXEYVSQyYjg0NzRkYi1lM2Q3LTQ3MTAtOGEzZC05NzRiODZlZjFiNWFxGVUKY3VycmVudF9vc3EaXXEbKFUFd2luMzJxHFUHV2luZG93c3EdZVUFcHJlZnNxHn1xH1UOX2FjY2Vzc2VkX3RpbWVxIEdB1l3B4C2D8VUOX2NyZWF0aW9uX3RpbWVxIUdB1l3B4AZj3HUu; expires=Tue, 19-Jan-2038 03:14:07 GMT; httponly; Path=/; secure
X-Content-Type-Options: nosniff
Strict-Transport-Security: max-age=31536000
Length: 128476 (125K) [text/html]
Last-modified header missing -- time-stamps turned off.
--2017-07-25 10:55:28-- https://sourceforge.net/projects/freetype/files/freetype2/2.8/freetype-2.8.tar.bz2/download
Connecting to sourceforge.net|216.34.181.60|:443... connected.
HTTP request sent, awaiting response...
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 25 Jul 2017 08:55:29 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 143733
Connection: close
Pragma: no-cache
Cache-Control: no-cache
X-UA-Compatible: IE=edge,chrome=1
X-Frame-Options: SAMEORIGIN
Content-Security-Policy: upgrade-insecure-requests
Set-Cookie: VISITOR=2b8474db-e3d7-4710-8a3d-974b86ef1b5a; expires="Fri, 23-Jul-2027 08:55:29 GMT"; httponly; Max-Age=315360000; Path=/
Set-cookie: sourceforge=b5bd929d9431625f7b220b04e97d1949367d4ed4gAJ9cQEoVQhfZXhwaXJlc3ECY2RhdGV0aW1lCmRhdGV0aW1lCnEDVQoH9gETAw4HAAAAhVJxBFUDX2lkcQVVIDQzNGM4MGZiOTQ2MzRkY2ZiNThjYmFhYjE4N2QyNWQ3cQZVBmRsaGlzdHEHXXEIfXEJKFUHcmVsZWFzZX1xCihVBGRhdGVoA1UKB+EFDQo3AAAAAIVScQtVCnNmX2ZpbGVfaWRKtGSWAVUIZmlsZW5hbWVYIwAAAC9mcmVldHlwZTIvMi44L2ZyZWV0eXBlLTIuOC50YXIuYnoydVUHcHJvamVjdH1xDChVCXNob3J0bmFtZVgIAAAAZnJlZXR5cGVVBXNmX2lkTVUMVQRuYW1lWBQAAABUaGUgRnJlZVR5cGUgUHJvamVjdHV1YVUDa2V5cQ1VJDJiODQ3NGRiLWUzZDctNDcxMC04YTNkLTk3NGI4NmVmMWI1YXEOVQpjdXJyZW50X29zcQ9dcRAoVQV3aW4zMnERVQdXaW5kb3dzcRJlVQVwcmVmc3ETfXEUVQ5fYWNjZXNzZWRfdGltZXEVR0HWXcHgU/ahVQ5fY3JlYXRpb25fdGltZXEWR0HWXcHgBmPcdS4=; expires=Tue, 19-Jan-2038 03:14:07 GMT; httponly; Path=/; secure
X-Content-Type-Options: nosniff
Strict-Transport-Security: max-age=31536000
Length: 143733 (140K) [text/html]
Saving to: ‘download.html’
download.html 100%[============================================================================================================>] 140.36K 338KB/s in 0.4s
2017-07-25 10:55:29 (338 KB/s) - ‘download.html’ saved [143733/143733]
➜ ~ wget --help
GNU Wget 1.19.1,一个非交互式网络检索器。
- vookimedlo