/pixiv-emote-scraper

Simple tool that downloads Pixiv user custom emotes

Primary LanguageJavaScriptMIT LicenseMIT

pixiv-emote-scraper

This is a simple tool that fetch and download user custom emoji from Pixiv Emoji Month

Prerequisites

  • Node.js: ^16.0.0
  • Yarn similar to Node.js
  • NPM or any other Node.js package manager

Installation

Install packages with your preferred package manager, e.g. npm:

yarn/npm install

Usage

Please create folder named emotes before running the script.

To get your refresh_token, Please follow this guide to obtain your refresh token.

To get your cookie, go to Pixiv and use dev tools to obtain your cookie from request header.

After that your config.js should look like this:

const config = {
    // Cookie should starts with first_visit_datetime_pc or PHPSESSID=
    "cookie": "YOUR_PIXIV_COOKIE",
    "access_token": "Cxnw92XXXXXXXXXXXXX",
    "refresh_token": "KylASXXXXXXXXXXXXX",
    "userAgent": "", // Use this if you encountered cloudflare (use the user agent from your browser where you are logged in)
    "expires_in": 0
};

module.exports = config;

To download all user emojis, use:

const api = new Pixiv(config);

await api.getAll();

To search for specific emote, use:

const api = new Pixiv(config);

const res = await api.getEmojisBySearch("gura");