Leetcode API

Leetcode API

by quartz_drum

Scrape LeetCode user profiles, problems, contests, and discussions. Get user stats, solved problems, contest ratings, submission history, activity hea...

72 runs
5 users
Try This Actor

Opens on Apify.com

About Leetcode API

Scrape LeetCode user profiles, problems, contests, and discussions. Get user stats, solved problems, contest ratings, submission history, activity heatmaps, daily challenges, and more - all without authentication.

What does this actor do?

Leetcode API is a web scraping and automation tool available on the Apify platform. It's designed to help you extract data and automate tasks efficiently in the cloud.

Key Features

  • Cloud-based execution - no local setup required
  • Scalable infrastructure for large-scale operations
  • API access for integration with your applications
  • Built-in proxy rotation and anti-blocking measures
  • Scheduled runs and webhooks for automation

How to Use

  1. Click "Try This Actor" to open it on Apify
  2. Create a free Apify account if you don't have one
  3. Configure the input parameters as needed
  4. Run the actor and download your results

Documentation

LeetCode API Scraper Scrape LeetCode user profiles, problems, contests, and discussions data without authentication. ## Features - User Data: Profiles, badges, solved problems, contest rankings, submission history, activity heatmaps - Problem Data: Daily challenges, specific problems, problem lists with filters, official solutions - Contest Data: All contests, upcoming contests, contest details, leaderboards - Discussion Data: Trending discussions, topic details, comments ## Input | Field | Type | Description | |-------|------|-------------| | operation | String | Required. The type of data to fetch | | username | String | LeetCode username (for user operations) | | titleSlug | String | Problem/contest slug (e.g., "two-sum") | | limit | Integer | Number of items to fetch (default: 20) | | skip | Integer | Items to skip for pagination | | year | Integer | Year for calendar/heatmap data | | difficulty | String | Filter: EASY, MEDIUM, HARD | | tags | String | Comma-separated topic tags | | topicId | Integer | Discussion topic ID | | page | Integer | Page number for rankings | ## Operations ### User Operations - userProfile - Basic user profile - userSummary - Complete user data in one call (recommended) - userBadges - User badges - userSolved - Solved problems with percentages - userContest - Contest rating and stats - userContestHistory - Contest participation history - userSubmissions - Recent submissions (max 20) - userAcSubmissions - Recent accepted submissions (max 20) - userCalendar - Submission calendar - userHeatmap - Activity heatmap (year/month/day breakdown) - userSkillStats - Skill tags by category - userLanguageStats - Programming language stats ### Problem Operations - dailyProblem - Today's daily challenge - selectProblem - Get specific problem by titleSlug - problemList - List problems with filters - officialSolution - Get official solution for a problem ### Contest Operations - allContests - All LeetCode contests - upcomingContests - Upcoming contests with countdown - contestDetail - Specific contest details - contestRanking - Contest leaderboard ### Discussion Operations - trendingDiscussions - Trending discussion topics - discussTopic - Get discussion topic details - discussComments - Get discussion comments ## Example Usage ### Get User Summary json { "operation": "userSummary", "username": "uwi" } ### Get Daily Problem json { "operation": "dailyProblem" } ### Get Problem List with Filters json { "operation": "problemList", "difficulty": "MEDIUM", "tags": "array,dynamic-programming", "limit": 50 } ### Get Contest Ranking json { "operation": "contestRanking", "titleSlug": "weekly-contest-350", "page": 1 } ## Output Results are saved to the default dataset with this structure: json { "operation": "userSummary", "success": true, "data": { /* LeetCode data */ }, "timestamp": "2024-01-15T10:30:00.000Z" } ## Limitations - Submission limit: LeetCode's public API limits userSubmissions and userAcSubmissions to 20 items. Use userSummary for aggregate stats. - Rate limiting: Implemented to avoid overloading LeetCode's servers - Premium content: Some content may require LeetCode Premium subscription ## Notes - Problem content is cleaned and formatted from HTML to readable text - HTML entities (\u003C, <, etc.) are properly decoded - Solutions include video and code playground links - Heatmaps include daily submission counts organized by year/month/day ## Cost This Actor uses minimal compute resources as it only makes HTTP requests to LeetCode's GraphQL API. ## Support For issues and feature requests, please open an issue in the repository.

Common Use Cases

Market Research

Gather competitive intelligence and market data

Lead Generation

Extract contact information for sales outreach

Price Monitoring

Track competitor pricing and product changes

Content Aggregation

Collect and organize content from multiple sources

Ready to Get Started?

Try Leetcode API now on Apify. Free tier available with no credit card required.

Start Free Trial

Actor Information

Developer
quartz_drum
Pricing
Paid
Total Runs
72
Active Users
5
Apify Platform

Apify provides a cloud platform for web scraping, data extraction, and automation. Build and run web scrapers in the cloud.

Learn more about Apify

Need Professional Help?

Couldn't solve your problem? Hire a verified specialist on Fiverr to get it done quickly and professionally.

Find a Specialist

Trusted by millions | Money-back guarantee | 24/7 Support