如何在网上获取文件版本但无法下载?

发布于 2024-08-01 13:40:43 字数 529 浏览 1 评论 0原文

我得到一个文件网址,例如 http://cidian.youdao.com/download/YoudaoDict .exe

如何获取它的版本但不下载它?

注1:如果您先将文件下载到计算机上,则有多种方法可以获取其

版本,例如,您可以使用窗口工具“filever.exe”来获取版本。

但我不想下载它,至少不想下载全部。我该怎么办? 等待您的

帮助! 谢谢。

注2:我尝试过获取部分文件的方式来获取版本:

首先,我使用下载工具“wget.exe”下载部分文件(wget.exe是

单线程下载工具) ,它可以确保从头部下载)

第二,我使用“filever.exe”来获取文件版本。

这样,有些软件我可以得到它的版本,但有些却不能(它们必须全部

下载)。我不知道为什么。

I get a file url,for example, http://cidian.youdao.com/download/YoudaoDict.exe

how can I get it's version but not download it ?

nots 1: if you download the file first on your computer,there are many ways to get it's

version, for example ,you can use the window tools "filever.exe" to get the version.

but i want to not download it ,at least not download it all.how can I do? Waiting your

help! thanks.

nots 2: I have tried the way to get a portion of the file to get the version:

first, I used the download tool "wget.exe" to download a portion of the file ( wget.exe is

a single-threaded download tool,it can make sure download form the head)

second, I used the "filever.exe" to get the file version.

In this way, some software i can get it's version,but some cann't(they must all be

downloaded).I don't know why.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

时光瘦了 2024-08-08 13:40:43

版本号(如果有)嵌入在 .exe 文件本身中。 您必须下载至少文件的一部分才能检索这些元数据。

查看 .exe 文件格式规范

Version numbers, if any, are embedded in the .exe file itself. You will have to download at least a portion of the file to retrieve these bits of metadata.

Check out the .exe file format spec.

寂寞美少年 2024-08-08 13:40:43

您可以执行 HTTP HEAD 请求,服务器可能会在 内容长度。 它还可能报告 Last-Modified 标头。 此外,ETag 可能出于相同目的而存在。

您可以使用 netcat 进行测试:

> nc cidian.youdao.com 80
HEAD /download/YoudaoDict.exe HTTP/1.1
Host: cidian.youdao.com

HTTP/1.1 200 OK
Date: Mon, 10 Aug 2009 06:11:59 GMT
Server: Apache
ETag: "Dcm1w6Vxg51"
Last-Modified: Sat, 08 Aug 2009 02:18:40 GMT
Accept-Ranges: bytes
Content-Length: 4820792
X-Request-Received: t=1249884719506801
X-Request-Processing-Time: D=906244
Content-Type: application/octet-stream

如您所见,在您的示例中,给出了所有三个标头,因此您可以根据该信息猜测版本更改。 我总是检查以确保日期和上次修改时间不同,因为有时对于脚本生成的页面,后者被设置为前者。

You can do an HTTP HEAD request, and the server may report the size of the item in Content-Length. It may also report a version under the Last-Modified header. Further, ETag may be present for the same purpose.

You can test this with netcat:

> nc cidian.youdao.com 80
HEAD /download/YoudaoDict.exe HTTP/1.1
Host: cidian.youdao.com

HTTP/1.1 200 OK
Date: Mon, 10 Aug 2009 06:11:59 GMT
Server: Apache
ETag: "Dcm1w6Vxg51"
Last-Modified: Sat, 08 Aug 2009 02:18:40 GMT
Accept-Ranges: bytes
Content-Length: 4820792
X-Request-Received: t=1249884719506801
X-Request-Processing-Time: D=906244
Content-Type: application/octet-stream

As you can see, in your example case, all three headers are given, so you can guess version changes based on that information. I'd always check to insure Date and Last-Modified aren't the same, as sometimes the latter is set to the former for pages generated by scripts.

萝莉病 2024-08-08 13:40:43

我注意到该特定的 exe 链接支持字节范围请求。

$ curl -I http://cidian.youdao.com/download/YoudaoDict.exe
HTTP/1.1 200 OK
...
Accept-Ranges: bytes
Content-Length: 4820792
...
Content-Type: application/octet-stream

您可以发出一个或多个 HTTP 字节范围请求来获取确定版本所需的文件部分。 如果文件位于硬盘上,您只需发出几个请求来获取您要查看的文件部分。

例如,根据 HTTP/1.1 规范,您可以请求带有此请求标头的前 500 个字节:

curl -H"Range: bytes=0-499" http://... -o bytes-0-499.dat

I notice that that particular exe link supports byte range requests.

$ curl -I http://cidian.youdao.com/download/YoudaoDict.exe
HTTP/1.1 200 OK
...
Accept-Ranges: bytes
Content-Length: 4820792
...
Content-Type: application/octet-stream

You could make one or more HTTP byte range request to get the parts of the file you need to determine the version. You'd just be making several requests to get the parts of the file you'd look at if it were on your hard drive.

For example, based on the HTTP/1.1 spec, you can request the first 500 bytes with this request header:

curl -H"Range: bytes=0-499" http://... -o bytes-0-499.dat
窝囊感情。 2024-08-08 13:40:43

理论上来说,这是 HTTP HEAD 请求 执行的任务是专为但 iirc 默认情况下您获得的唯一相关信息(当然,如果请求已得到处理)将是 Content-Length 和 Last-Modified。 编辑:和ETag

这可能会让您了解很多需要了解的信息,但如果您确实想要获得版本号,则必须控制 Web 服务并能够获取该信息并将其附加到响应标头中。 并不难做到,但前提是您可以控制服务。

Well in theory this is the kind of task that an HTTP HEAD request is designed for but iirc the only relevant info you'd get by default (if the request was handled at all of course) would be Content-Length and Last-Modified. Edit: and ETag!

That probably gets you much of what you need to know, but if you really wanted to have version number you'd have to be in control of the web service and be able to obtain and append that information to the response headers. Not so hard to do but only if you have control of the service.

陪你到最终 2024-08-08 13:40:43

如果您的目的是检测新版本何时可用,您可以按照其他人的建议查看 HEAD HTTP 请求的响应。

否则,您可以屏幕抓取(下载页面)并提取最新版本详细信息。 有一个方便的

标记,其中列出了版本信息,并且可以想象可以获取这些信息。 我不知道这是否可靠; 该网站的作者可能会更改此设置,恕不另行通知。

我会考虑使用 BeautifulSoup 来实现此目的。

If your purpose is to detect when a new version becomes available, you could look at the response of a HEAD HTTP request as others have suggested.

Otherwise, you could screen scrape the (download page) and extract the latest version details. There is a convenient <dl id="downloadSth"> tag within which version info is listed and could conceivably be harvested. I have no idea whether this is going to be reliable; the site's authors could change this without notice.

I'd look at using BeautifulSoup for this.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文