badges / shields

Concise, consistent, and legible badges in SVG and raster format
https://shields.io
Creative Commons Zero v1.0 Universal
23.68k stars 5.49k forks source link

Badge Request: PSGallery profile total downloads #10593

Open NorskNoobing opened 1 week ago

NorskNoobing commented 1 week ago

📋 Description

This badge would dynamically get the "Total downloads of packages", which is displayed on a PSGallery profile. I'd want it to look something like this static badge mockup, together with a link to the profile when you press the badge:

You can see the total downloads value on any PSGallery profile, but here's a link to mine for reference: https://www.powershellgallery.com/profiles/NorskNoobing

🔗 Data

There's already another badge called PowerShell Gallery Downloads, but it seems to be limited to only a single package, and therefore can't fetch the downloads of all your packages combined. It seems to be using the following API: https://www.powershellgallery.com/api/v2

Alternatively you could also scrape the profile website i.e. my profile on the following XPaths:

//*[@id="skippedToContent"]/section/section/aside/div/div[2]/h2/text()

or

/html/body/div[2]/section/section/aside/div/div[2]/h2/text()

🎤 Motivation

I'd want this to display the total downloads across all my PSGallery modules/packages on my GitHub profile README.

chris48s commented 1 week ago

Hi. Happy to look at a PR for this the information is available via the API.

We don't take new badges that rely on scraping. Keeping them working is too high-maintenance. From https://github.com/badges/shields/blob/master/CONTRIBUTING.md#badge-guidelines

Badges should not obtain data by scraping web pages - these are likely to break frequently. Whereas API publishers are incentivised to maintain a stable platform for their users, authors of web pages have no such incentive.