从sourceforge下载最新版本 [英] Downloading latest version from sourceforge

查看:368
本文介绍了从sourceforge下载最新版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过bash脚本从Sourceforge下载最新版本的graphicsmagick

I am trying to download latest version of graphicsmagick from Sourceforge in my bash script

wget -q https://sourceforge.net/projects/graphicsmagick/files/latest/download?source=files -O GraphicsMagick-LATEST.tar.gz
tar -xzvf GraphicsMagick-LATEST.tar.gz

问题是,当我尝试提取tar.gz时,出现以下错误

The problem is that when I try to extract the tar.gz I get the following error

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now

这意味着脚本不是在下载最新的tar.gz,而是在下载其他文件类型?

This means that the script is not downloading the latest tar.gz but rather another filetype?

为什么会这样,我在这里想念什么?

Why is that happening and what I am missing here?

推荐答案

忘记我的prevoius答案.该问题不在文件中.当将wget与当前链接一起使用时,您指向的是sourceforge页面.您不是在下载文件,而是在下载HTML页面.将文件重命名为.html,您可以看到sourceforge页面的所有代码.

Forget about my prevoius answer. The issue is not in the file. When you use wget with your current link, you are pointing to a sourceforge page. You are not downloading the file, but you are downloading the HTML page. Rename your file to .html and you can see all code of the sourceforge page.

wget -q https://sourceforge.net/projects/graphicsmagick/files/latest/download?source=files -O file.html --user-agent="Mozilla/5.0 (Macintosh; Intel Mac OS X x.y; rv:10.0) Gecko/20100101 Firefox/10.0"

将下载HTML.

您提供的链接具有javascript重定向到正确链接,具体取决于您的操作系统(如我在其他答案中所述).但是wget无法执行此javascript代码,因此不会重定向.链接仍然在HTML内部.搜索下一个字符串:

The link you provide has a javascript redirect to the correct link depending in your operating system (as I have described in my other answer). But wget cannot execute this javascript code, therefore is not redirected. Still the link is inside the HTML. Search for the the next string:

Problems with the download?  Please use this

在此字符串之后,您可以找到指向上一个版本的直接链接:

And after this string, you can find the direct link to the last version:

http://downloads.sourceforge.net/project/graphicsmagick/graphicsmagick/1.3.25/GraphicsMagick-1.3.25.tar.gz?r=&ts=1482426819&use_mirror=vorboss

(请注意,如果您使用--user-agent="Mozilla/5.0 (Macintosh; Intel Mac OS X x.y; rv:10.0) Gecko/20100101 Firefox/10.0",则链接用于tar.gz,而不是.rpm)

(Note about that if you use the --user-agent="Mozilla/5.0 (Macintosh; Intel Mac OS X x.y; rv:10.0) Gecko/20100101 Firefox/10.0", the link is for the tar.gz not for the .rpm)

因此,您每次必须下载HTML文件,搜索HTML内的下载链接(具有当前最新版本),并在新的wget命令中使用它.

You must therefore download the HTML file each time, search for the download link inside the HTML (with the currently latest version), and use it in a new wget command.

这篇关于从sourceforge下载最新版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆