badges / shields

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

New social service: Duolingo #9480

Closed colindean closed 1 year ago

colindean commented 1 year ago

📋 Description

This badge would display the Duolingo logo and one of a few statistics, e.g. cumulative experience points or consecutive days of practice ("streak"):

Experience example

Maybe https://img.shields.io/duolingo/xp/:user grabbing $.users[:0].totalXp

Streak example

Maybe https://img.shields.io/duolingo/streak/:user grabbing $.users[:0].streak

Other stats that might be interesting:

Styling

Simple Icons already has duolingo so that part is good to go.

Another color in the palate in addition to "Duolingo green" #58cc02 is #1CB0F6. I pulled #FF9600 from the fire icon widely used to represent streaks.

🔗 Data

The API is ~public but seems to require authentication unless a browser-like User-Agent header is provided. This fact is the sole reason why one cannot simply use the Dynamic JSON badge service -- that service does not allow additional headers, it seems.

e.g.

curl -v --header 'User-Agent: Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36' --header 'Accept: application/json' 'https://www.duolingo.com/2017-06-30/users?username=colindean&fields=users%7Bcourses,creationDate,currentCourse,currentCourseId,gemsConfig,globalAmbassadorStatus,hasPlus,id,lingots,name,picture,privacySettings,roles,streak,streakData%7BcurrentStreak,previousStreak%7D,totalXp,username%7D&_=1692228901804'

works but

curl -v --header 'Accept: application/json' 'https://www.duolingo.com/2017-06-30/users?username=colindean&fields=users%7Bcourses,creationDate,currentCourse,currentCourseId,gemsConfig,globalAmbassadorStatus,hasPlus,id,lingots,name,picture,privacySettings,roles,streak,streakData%7BcurrentStreak,previousStreak%7D,totalXp,username%7D&_=1692228901804'

does not.

There is no official documentation, but there is one unofficial API library: https://github.com/KartikTalwar/duolingo

🎤 Motivation

Duolingo is widely used, having 54 million monthly active users as of its 2022 yearly reporting period and more than 500 million users cumulative total.

calebcartwright commented 1 year ago

Thanks for reaching out and providing such a thorough level of detail!

However, I'm going to close as unfortunately I don't think this makes sense for us, and doesn't seem to meet several of the criteria we have for new badges (particularly the ones around undocumented APIs and being a developer-oriented service)

calebcartwright commented 1 year ago

Though I'll add that this could probably be done via our Custom Endpoint badge, and then if so, it could also then potentially be listed on Awesome Badges to increase awareness/availability to others

colindean commented 1 year ago

Thanks for considering it. If I could convince Duolingo to document the API in a way that met Shields' minimum expectations, would that alleviate concern enough to overlook the developer-oriented side of things? Of course, it might be easier to get them to relax the UA check, which would enable using the Dynamic JSON endpoint…

I want to avoid setting up another 10-line service to work around API weirdness. Too many puppies in that pack already, haha.

calebcartwright commented 1 year ago

If I could convince Duolingo to document the API in a way that met Shields' minimum expectations

I don't think so, as I feel language-learning platforms are too far outside the scope of "developer tools". I'll go ahead and note that we do have badges for other platforms, like YouTube, which on the surface probably seem similar outside that scope. However, we can be persuaded to make a reach in those cases as those platforms are often used by developers for development/tech oriented things.

I just think that the likes of Duolingo, Babbel, Rosetta Stone, etc. would be a bridge too far

colindean commented 1 year ago

I understand. Thanks for the explanation. I'll try to work my contacts at Duolingo.