Home

Awesome

Pixiv API Client

styled with prettier

Promise based Pixiv API client for node.js and react native

Note

Since 8th Feb 2021, login api no longer working, pixiv now require authenticate with oauth 2.0. You will need to either use tool like wireshark/charles to sniff refresh token and auth with refreshAccessToken or follow oauth 2.0 flow which will only work on authorized url or app.

Install

$ npm install pixiv-api-client --save 

Usage

const PixivApi = require('pixiv-api-client');
const pixiv = new PixivApi();

const word = 'ラブライブ';
pixiv.tokenRequest('code', 'codeVerfier').then(() => {
  return pixiv.searchIllust(word).then(json => {
	console.log(json);
	return pixiv.requestUrl(json.next_url);
  }).then(json => {
	console.log(json); //next results
  });
});

API

PixivApi(options)

pixiv.tokenRequest(code, codeVerifier)

[Deprecated] pixiv.login(username, password, rememberPassword)

Api client will try once to relogin again on error if rememberPassword is set to true

pixiv.logout()

pixiv.refreshAccessToken(refreshToken)

Refresh access token with refreshToken

[Deprecated] pixiv.createProvisionalAccount(nickName)

pixiv.userState()

require auth

pixiv.editUserAccount(fields)

require auth

pixiv.sendAccountVerificationEmail()

require auth

pixiv.searchIllust(word, options)

require auth

pixiv.searchIllustPopularPreview(word, options)

require auth

pixiv.searchIllustBookmarkRanges(word, options)

require auth

pixiv.searchUser(word)

require auth

[Depcreated] pixiv.searchAutoComplete(word)

require auth

pixiv.searchAutoCompleteV2(word)

require auth

pixiv.userDetail(userId, options)

pixiv.userIllusts(id, options)

require auth

pixiv.userBookmarksIllust(id, options)

require auth

pixiv.userBookmarkIllustTags(options)

require auth

pixiv.userNovels(id, options)

require auth

pixiv.userBookmarksNovel(id, options)

require auth

pixiv.userBookmarkNovelTags(options)

require auth

pixiv.illustBookmarkDetail(id, options)

require auth

pixiv.novelBookmarkDetail(id, options)

require auth

[Deprecated] pixiv.illustComments(id, options)

require auth

[Deprecated] pixiv.illustCommentsV2(id, options)

require auth

pixiv.illustCommentsV3(id, options)

require auth

pixiv.illustCommentReplies(id, options)

require auth

pixiv.illustCommentRepliesV2(id, options)

require auth

pixiv.novelComments(id, options)

require auth

pixiv.novelCommentsV2(id, options)

require auth

pixiv.novelCommentsV3(id, options)

require auth

pixiv.novelCommentReplies(id, options)

require auth

pixiv.novelCommentRepliesV2(id, options)

require auth

pixiv.illustRelated(id, options)

require auth

pixiv.illustDetail(id, options)

require auth

pixiv.novelDetail(id, options)

require auth

[Deprecated] pixiv.novelText(id, options)

require auth

pixiv.novelWebview(id, raw)

require auth

pixiv.novelSeries(id, options)

require auth

pixiv.illustNew(options)

require auth

pixiv.illustFollow(options)

require auth

pixiv.novelFollow(options)

require auth

pixiv.illustRecommended(options)

require auth

pixiv.illustRanking(options)

require auth

pixiv.novelRanking(options)

require auth

pixiv.illustMyPixiv()

require auth

pixiv.novelMyPixiv()

require auth

pixiv.illustAddComment(id, comment, parentCommentId)

require auth

pixiv.novelAddComment(id, comment, parentCommentId)

require auth

pixiv.ugoiraMetaData(id)

require auth

pixiv.trendingTagsIllust(options)

require auth

pixiv.trendingTagsNovel(options)

require auth

pixiv.bookmarkIllust(id, restrict, tags)

require auth

pixiv.unbookmarkIllust(id)

require auth

pixiv.bookmarkNovel(id, restrict, tags)

require auth

pixiv.unbookmarkNovel(id)

require auth

pixiv.mangaRecommended(options)

require auth

pixiv.mangaNew(options)

require auth

pixiv.searchNovel(word, options)

require auth

pixiv.searchNovelPopularPreview(word, options)

require auth

pixiv.searchNovelBookmarkRanges(word, options)

require auth

pixiv.novelRecommended(options)

require auth

pixiv.novelNew(options)

require auth

pixiv.novelRanking(options)

require auth

pixiv.userRecommended(options)

require auth

pixiv.userFollowing(id, options)

require auth

pixiv.userFollower(id, options)

require auth

pixiv.userMyPixiv(id)

require auth

pixiv.followUser(id, restrict)

require auth

pixiv.unfollowUser(id)

require auth

pixiv.setLanguage(lang)

set HTTP header Accept-Language for pixiv api request

pixiv.requestUrl(url, options)

can be use to request pixiv endpoint or use for traversing results by passing next_url from result of other api such as pixiv.searchIllust

Tests

Export pixiv username and password before running Tests.

$ export refresh_token=pixiv account refresh_token
$ npm test

Related projects

PxView - Android/iOS client for Pixiv built in react-native

License

MIT