Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

leetcode Problem API

This Flask application provides an API to scrape problem details from leetcode, including the Problem of the Day (POTD). It leverages public graphQL from leetcode to retrive raw html data and meta-data.

Features

  • Scrape problem title, difficulty ,raw-html data from any leetcode problem URL.
  • Fetch the Problem of the Day (POTD) details automatically.
  • Returns data in a structured JSON format (title, difficulty, html_description, problem_url).

Setup

  1. Clone the repository:

    git clone https://github.com/jeysan-v/lc-problem-api
    cd lc-problem-api
  2. Create a virtual environment and activate it:

    python -m venv venv
    ./venv/Scripts/activate # On Windows
    source venv/bin/activate # On macOS/Linux
  3. Install dependencies:

    pip install -r requirements.txt
  4. Run the application:

    python app.py

    The application will run on http://127.0.0.1:5000/ by default.

API Endpoints

1. get a specific problem

  • URL: /api/v1/problem/<problem_url>
  • Method: GET
    GET http://127.0.0.1:5000/api/v1/problem/https://leetcode.com/problems/two-sum/
    

2. Fetch Problem of the Day (POTD)

  • URL: /api/v1/problem/potd
  • Method: GET
    GET http://127.0.0.1:5000/api/v1/problem/potd
    

About

This project is about fetching daily problem in leetcode it utilize the simple concept of formating the raw html data to usable json data using beautiful soup

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages