badges / shields

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

Badge request: Patreon #3585

Open eritbh opened 5 years ago

eritbh commented 5 years ago

:clipboard: Description

I'd like Patreon badges that can display the number of patrons a creator has or the amount of money pledged to the creator per month. For example:

monthly patrons | 3 receiving | $5/mo

(I based these examples loosely on the existing funding badges, but the specific format isn't solid.)

:link: Data

Patreon has a REST API. At the moment, it appears it requires OAuth to access. There is a post on the Patreon Developers forum about the possibility of including a way to access read-only data about a creator (including patron count and monthly earnings) without authentication. I assume that this issue would be blocked on such an unauthenticated API being created.

:microphone: Motivation

I'd like to promote my Patreon creator page on my repositories as a way of obtaining funding.

calebcartwright commented 5 years ago

Thanks @Geo1088, sounds like a good idea!

You are correct that we won't be able to add support for Patreon to Shields until such time as there as an available endpoint on the Patreon side that provides the relevant data points.

An API that requires clients to authenticate isn't necessarily a blocker, depending on the circumstances. There are a handful of other services that Shields integrates with that require authentication, but the auth isn't scoped to a specific user/project/etc. so we just have to create an account in that service for Shields. Another potential solution would be if the service was willing to provide Shields with some kind of appropriately scoped read-only token that we could use to authenticate with the service's APIs.

For now though I've added the needs-upstream-help label. Please let us know if/when an API becomes available!

calebcartwright commented 5 years ago

We've also had others leverage our Endpoint Badge feature to create badges with Patreon data

See https://github.com/badges/shields/issues/2838#issuecomment-459838116 for more info

eritbh commented 5 years ago

I'll keep tabs on the Patreon dev forum and see if there are any plans to create a readonly API. I don't believe the existing OAuth API supports getting information on other users' profiles, so that wouldn't actually be an option at all.

If Patreon doesn't add support for this use-case, could this project consider including an HTML scraping solution like the one you linked, or is that kind of thing discouraged since it can change at any time?

calebcartwright commented 5 years ago

If Patreon doesn't add support for this use-case, could this project consider including an HTML scraping solution like the one you linked, or is that kind of thing discouraged since it can change at any time?

We won't do HTML scraping directly within Shields for a variety of reasons.

The comment I linked above was from a user that leveraged our Endpoint Badge to create Patreon badges. The Endpoint Badge in short, allows developers to create their own API endpoints that can be used from Shields as long as the API response conforms to the documented schema.

How developers choose to implement their services for use with the Endpoint Badge is entirely up to them.

eritbh commented 5 years ago

That's about what I was expecting, so if Patreon doesn't give an API for the information themselves then there's nothing Shields can do to support it. Makes sense.

Will keep this issue updated with any response from the Patreon devs.

eritbh commented 5 years ago

As an update: A Patreon developer responded back on July 2nd saying that they're considering the feature for their roadmap. I don't see any public roadmap from them so I guess we're still waiting for something to be implemented or not.

calebcartwright commented 5 years ago

Thanks for letting us know @Geo1088!

amkayondo commented 4 years ago

Finally found a Patreon budge πŸŽΆπŸŽ‰πŸŽ‰

Patreon donate button

read more here https://github.com/bevry/badges/

NatoBoram commented 4 years ago

Patreon seems to provide a public API right now.

Testing on Kurzgesagt's ID 73401 and the query data.attributes.patron_count on the url https://www.patreon.com/api/campaigns/73401, I get this :

Patreons

URL is https://img.shields.io/badge/dynamic/json?color=%23e85b46&label=Patreon&query=data.attributes.patron_count&suffix=%20patrons&url=https%3A%2F%2Fwww.patreon.com%2Fapi%2Fcampaigns%2F73401.

eritbh commented 4 years ago

Neat, thanks for the info!

It seems like Patreon's API is in a bit of a weird spot - they appear to have stopped providing official support for it, but it's not clear to me what that means for its stability going forwards. I'll probably be using the endpoint solution you posted for now though.

NatoBoram commented 4 years ago

Yeah, they have some pages with server-side rendering and some other pages that are done correctly. I don't exactly know why or how this happened, but anyway, this API is used by them.

chris48s commented 4 years ago

Patreon does provide a documented public API: https://docs.patreon.com/#introduction It looks like we do need to authenticate but no rate limits are mentioned.