Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

License

NotificationsYou must be signed in to change notification settings

codewithsathya/leetcode-api

Repository files navigation

The API to get user profiles, submissions, and problems on LeetCode, with highly customizable GraphQL API and Rate Limiter.

Features

Without Authentication

  • Get Public User Profile.
  • Get User's Recent Submissions. (Public, Max: 20)
  • Get User Contest Records. (thanks to@laporchen)
  • Get All Problem List, or with filter of difficulty and tags.
  • Get Problem Detail.
  • Get Daily Challenge.

Authenticated

  • Get All Submissions of The Authenticated User.
  • Get Submission Details, including the code and percentiles.

Other

  • Customable GraphQL Query API.
  • Customable Rate Limiter. (Default: 20 req / 10 sec)
  • Customable Fetcher.

Examples

Get An User's Public Profile

Includes recent submissions and posts.

import{LeetCode}from'leetcode-query';constleetcode=newLeetCode();constuser=awaitleetcode.user('username');

Get All Of Your Submissions

import{LeetCode,Credential}from'leetcode-query';constcredential=newCredential();awaitcredential.init('YOUR-LEETCODE-SESSION-COOKIE');constleetcode=newLeetCode(credential);console.log(awaitleetcode.submissions(100,0));

Use Custom Fetcher

You can use your own fetcher, for example, fetch through a real browser.

import{LeetCode,fetcher}from'leetcode-query';import{chromium}from'playwright-extra';importstealthfrom'puppeteer-extra-plugin-stealth';// setup browserconst_browser=chromium.use(stealth()).launch();const_page=_browser.then((browser)=>browser.newPage()).then(async(page)=>{awaitpage.goto('https://leetcode.com');returnpage;});// use a custom fetcherfetcher.set(async(...args)=>{constpage=await_page;constres=awaitpage.evaluate(async(args)=>{constres=awaitfetch(...args);return{body:awaitres.text(),status:res.status,statusText:res.statusText,headers:Object.fromEntries(res.headers),};},args);returnnewResponse(res.body,res);});// use as normalconstlc=newLeetCode();constdaily=awaitlc.daily();console.log(daily);await_browser.then((browser)=>browser.close());

Documentation

Documentation for this package is available onhttps://jacoblincool.github.io/LeetCode-Query/.

Links

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors2

  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp