PawchiveAPI

The `PawchiveAPI` class provides a simple and efficient way to interact with the Pawchive API.

Tendrás que instalar una extensión para tu navegador como Tampermonkey, Greasemonkey o Violentmonkey si quieres utilizar este script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

Tendrás que instalar una extensión como Tampermonkey o Violentmonkey para instalar este script.

Necesitarás instalar una extensión como Tampermonkey o Userscripts para instalar este script.

Tendrás que instalar una extensión como Tampermonkey antes de poder instalar este script.

Necesitarás instalar una extensión para administrar scripts de usuario si quieres instalar este script.

(Ya tengo un administrador de scripts de usuario, déjame instalarlo)

Tendrás que instalar una extensión como Stylus antes de poder instalar este script.

Tendrás que instalar una extensión como Stylus antes de poder instalar este script.

Tendrás que instalar una extensión como Stylus antes de poder instalar este script.

Para poder instalar esto tendrás que instalar primero una extensión de estilos de usuario.

Para poder instalar esto tendrás que instalar primero una extensión de estilos de usuario.

Para poder instalar esto tendrás que instalar primero una extensión de estilos de usuario.

(Ya tengo un administrador de estilos de usuario, déjame instalarlo)

Autor
Beginner[2023]
Instalaciones diarias
1
Instalaciones totales
3
Calificaciones
0 0 0
Versión
1.0.4a
Creado
14/8/2026
Actualizado
14/8/2026
Tamaño
6,61 KB
Licencia
MIT
Funciona en
Todos los sitios

PawchiveAPI

The PawchiveAPI JavaScript library provides a clean, simple, and efficient wrapper for interacting with the Pawchive API. Designed specifically for UserScripts and web applications, it supports direct global access (window.PawchiveAPI / globalThis.PawchiveAPI), making it seamless to import via @require or dynamic script loaders.


🚀 Key Features

  • CORS Policy Bypass: Utilizes Tampermonkey's GM_xmlhttpRequest and @connect permissions to securely bypass CORS restrictions when fetching data from the server.
  • Smart Response Parser: Automatically detects and parses JSON responses while gracefully handling plain text outputs (such as raw string responses like "custom"), preventing parsing errors.
  • Global & UnsafeWindow Support: Exported to unsafeWindow, window, and globalThis for maximum compatibility and smooth debugging in browser developer consoles.
  • Flexible Initialization: Easily set custom Base URLs, default HTTP headers, and toggle built-in debug logging.
  • URL Parameter Builder: Automatically formats complex query parameters for search and pagination.

🛠️ Installation & Import

Method 1: Using Tampermonkey @require (Recommended)

Add the following directive to your UserScript Header:


// @require https://greasyfork.org/scripts/591303-pawchiveapi/code/PawChiveAPI.user.js

Method 2: Dynamic Import

const APIClass = window.PawchiveAPI || window.pawchiveAPI;
const api = new APIClass();

📖 Available Methods

🔹 Creators & Profiles

  • getCreators() - Fetches a list of available creators.
  • getCreatorProfile(service, creatorId) - Gets detailed profile info for a creator.
  • getCreatorLinks(service, creatorId) - Retrieves social/external links associated with a creator.
  • getCreatorAnnouncements(service, creatorId) - Fetches announcements made by a creator.
  • getCreatorFancards(service, creatorId) - Gets fancards for a specific creator.

🔹 Posts & Revisions

  • getRecentPosts(params) - Fetches recent posts with optional query parameters (e.g., { limit: 10 }).
  • getCreatorPosts(service, creatorId, params) - Gets posts from a specific creator.
  • getPost(service, creatorId, postId) - Fetches details of a specific post.
  • getPostRevisions(service, creatorId, postId) - Retrieves revision history for a post.
  • getPostComments(service, creatorId, postId) - Fetches user comments on a post.

🔹 Moderation & Flags

  • flagPost(service, creatorId, postId) - Flags a post for review.
  • checkPostFlagged(service, creatorId, postId) - Checks whether a post has already been flagged.

🔹 Account & Favorites

  • getAccountFavorites() - Fetches the current user's favorite posts and creators.
  • addFavoritePost(service, creatorId, postId) - Adds a post to favorites.
  • removeFavoritePost(service, creatorId, postId) - Removes a post from favorites.
  • addFavoriteCreator(service, creatorId) - Adds a creator to favorites.
  • removeFavoriteCreator(service, creatorId) - Removes a creator from favorite

🔹 System

  • getAppVersion() - Fetches the current backend API version.

💻 Usage Example

// Initialize the API client (Debug logs enabled by default)
const api = new PawchiveAPI();

// Fetch recent posts using Async/Await
async function loadContent() {
    try {
        const posts = await api.getRecentPosts();
        console.log('Recent Posts:', posts);

        const creators = await api.getCreators();
        console.log('Creators:', creators);
    } catch (error) {
        console.error('Failed to fetch data from Pawchive API:', error);
    }
}

loadContent();

📜 License

Distributed under the MIT License. Free to use and modify in personal projects and UserScripts.