{"id":24617753,"url":"https://github.com/jacoblincool/leetcode-query","last_synced_at":"2025-04-12T22:25:32.360Z","repository":{"id":37553666,"uuid":"438338697","full_name":"JacobLinCool/LeetCode-Query","owner":"JacobLinCool","description":"A LeetCode Query API for TypeScript \u0026 JavaScript.","archived":false,"fork":false,"pushed_at":"2025-01-30T15:40:15.000Z","size":1419,"stargazers_count":91,"open_issues_count":12,"forks_count":14,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-02-03T09:47:46.681Z","etag":null,"topics":["api","leetcode","query"],"latest_commit_sha":null,"homepage":"https://JacobLinCool.github.io/LeetCode-Query/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JacobLinCool.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-14T17:17:30.000Z","updated_at":"2025-02-02T20:14:37.000Z","dependencies_parsed_at":"2024-01-07T20:34:30.825Z","dependency_job_id":"f214cdfa-8fb8-40df-9a42-6fe4e5177f2a","html_url":"https://github.com/JacobLinCool/LeetCode-Query","commit_stats":{"total_commits":80,"total_committers":5,"mean_commits":16.0,"dds":0.25,"last_synced_commit":"69d9cb523b5f8d841a77a56d34bf0d23a93cb3dc"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JacobLinCool%2FLeetCode-Query","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JacobLinCool%2FLeetCode-Query/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JacobLinCool%2FLeetCode-Query/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JacobLinCool%2FLeetCode-Query/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JacobLinCool","download_url":"https://codeload.github.com/JacobLinCool/LeetCode-Query/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247103307,"owners_count":20884023,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","leetcode","query"],"created_at":"2025-01-24T23:40:34.259Z","updated_at":"2025-04-12T22:25:32.354Z","avatar_url":"https://github.com/JacobLinCool.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LeetCode Query\n\nThe API to get user profiles, submissions, and problems on LeetCode, with highly customizable GraphQL API and Rate Limiter.\n\n## Features\n\n### Without Authentication\n\n- [x] Get Public User Profile.\n- [x] Get User's Recent Submissions. (Public, Max: 20)\n- [x] Get User Contest Records. (thanks to [@laporchen](https://github.com/laporchen))\n- [x] Get All of User's Submissions. (Only for `leetcode.cn` endpoint)\n- [x] Get All Problem List, or with filter of difficulty and tags.\n- [x] Get Problem Detail.\n- [x] Get Daily Challenge.\n\n### Authenticated\n\n- [x] Get All Submissions of The Authenticated User.\n- [x] Get Submission Details, including the code and percentiles.\n\n### Other\n\n- [x] Customable GraphQL Query API.\n- [x] Customable Rate Limiter. (Default: 20 req / 10 sec)\n- [x] Customable Fetcher.\n\n## Examples\n\n### Get An User's Public Profile\n\nIncludes recent submissions and posts.\n\n```typescript\nimport { LeetCode } from \"leetcode-query\";\n\nconst leetcode = new LeetCode();\nconst user = await leetcode.user(\"username\");\n\n/*\n// An Example for leetcode.cn endpoint\nimport { LeetCodeCN } from \"leetcode-query\";\n\nconst leetcodeCN = new LeetCodeCN();\nconst user = await leetcodeCN.user(\"leetcode\");\n*/\n```\n\n### Get All Of Your Submissions\n\n```typescript\nimport { LeetCode, Credential } from \"leetcode-query\";\n\nconst credential = new Credential();\nawait credential.init(\"YOUR-LEETCODE-SESSION-COOKIE\");\n\nconst leetcode = new LeetCode(credential);\nconsole.log(await leetcode.submissions({ limit: 10, offset: 0 }));\n```\n\n### Use Custom Fetcher\n\nYou can use your own fetcher, for example, fetch through a real browser.\n\n```typescript\nimport { LeetCode, fetcher } from \"leetcode-query\";\nimport { chromium } from \"playwright-extra\";\nimport stealth from \"puppeteer-extra-plugin-stealth\";\n\n// setup browser\nconst _browser = chromium.use(stealth()).launch();\nconst _page = _browser\n    .then((browser) =\u003e browser.newPage())\n    .then(async (page) =\u003e {\n        await page.goto(\"https://leetcode.com\");\n        return page;\n    });\n\n// use a custom fetcher\nfetcher.set(async (...args) =\u003e {\n    const page = await _page;\n\n    const res = await page.evaluate(async (args) =\u003e {\n        const res = await fetch(...args);\n        return {\n            body: await res.text(),\n            status: res.status,\n            statusText: res.statusText,\n            headers: Object.fromEntries(res.headers),\n        };\n    }, args);\n\n    return new Response(res.body, res);\n});\n\n// use as normal\nconst lc = new LeetCode();\nconst daily = await lc.daily();\nconsole.log(daily);\nawait _browser.then((browser) =\u003e browser.close());\n```\n\n## Documentation\n\nDocumentation for this package is available on \u003chttps://jacoblincool.github.io/LeetCode-Query/\u003e.\n\n## Links\n\n- NPM Package: \u003chttps://www.npmjs.com/package/leetcode-query\u003e\n- GitHub Repository: \u003chttps://github.com/JacobLinCool/LeetCode-Query/\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacoblincool%2Fleetcode-query","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjacoblincool%2Fleetcode-query","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacoblincool%2Fleetcode-query/lists"}