This API provides random Studio Ghibli landscape images from the official Ghibli website. It ensures that the same image is returned for the same ID or query, making it consistent across requests.
- Random Ghibli landscape images
- Consistent image selection based on query or ID
- Film-specific image retrieval
- Direct image redirects
- URL:
/
- Method: GET
- Description: Returns API information and available endpoints
- Response: JSON with API details
- URL:
/api/random
- Method: GET
- Description: Returns a random Ghibli landscape image
- Response: JSON with image details
- URL:
/api/image
- Method: GET
- Parameters:
id
(optional): Specific image IDq
(optional): Query string (same query always returns same image)
- Description: Returns an image based on ID or query
- Response: JSON with image details
- URL:
/api/films
- Method: GET
- Description: Lists all available film codes
- Response: JSON with film codes
- URL:
/api/film/<film_code>
- Method: GET
- Parameters:
film_code
: Code of the film (e.g., "totoro", "chihiro")
- Description: Returns a random image from a specific film
- Response: JSON with image details
-
URL:
/api/redirect/random
-
Method: GET
-
Description: Redirects to a random image
-
Response: HTTP redirect to image URL
-
URL:
/api/redirect
-
Method: GET
-
Parameters:
id
(optional): Specific image IDq
(optional): Query string
-
Description: Redirects to an image based on ID or query
-
Response: HTTP redirect to image URL
{
"id": "abcdef1234567890",
"url": "https://www.ghibli.jp/gallery/totoro001.jpg",
"film_code": "totoro",
"film_name": "totoro",
"image_number": "001"
}
- Python 3.6+
- Flask
- Clone the repository
- Install dependencies:
pip install flask requests beautifulsoup4
- Run the scraper to collect images:
python scraper.py
- Start the API server:
python app.py
Run the test script to verify API functionality:
python test_api.py
- The API uses a deterministic hashing algorithm to ensure the same query always returns the same image
- Images are sourced from the official Studio Ghibli website
- The database contains approximately 1,200 images from various Ghibli films