alfaarghya / alfa-leetcode-api

It's a custom leetcode api. This API provides endpoints to retrieve details about a user's profile, badges, solved questions, contest details, contest history, submissions, calendar and and also daily questions, selected problem, list of problems.
https://alfa-leetcode-api.onrender.com/
MIT License
250 stars 97 forks source link

Badge Image not showing up #24

Closed Arnavop closed 1 day ago

Arnavop commented 3 months ago

Endpoint -> /:username/badges

{ "badgesCount": 1, "badges": [ { "id": "4112631", "displayName": "Guardian", "icon": "/static/images/badges/guardian.png", "creationDate": "2024-06-19" } ],

but when click on icon it shows

Cannot GET /static/images/badges/guardian.png

alfaarghya commented 3 months ago

@Arnavop try to add leetcode.com before the path

alfaarghya commented 3 months ago

https://assets.leetcode.com/static_assets/public/images/badges/guardian.png

It's the full url

Arnavop commented 3 months ago

Oh thanks

alfaarghya commented 3 months ago

Yeah, happy to help 😀

It seems odd because when I created it 5 months ago all icon's URLs came directly from leetcode. So I just checked this, and look what I found, some of the badges have the total link & some don't have --

{
  "badgesCount": 9,
  "badges": [
    {
      "id": "3691473",
      "displayName": "100 Days Badge 2024",
      "icon": "https://assets.leetcode.com/static_assets/marketing/2024-100-lg.png",
      "creationDate": "2024-04-11"
    },
    {
      "id": "3364677",
      "displayName": "50 Days Badge 2024",
      "icon": "https://assets.leetcode.com/static_assets/marketing/2024-50-lg.png",
      "creationDate": "2024-02-19"
    },
    {
      "id": "2847927",
      "displayName": "50 Days Badge 2023",
      "icon": "https://assets.leetcode.com/static_assets/marketing/lg50.png",
      "creationDate": "2023-12-16"
    },
    {
      "id": "2847926",
      "displayName": "100 Days Badge 2023",
      "icon": "https://assets.leetcode.com/static_assets/marketing/lg100.png",
      "creationDate": "2023-12-16"
    },
    {
      "id": "3628712",
      "displayName": "Mar LeetCoding Challenge",
      "icon": "/static/images/badges/dcc-2024-3.png",
      "creationDate": "2024-03-31"
    },
    {
      "id": "3452332",
      "displayName": "Feb LeetCoding Challenge",
      "icon": "/static/images/badges/dcc-2024-2.png",
      "creationDate": "2024-02-29"
    },
    {
      "id": "3285586",
      "displayName": "Jan LeetCoding Challenge",
      "icon": "/static/images/badges/dcc-2024-1.png",
      "creationDate": "2024-01-31"
    },
    {
      "id": "2686762",
      "displayName": "Nov LeetCoding Challenge",
      "icon": "/static/images/badges/dcc-2023-11.png",
      "creationDate": "2023-11-30"
    },
    {
      "id": "2598661",
      "displayName": "Oct LeetCoding Challenge",
      "icon": "/static/images/badges/dcc-2023-10.png",
      "creationDate": "2023-10-31"
    }
  ],
  "upcomingBadges": [
    {
      "name": "Jun LeetCoding Challenge",
      "icon": "/static/images/badges/dcc-2024-6.png"
    }
  ],
  "activeBadge": {
    "id": "3691473",
    "displayName": "100 Days Badge 2024",
    "icon": "https://assets.leetcode.com/static_assets/marketing/2024-100-lg.png",
    "creationDate": "2024-04-11"
  }
}
Arnavop commented 3 months ago

umm thats odd ig i will check manually then

wishaldubey commented 1 day ago

I’ve tested the badge functionality, and it appears to be working correctly. When a user has 0 badges in LeetCode, it will display the image at static/images/badges/guardian.png or a similar image with a different file name.

As I can see @Arnavop from your profile (https://alfa-leetcode-api.onrender.com/arnavop/badges), you currently have zero badges that is why it is giving output like you have given. Additionally, if a user has badges in their profile, the API will return the full links for those badges.

Since the functionality seems to be working as intended, I recommend closing this issue @alfaarghya