PawchiveAPI

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

Vous devrez installer une extension telle que Tampermonkey, Greasemonkey ou Violentmonkey pour installer ce script.

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

Vous devrez installer une extension telle que Tampermonkey ou Violentmonkey pour installer ce script.

Vous devrez installer une extension telle que Tampermonkey ou Userscripts pour installer ce script.

Vous devrez installer une extension telle que Tampermonkey pour installer ce script.

Vous devrez installer une extension de gestionnaire de script utilisateur pour installer ce script.

(J'ai déjà un gestionnaire de scripts utilisateur, laissez-moi l'installer !)

Vous devrez installer une extension telle que Stylus pour installer ce style.

Vous devrez installer une extension telle que Stylus pour installer ce style.

Vous devrez installer une extension telle que Stylus pour installer ce style.

Vous devrez installer une extension du gestionnaire de style pour utilisateur pour installer ce style.

Vous devrez installer une extension du gestionnaire de style pour utilisateur pour installer ce style.

Vous devrez installer une extension du gestionnaire de style pour utilisateur pour installer ce style.

(J'ai déjà un gestionnaire de style utilisateur, laissez-moi l'installer!)

Auteur
Beginner[2023]
Installations quotidiennes
0
Installations (total)
2
Notes
0 0 0
Version
1.0.4a
Créé
14/08/2026
Mis à jour
14/08/2026
Taille
6,61 ko
Licence
MIT
S'applique à
Tous les sites

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.