Tool:Wikiquotes Quote of the Day Parser
| Website | https://wq-quote-of-the-day-parser.toolforge.org/ |
| Description | FastAPI-based REST API that exposes Wikiquote’s “Quote of the day” and a small quote archive as JSON. |
| Keywords | wikiquote, quote of the day, qotd, api, rest, json |
| Author(s) | Agamya Samuel and IndicTechCom contributors (Agamyasamueltalk) |
| Maintainer(s) | Agamya Samuel (View all) |
| Source code | https://github.com/indictechcom/wq-qotd |
| License | MIT License |
Overview
The Wiki Quote of the Day API is a Toolforge-hosted web service that fetches and stores daily quotes from Wikiquote and exposes them via a simple JSON/REST API. It is designed for bots, tools, gadgets, and external websites that want to display a “quote of the day” or browse a small archive of past quotes without scraping the Wikiquote website directly.
Key features include:
- Fetch and store daily quotes from Wikiquote
- Retrieve today’s featured quote (Quote of the Day)
- Look up historical quotes by date
- Filter quotes by author
- Browse quotes with pagination
- Backed by a MariaDB/MySQL database for caching and fast responses
Web service and API
The API is built with FastAPI and returns JSON responses suitable for consumption by scripts, bots, and web frontends.
API endpoints
The main public endpoints are:
GET /api/quote_of_the_day- Returns today’s featured quote from Wikiquote, as stored in the local database.
GET /api/quotes/{date}- Returns the quote featured on a specific date.
{date}should be inYYYY-MM-DDformat.
GET /api/quotes- Returns a paginated list of quotes.
- Supports optional query parameters for pagination and filtering (for example, by author).
- See the interactive API documentation for the full list of parameters and example requests.
Example JSON response
A typical quote object looks like this:
{
"id": "a2e4e8f9c3b4410b8a5a9b9b3d5e1234",
"quote": "The only limit to our realization of tomorrow is our doubts of today.",
"author": "Franklin D. Roosevelt",
"featured_date": "2025-11-28"
}
Field meanings:
id– Stable identifier (hash of quote + author).quote– The quote text.author– Name of the person attributed.featured_date– Date when this quote was featured as “Quote of the Day” (UTC), inYYYY-MM-DDformat.
Quick start examples
Using curl
- Get today’s quote:*
curl "https://wq-quote-of-the-day-parser.toolforge.org/api/quote_of_the_day"
- Get the quote for a specific date (example: 2025-11-27):*
curl "https://wq-quote-of-the-day-parser.toolforge.org/api/quotes/2025-11-27"
- List quotes with basic pagination and an author filter:*
curl "https://wq-quote-of-the-day-parser.toolforge.org/api/quotes?author=Albert%20Einstein&limit=10&offset=0"
(Replace parameter names and values with those documented in the API sandbox.)
Using JavaScript (fetch)
async function loadQotd() {
const res = await fetch(
"https://wq-quote-of-the-day-parser.toolforge.org/api/quote_of_the_day"
);
if (!res.ok) {
console.error("Failed to load quote of the day", res.status);
return;
}
const data = await res.json();
console.log(
`Quote of the Day (${data.featured_date}): "${data.quote}" — ${data.author}`
);
}
loadQotd();
Error handling
The API uses standard HTTP status codes:
200 OK– Request succeeded.400 Bad Request– Invalid input (for example, malformed date).404 Not Found– Quote not found for the requested date or filter.500 Internal Server Error– Unexpected error on the server side.
Error responses are returned as JSON with an explanatory message where possible.
Usage notes and best practices
- Please cache responses (especially
/api/quote_of_the_day) on your side to avoid unnecessary repeated requests. - If you are calling this API from a high-traffic tool or external website, consider:
- Adding your own caching layer or proxy.
- Respecting Toolforge resource usage guidelines.
- The data ultimately comes from Wikiquote; if you find content issues (spelling, misattribution, etc.), fix them on Wikiquote itself so everyone benefits.
Development and source code
The tool is implemented in Python using FastAPI and SQLAlchemy, with MariaDB/MySQL as the storage backend.
- Git repository: Github
- License: MIT
The repository README includes:
- Local development setup
- Environment variable configuration (database credentials, etc.)
- Database initialization scripts
- Detailed project structure
If you want to run your own instance:
- Clone the repository.
- Configure your Python virtual environment.
- Set up a MariaDB/MySQL database and populate the required tables.
- Run the FastAPI app with
uvicornor a production ASGI server. - Optionally configure a reverse proxy (for example, with Toolforge’s webservice).
Reporting bugs and feature requests
There are two main channels for feedback:
- GitHub issues: Github Issues
- Phabricator: task T375969
When reporting bugs, please include:
- The exact endpoint and URL you called
- The HTTP status code and response body (if any)
- Steps to reproduce the problem
- Whether the issue is reproducible or intermittent
See also
- Toolforge documentation
- Wikiquote
- Help:Toolforge – general guidance on documenting Toolforge tools