This Flask application provides an API to fetch problem details from GeeksforGeeks, including the Problem of the Day (POTD). It extracts structured problem data directly from GeeksforGeeks’ embedded NEXT_DATA JSON, making it fast and reliable without full browser automation.
- Fetch problem title, HTML description, difficulty, problem URL, and article URL from any GeeksforGeeks Problem.
- Fetch the GeeksforGeeks Problem of the Day (POTD).
- Returns clean, structured JSON responses(title, html_description, difficulty, problem_url, article_url).
-
Clone the repository:
git clone https://github.com/jeysan-v/gfg-problem-api cd gfg-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
-
Create a
.envfile: Create a file named.envin the root directory of the project and add the following environment variables:GFG_API="https://practiceapi.geeksforgeeks.org/api/v1/problems-of-day/problem/today/" # The API endpoint for GeeksforGeeks Problem of the Day -
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://www.geeksforgeeks.org/problems/minimize-connections/1
- URL:
/api/v1/problem/potd