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.
- 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).
-
Clone the repository:
git clone https://github.com/jeysan-v/lc-problem-api cd lc-problem-api -
Create a virtual environment and activate it:
python -m venv venv ./venv/Scripts/activate # On Windows source venv/bin/activate # On macOS/Linux
-
Install dependencies:
pip install -r requirements.txt
-
Run the application:
python app.py
The application will run on
http://127.0.0.1:5000/by default.
- URL:
/api/v1/problem/<problem_url> - Method:
GETGET http://127.0.0.1:5000/api/v1/problem/https://leetcode.com/problems/two-sum/
- URL:
/api/v1/problem/potd - Method:
GETGET http://127.0.0.1:5000/api/v1/problem/potd