PawchiveAPI

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

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

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

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

작성자
Beginner[2023]
일일 설치 수
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.