repology / repology-webapp

Repology web application
https://repology.org
GNU General Public License v3.0
194 stars 26 forks source link

Fetch all outdated packages in a repository #225

Closed osalbahr closed 1 year ago

osalbahr commented 1 year ago

Hi! Is there a way to grab only the names of all outdated packages in a certain repository? Something similar to /api/v1/repository/freebsd/problems in https://repology.org/api.

I tried /api/v1/repository/freebsd/outdated but it's not a valid API endpoint. The problems endpoint is the only one in the form of /api/v1/repository/*/* I could find in https://github.com/repology/repology-webapp/blob/master/repologyapp/views/api.py#L118. Any help would be appreciated.

AMDmi3 commented 1 year ago

https://repology.org/api -> filtered projects. You can use there all the filters available in https://repology.org/projects, that is, in your case, inrepo and outdated, and, in fact, use query from projects view in api/v1/projects

osalbahr commented 1 year ago

Thank you! I must've missed that section.

osalbahr commented 1 year ago

I noticed that in https://repology.org/api/v1/projects/?inrepo=homebrew&outdated=on, ca-certificates is mentioned 708 times. Is there a supported way to get the output have the names only once? Like in https://repology.org/projects/?inrepo=homebrew&outdated=1 (there's only 511 of them). I'm now thinking to try to manually filter the JSON

Screenshot 2023-07-05 at 10 46 18 AM

Side note: there isn't really a practical reason for this. Just practicing API calls and text processing, and as a side effect get the most used outdated package (by cross-referencing with https://formulae.brew.sh/analytics/install/365d/). Let me know if there is a more suitable platform than opening an issue here. I opened an issue only because there's no https://github.com/orgs/Repology/discussions.

AMDmi3 commented 1 year ago

That's by design. It filters projects by given condition, then returns all packages for these projects. You have to filter output to only have packages for specific repository.

osalbahr commented 1 year ago

That's by design. It filters projects by given condition, then returns all packages for these projects. You have to filter output to only have packages for specific repository.

Is that not what inrepo=homebrew does? Or how should I filter for it?

AMDmi3 commented 1 year ago

Like I've said, inrepo selects projects present in homebrew and returns all packages in all repositories for these projects. If you want homebrew packages, you need to take ones with repo=homebrew

osalbahr commented 1 year ago

Oh, perfect. Thx again!