A RESTful API for scraping and retrieving sound data from the MyInstants website. This API provides endpoints for retrieving information about sounds, including titles, URLs, descriptions, tags, favorites, views, and uploader details.
- β‘ Ultra Fast: Powered by Vercel Edge Caching (
s-maxage=3600) for ~0ms response times on cached requests. - π Serverless Ready: Native deployment to Vercel without tweaking. Uses separate serverless functions for maximum efficiency.
- π CORS Enabled: Ready to be consumed directly from frontend web applications (React, Vue, etc) without cross-origin issues.
- π― Reliable Error Handling: Returns proper HTTP status codes (e.g., 404, 400) instead of just 200 OK.
- Features
- Getting Started
- Reference
- Error Handling
- Examples
- Contributing
- Support
- License & Disclaimer
- PHP 7.4 or higher
- simple_html_dom.php library for HTML parsing
curlextension enabled inphp.ini
-
Clone the repository to your server:
git clone https://github.com/abdipr/myinstants-api.git cd myinstants-api -
Download and include
simple_html_dom.phpin the project directory. -
Local Development (No Apache/Nginx required): You can run the API locally using PHP's built-in web server. This project includes a
router.phpfile that perfectly simulates Vercel's serverless routing environment, allowing you to access endpoints without the.phpextension.php -S localhost:8000 router.php
Now you can access the API locally (e.g.,
http://localhost:8000/best?q=id). -
Deploy to Vercel: Deploying is simple. Click the button below to deploy this repository directly to your Vercel account.
Base URL: https://myinstants-api.vercel.app
| Request | Response | Parameter |
|---|---|---|
GET /trending |
Trending based region | q |
GET /search |
Search a sound | q |
GET /detail |
The sound details | id |
GET /recent |
Recently uploaded sounds | |
GET /best |
Best of all time sounds | q |
GET /uploaded |
User's uploaded sounds | username |
GET /favorites |
User's favorite sounds | username |
| Parameter | Description |
|---|---|
q |
Search query or region |
username |
User's username |
id |
Sound's Unique ID |
A typical successful response (HTTP 200) will return a JSON object like this:
{
"status": 200,
"author": "abdipr",
"data": [
{
"id": "vine-boom-sound-70972",
"title": "VINE BOOM SOUND",
"url": "https://www.myinstants.com/en/instant/vine-boom-sound-70972/",
"mp3": "https://www.myinstants.com/media/sounds/vine-boom.mp3"
}
]
}Note: For the /detail endpoint, the data object will contain extra fields like description, tags, favorites, views, and uploader.
All errors return JSON objects with an appropriate HTTP status code (e.g., 404, 400) and a message explaining the issue.
- 404 Error:
- When the page is not found or an invalid endpoint is accessed.
{ "status": 404, "author": "abdipr", "message": "Endpoint not found" }
GET https://myinstants-api.vercel.app/trending?q=idGET https://myinstants-api.vercel.app/search?q=laughGET https://myinstants-api.vercel.app/detail?id=akh-26815GET https://myinstants-api.vercel.app/recentRetrieve a list of the most popular sounds of all time based on a specified region:
GET https://myinstants-api.vercel.app/best?q=idGET https://myinstants-api.vercel.app/uploaded?username=hellmouzGET https://myinstants-api.vercel.app/favorites?username=hellmouzContributions are welcome! To contribute:
- Fork the repository.
- Create a feature branch:
git checkout -b feature-name. - Commit your changes:
git commit -m 'Add feature'. - Push to the branch:
git push origin feature-name. - Submit a pull request.
If you like this project, please star on this repository, thank you β
You can support me by:
This project is licensed under the MIT License. See the LICENSE file for more information.
The sounds contained in this API are obtained from the original MyInstants website by web scraping. Developers using this API must follow the applicable regulations by mentioning this project or the official owner in their projects and are prohibited from abusing this API for personal benefits.
