PawchiveAPI

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

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
作者
Beginner[2023]
1日のインストール数
1
累計インストール数
3
評価
0 0 0
バージョン
1.0.4a
作成日
2026/08/14
更新日
2026/08/14
大きさ
6.61KB
ライセンス
MIT
対象サイト
すべてのサイト

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.