JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 50
  • Score
    100M100P100Q63995F
  • License MIT

Promise base pixiv API client

Package Exports

  • pixiv-app-api

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (pixiv-app-api) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

pixiv-app-api Build Status

Promise base pixiv API client

Inspired by upbit/pixivpy: Pixiv API for Python.

Install

$ npm install --save pixiv-app-api

Usage

const PixivAppApi = require('pixiv-app-api');
const pixivImg = require('pixiv-img');
const pixiv = new PixivAppApi('your username', 'your password');

const word = '艦これ10000users入り';

pixiv.searchIllust(word)
    .then(json => {
        console.log(json);
        return pixiv.next();
    })
    .then(json => {
        console.log(`downloading ${json.illusts[0].title}`);
        return pixivImg(json.illusts[0].image_urls.large);
    }).then(() => {
        console.log('finish');
    });

See examples.

API

PixivAppApi(username, password)

username: your pixiv username
password: your pixiv username


pixiv.userDetail(userId, [query])

userId

Type: number or string

pixiv.userIllusts(userId, [query])

pixiv.userBookmarksIllust(userId, [query])

query

restrict: public | private

pixiv.illustFollow([query])

query

restrict: public | private

pixiv.illustComments(illustId, [query])

illustId

Type: number or string

pixiv.illustRelated(illustId, [query])

pixiv.illustRecommended([query])

pixiv.illustRanking([query])

query

restrict: public | private
date: 2016-08-15
mode: day | week | month | day_male | day_female | week_original | week_rookie | day_mang | day_r18 | day_male_r18 | day_female_r18 | week_r18 | week_r18g

pixiv.trendingTagsIllust([query])

pixiv.searchIllust(word, [searchOptions])

word

Type: string

searchOptions

search_target: partial_match_for_tags | exact_match_for_tags | title_and_caption
sort: date_desc | date_asc
duration: within_last_day | within_last_week | within_last_month

pixiv.illustBookmarkDetail(illustId, [query])

pixiv.illustBookmarkAdd(illustId, [body])

pixiv.illustBookmarkDelete(illustId, [body])

pixiv.userBookmarkTagsIllust([query])


default options

restrict: public
mode: day
sort: date_desc


pixiv.next()

Return next request result.

usage
pixiv.searchIllust(word)
    .then(() => pixiv.next())
    .then(() => pixiv.next())
    .then(json => {
        console.log(json);
    });

pixiv.hasNext()

Return true if pixiv.next() is able to run.

usage
if (pixiv.hasNext()) {
    pixiv.next().then();
}

pixiv.nextQuery()

Return next query parameter.

Tests

Export your pixiv username and password before running Tests.

$ export USERNAME=your pixiv username...
$ export PASSWORD=your pixiv password...
$ npm test

License

MIT © akameco