packages.ubuntu.com是否提供搜索API?

Debian软件包目录提供了一个简单的API来搜索软件包版本。 例如,可以在https://sources.debian.net/api/src/libtry-tiny-perl/上以JSON的forms访问此查询结果 。 http://packages.ubuntu.com/是否有类似的API?

正如muru评论的那样,Ubuntu中的所有内容都在Launchpad上。 Launchpad的API也可用于搜索软件包版本。 举个例子:

  • 在packages.ubuntu.com上打包libtry-tiny-perl
  • 在Launchpad上打包libtry-tiny-perl
  • 在Launchpad API上打包libtry-tiny-perl (响应有限)

要将API响应作为JSON获取,请使用curl:

$ curl https://api.launchpad.net/devel/ubuntu/+source/libtry-tiny-perl 

可以使用查询参数source_name在基本URL https://api.launchpad.net/1.0/ubuntu/+archive/primary?ws.op=getPublishedSources&&exact_match=true查询软件包版本,例如:

 $ curl 'https://api.launchpad.net/1.0/ubuntu/+archive/primary?ws.op=getPublishedSources&source_name=libtry-tiny-perl&exact_match=true' 

API文档有点复杂,即使使用官方API客户端launchpadlib ,我花了一些时间才能找到它。 软件包发行版的Ubuntu版本在字段distro_series_link给出。