Skip to content

abdipr/myinstants-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MyInstants

MyInstants REST API

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.

✨ Support

If you like this project, please star on this repository, thank you ⭐
You can support me by:
Trakteer Saya

Table of Contents

🚀 Getting Started

Introduction

The MyInstants REST API is designed to provide a structured way to retrieve sound data from the MyInstants website. This API is suitable for applications that need to access sound information dynamically without direct interactions with the MyInstants site.

Requirements

  • PHP 7.4 or higher
  • simple_html_dom.php library for HTML parsing
  • Internet access for scraping the MyInstants website

Installation

  1. Clone the repository to your server:

    git clone https://github.com/abdipr/myinstants-api.git
    cd myinstants-api
  2. Download and include simple_html_dom.php in the project directory.

  3. Set up your server to serve PHP files (e.g., Apache or Nginx).

  4. Or, you can deploy directly to Vercel here
    Deploy with Vercel

❇️ Reference

Endpoints

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
GET /uploaded User's uploaded sounds username
GET /favorites User's favorite sounds username

Request Parameters

Parameter Description
q Search query or region
username User's username
id Sound's Unique ID

Response Parameters

Parameter Description
id Unique ID of the sound.
url Direct URL to the sound page.
title Title of the sound.
mp3 Direct URL to the MP3 file.
description Description of the sound.
tags Array of tags associated with the sound.
favorites Number of users who favorited the sound.
views View count of the sound.
uploader Details about the uploader, including the uploader’s name and profile URL.

💥 Error Handling

All errors return JSON objects with a status code and message explaining the issue.

  • 404 Error:
    • When the page is not found or the query parameter is missing.
    {
      "status": "404",
      "author": "abdiputranar",
      "message": "Page not found"
    }

🌐 Examples

Example 1: Get Trending Sounds by Region

Retrieve trending sounds based on a specified region:

GET https://myinstants-api.vercel.app/trending?q=id

Example 2: Search Sounds by Query

Search for sounds using a specific keyword:

GET https://myinstants-api.vercel.app/search?q=laugh

Example 3: Get Sound Details by ID

Retrieve the details of a sound using its unique ID:

GET https://myinstants-api.vercel.app/detail?id=akh-26815

Example 4: Get Recently Uploaded Sounds

Retrieve a list of the most recently uploaded sounds:

GET https://myinstants-api.vercel.app/recent

Example 5: Get Best of All Time Sounds

Retrieve a list of the most popular sounds of all time:

GET https://myinstants-api.vercel.app/best

Example 6: Get User's Uploaded Sounds

Retrieve all sounds uploaded by a specific user:

GET https://myinstants-api.vercel.app/uploaded?username=hellmouz

Example 7: Get User's Favorite Sounds

Retrieve a list of sounds favorited by a specific user:

GET https://myinstants-api.vercel.app/favorites?username=hellmouz

Notes

  • q Parameter: Used for searching or specifying the region for trending sounds.
  • id Parameter: Unique identifier for accessing sound details.
  • username Parameter: User's profile name for accessing their uploads or favorites.

🌱 Contributing

Contributions are welcome! To contribute:

  1. Fork the repository.
  2. Create a feature branch: git checkout -b feature-name.
  3. Commit your changes: git commit -m 'Add feature'.
  4. Push to the branch: git push origin feature-name.
  5. Submit a pull request.

⚖️ License

This project is licensed under the MIT License. See the LICENSE file for more information.

⚠️ Disclaimer

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.

⬆️ Back to Top