1.0.2 ⢠Published 4 months ago
leetcode-user-api v1.0.2
š LeetCode User API - NPM Package
š Fetch LeetCode user profile data using an easy-to-use Node.js package & CLI tool. Perfect for integrating LeetCode stats into your projects, bots, or dashboards! š
š Features
ā
Fetch user profile details from LeetCode
ā
Get ranking, reputation, solved problems, and avatar
ā
CLI support for quick terminal access
ā
Zero configuration ā Just install & use
ā
Error handling for smooth API usage
š Installation
Install as a Node.js Package
npm install leetcode-user-api
Install as a Global CLI
npm install -g leetcode-user-api
š„ Usage
1ļøā£ Import & Use in JavaScript
const { getLeetCodeUser } = require("leetcode-user-api");
getLeetCodeUser("kamran534055")
.then(console.log)
.catch(console.error);
2ļøā£ Use as CLI
leetcode-user kamran534055
ā Output:
{
"username": "kamran534055",
"realName": "Muhammad Kamran",
"aboutMe": "N/A",
"ranking": 2079378,
"reputation": 0,
"avatar": "https://assets.leetcode.com/users/kamran534055/avatar_1739624955.png",
"problemsSolved": [
{
"difficulty": "All",
"count": 40
},
{
"difficulty": "Easy",
"count": 21
},
{
"difficulty": "Medium",
"count": 18
},
{
"difficulty": "Hard",
"count": 1
}
]
}
š Error Handling
Error | Description |
---|---|
`Invalid username provided.` | The username is missing or incorrect. |
`User not found.` | The user does not exist on LeetCode. |
`Error fetching LeetCode data.` | API request failed due to network issues. |
š Support & Contact
If you find this project helpful, please ā star the repo and share it!
For any issues or feature requests, open an issue. š
š» Developed by Muhammad Kamran