Skip to content

Matuco19/MUA-API

Repository files navigation

MUA API

MUA API (Matuco19 Utility API) is a multi-purpose API developed in Node.js that offers a variety of services through a simple and easy-to-use interface. The API is designed to be a versatile tool for developers, providing a range of functionalities that can be integrated into any project. Don't forget to ⭐ the project!


Table of Contents


Installation

To get started, make sure you have Node.js installed, clone the repository and install the dependencies:

git clone https://github.com/Matuco19/MUA-Api
cd MUA-Api
npm install

Usage

Note

This project uses fetch at runtime; ensure Node >= 18 or install node-fetch if running a lower Node version.

To start the server, run the following command:

npm start

The server will start on http://localhost:3000.


API Endpoint

Screenshot

  • URL: /screenshot
  • Method: GET
  • Query Parameters:
    • url: The URL of the website you want to capture.

Example: /api/screenshot/?url=https://matuco19.com

Example Response:

The response will be a screenshot of the provided URL in PNG format.

About

  • URL: /about
  • Method: GET
  • Query Parameters:
    • None: No query parameters required.

Example: /api/about

Example Response:

The response will be stats of the API

Analyze Sentiment

  • URL: /analyze-sentiment
  • Method: GET
  • Query Parameters:
    • text: Text to analyze the sentiment.

Example: /api/analyze-sentiment/?text="hello world!"

Example Response:

The response will be a dictionary with sentiment and polarity keys, like:

{
  "sentiment": "positive",
  "polarity": 0.666666666666667
}

LLM/Token Counter

  • URL: /llm/token-counter
  • Method: GET
  • Query Parameters:
    • text (required): The text for which to count the tokens.
    • model (optional): The tokenizer model to use. Defaults to o200k_base.
      • cl100k_base: Used by gpt-3.5-turbo, gpt-4, and gpt-4o.
      • o200k_base: Used by gpt-4.1 and gpt-4o-mini.

Example:

  • Default model: /api/llm/token-counter?text=Hello%20world!
  • Specific model: /api/llm/token-counter?text=Hello%20world!&model=cl100k_base

Example Response:

The response will be a JSON object with the tokenCount, like:

{
  "tokenCount": 2
}

CORS Proxy

  • URL: /cors-proxy
  • Method: GET
  • Query Parameters:
    • url (required): The remote URL to fetch.
    • raw (optional): true or 1 to return the raw response with original content-type; otherwise the proxy returns a JSON object with contents and status fields (similar to AllOrigins).
    • timeout (optional): Request timeout in milliseconds (default 10000, min 3000).
    • cache_ttl (optional): Seconds to cache the result (default 60).

Examples:

  • JSON output (default): /api/cors-proxy?url=https://example.com
  • Raw output (forwarded content): /api/cors-proxy?url=https://example.com/image.png&raw=1

The cors-proxy endpoint sets Access-Control-Allow-Origin: * and supports streaming of binary resources while also respecting timeouts and content-size limits.

Example Response:

if raw mode is not enabled, the endpoint will return a discretionary with the items contents and status, like this:

{
  "contents": "html content here",
  "status": {
    "http_code": 200,
    "content_type": "text/html; charset=UTF-8"
  }
}

Password Strength

  • URL: /password-strength
  • Method: POST
  • Body:
    • password: The password to analyze.

Example: curl -X POST -H "Content-Type: application/json" -d '{"password": "password123"}' http://localhost:3000/api/password-strength

Example Response:

The response will be a JSON object with the password's strength analysis, like:

{
  "strength_percentage": 35,
  "strength_text": "Weak",
  "estimated_crack_time": "Seconds to minutes"
}

Developer Information

This project is developed and maintained by Matuco19.


Contributions

Contributions are welcome! Feel free to open an issue or submit a pull request on GitHub.


License

License-MATCO Open Source V1

This project is open-source and available under the MATCO-Open-Source License. See the LICENSE file for details.