Linux distro横串でパッケージを検索してくれるpkgs.orgが便利でちょくちょく使っていたのですが、「API提供してほしいなー」と思っていたところ最近提供されはじめたみたいなので、応援の意味も込めてPremium Membershipに加入しました(Gold:$5/month)

Premium MembershipはBronze,Silver,Gold,Platinumと4種類ありますが、APIにアクセスできるのはGold以上です。

登録するとPatreonのメッセージにアクセストークンと専用ログインURLが送られてくるので、それで今のプランを確認できます。プランの変更や退会(もちろん確認もできる)はPatreonから行えます。

早速軽く試してみました。たとえば以下のようなクエリでCentOS Stream 8と9用のbashパッケージを検索できます。

export ACCESS_TOKEN="your access token"
curl -b "access_token=${ACCESS_TOKEN}" "https://api.pkgs.org/v1/search?query=bash&distributions=150,83&official=true&architecture=intel" | jq

こんな出力になりました。

[
  {
    "filename": "bash-5.1.8-5.el9.x86_64.rpm",
    "filename_src": "bash-5.1.8-5.el9.src.rpm",
    "name": "bash",
    "epoch": null,
    "version": "5.1.8",
    "release": "5.el9",
    "architecture": "x86_64",
    "distribution_id": 150,
    "repository_id": 5168,
    "official": true,
    "url_binary": "http://mirror.stream.centos.org/9-stream/BaseOS/x86_64/os/Packages/bash-5.1.8-5.el9.x86_64.rpm",
    "url_source": "http://mirror.stream.centos.org/9-stream/BaseOS/source/tree/Packages/bash-5.1.8-5.el9.src.rpm"
  },
  {
    "filename": "bash-5.1.8-4.el9.x86_64.rpm",
    "filename_src": "bash-5.1.8-4.el9.src.rpm",
    "name": "bash",
    "epoch": null,
    "version": "5.1.8",
    "release": "4.el9",
    "architecture": "x86_64",
    "distribution_id": 150,
    "repository_id": 5168,
    "official": true,
    "url_binary": "http://mirror.stream.centos.org/9-stream/BaseOS/x86_64/os/Packages/bash-5.1.8-4.el9.x86_64.rpm",
    "url_source": "http://mirror.stream.centos.org/9-stream/BaseOS/source/tree/Packages/bash-5.1.8-4.el9.src.rpm"
  },
  {
    "filename": "bash-5.1.8-2.el9.x86_64.rpm",
    "filename_src": "bash-5.1.8-2.el9.src.rpm",
    "name": "bash",
    "epoch": null,
    "version": "5.1.8",
    "release": "2.el9",
    "architecture": "x86_64",
    "distribution_id": 150,
    "repository_id": 5168,
    "official": true,
    "url_binary": "http://mirror.stream.centos.org/9-stream/BaseOS/x86_64/os/Packages/bash-5.1.8-2.el9.x86_64.rpm",
    "url_source": "http://mirror.stream.centos.org/9-stream/BaseOS/source/tree/Packages/bash-5.1.8-2.el9.src.rpm"
  },
  {
    "filename": "bash-4.4.20-4.el8.x86_64.rpm",
    "filename_src": "bash-4.4.20-4.el8.src.rpm",
    "name": "bash",
    "epoch": null,
    "version": "4.4.20",
    "release": "4.el8",
    "architecture": "x86_64",
    "distribution_id": 83,
    "repository_id": 4790,
    "official": true,
    "url_binary": "http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/bash-4.4.20-4.el8.x86_64.rpm",
    "url_source": "http://vault.centos.org/8-stream/BaseOS/Source/SPackages/bash-4.4.20-4.el8.src.rpm"
  },
  {
    "filename": "bash-4.4.20-3.el8.x86_64.rpm",
    "filename_src": "bash-4.4.20-3.el8.src.rpm",
    "name": "bash",
    "epoch": null,
    "version": "4.4.20",
    "release": "3.el8",
    "architecture": "x86_64",
    "distribution_id": 83,
    "repository_id": 4790,
    "official": true,
    "url_binary": "http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/bash-4.4.20-3.el8.x86_64.rpm",
    "url_source": "http://vault.centos.org/8-stream/BaseOS/Source/SPackages/bash-4.4.20-3.el8.src.rpm"
  },
  {
    "filename": "bash-4.4.20-2.el8.x86_64.rpm",
    "filename_src": "bash-4.4.20-2.el8.src.rpm",
    "name": "bash",
    "epoch": null,
    "version": "4.4.20",
    "release": "2.el8",
    "architecture": "x86_64",
    "distribution_id": 83,
    "repository_id": 4790,
    "official": true,
    "url_binary": "http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/bash-4.4.20-2.el8.x86_64.rpm",
    "url_source": "http://vault.centos.org/8-stream/BaseOS/Source/SPackages/bash-4.4.20-2.el8.src.rpm"
  },
  {
    "filename": "bash-4.4.20-1.el8_4.x86_64.rpm",
    "filename_src": "bash-4.4.20-1.el8_4.src.rpm",
    "name": "bash",
    "epoch": null,
    "version": "4.4.20",
    "release": "1.el8_4",
    "architecture": "x86_64",
    "distribution_id": 83,
    "repository_id": 4790,
    "official": true,
    "url_binary": "http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/bash-4.4.20-1.el8_4.x86_64.rpm",
    "url_source": "http://vault.centos.org/8-stream/BaseOS/Source/SPackages/bash-4.4.20-1.el8_4.src.rpm"
  },
  {
    "filename": "bash-4.4.19-14.el8.x86_64.rpm",
    "filename_src": "bash-4.4.19-14.el8.src.rpm",
    "name": "bash",
    "epoch": null,
    "version": "4.4.19",
    "release": "14.el8",
    "architecture": "x86_64",
    "distribution_id": 83,
    "repository_id": 4790,
    "official": true,
    "url_binary": "http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/bash-4.4.19-14.el8.x86_64.rpm",
    "url_source": "http://vault.centos.org/8-stream/BaseOS/Source/SPackages/bash-4.4.19-14.el8.src.rpm"
  }
]

"latestだけ取ってくる"っていうフラグ欲しいですね。リクエストしてみようかな。

「私も登録したい」という方はPatreonからどうぞです。