如何检索给定存储库(MirrorBrain)的文件列表?
我要问的存储库是针对 Linux 的,但我的问题与客户端有关——即检索这些数据,客户端可以是 Linux、Windows、Mac OS X 等。所以我选择不在 Unix& 上问这个问题;Linux 站点,如果管理员认为应该是 U&L 问题,请将其移至其他站点。
将此类存储库视为 http://download.opensuse.org/repositories/LCD/openSUSE_11.4/x86_64/ ——你可以获取它的 html,解析它,并获取文件列表。然而我几乎不相信这是正确的方法——因为 html 是由网站引擎(在本例中为 MirrorBrain)创建的,所以应该有一些 Web 服务 API 来直接获取此列表。
我用谷歌搜索,但没有找到任何相关内容。
那么——如何直接获取文件列表,无需解析,只需调用,获取文件名集合。
The repository I am asking is for Linux, but my problem is related to client -- i.e. with retrieving those data, and client can be Linux, Windows, Mac OS X, etc. So I opted against asking this question on Unix&Linux site, if admins feel it should be U&L question please move it to the other site.
Consider such repository as http://download.opensuse.org/repositories/LCD/openSUSE_11.4/x86_64/ -- you can fetch the html for it, parse it, and get the list of files. However I hardly believe it is correct way -- since the html is created by website engine (MirrorBrain in this case), there should be some web service API to get this list directly.
I googled, but didn't find anything relevant.
So -- how to get the list of the file directly, no parsing, just call, and getting the collection of file names.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
MirrorBrain 没有 API 调用来检索文件列表。 (它只有 API 调用来检索单个文件的镜像列表,方法是将
.mirrorlist
或.meta4
附加到文件的 URL。)这将是一个值得的想法添加这样的 api 调用(欢迎补丁!)。因此只有标准 HTTP 服务器目录索引可以从中读取文件列表。格式因服务器而异,甚至 Apache 也有不同的变体。对于 Apache,如果您只想获取文件名(这将简化索引),则可以将
?F=0
附加到目录 URL(这将简化索引),或者附加?F=0
。 F=1 切换到包含更多细节的更高级的版本。希望这有帮助。
MirrorBrain doesn't have an API call to retrieve a list of files. (It only has API calls to retrieve a list of mirrors for a single file, by appending
.mirrorlist
or.meta4
to a file's URL.) It would be a worthwhile idea to add such an api call (patches welcome!).So there's only the standard HTTP server directory index to read a file list from. The format varies from server to server, and even Apache has different variants. With Apache, a little trick that can help is to append
?F=0
to the directory URL if you want to get only the filenames (it will simplify the index), or to append?F=1
to switch to the fancier variant which includes more details.Hope this helps.