pixiv-api-client-zzh1234567
v0.16.0
Published
Promise based Pixiv API client for react native and node.js
Downloads
12
Maintainers
Readme
Pixiv API Client
Promise based Pixiv API client for node.js and react native
Install
$ npm install pixiv-api-client-zzh1234567 --save
Usage
const PixivApi = require('pixiv-api-client-zzh1234567');
const pixiv = new PixivApi();
const word = 'ラブライブ';
pixiv.login('username', 'password').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()
pixiv.login(username, password, rememberPassword)
Api client will try once to relogin again on error if rememberPassword is set to true
username
- Pixiv usernamepassword
- Pixiv passwordrememberPassword
- Boolean (default:true
)
pixiv.logout()
pixiv.refreshAccessToken(refreshToken)
Refresh access token with refreshToken
refreshToken
- string (if not provided, will use refresh token that stored with api client after login)
pixiv.createProvisionalAccount(nickName)
nickName
- string
pixiv.userState()
require auth
pixiv.editUserAccount(fields)
require auth
fields
- object- pixivId
- currentPassword
- newPassword
pixiv.sendAccountVerificationEmail()
require auth
pixiv.searchIllust(word, options)
require auth
word
- word to search (required)options
- object (optional)search_target
:partial_match_for_tags
|exact_match_for_tags
|title_and_caption
(default:partial_match_for_tags
)sort
:date_desc
|date_asc
(default:date_desc
)duration
:within_last_day
|within_last_week
|within_last_month
pixiv.searchUser(word)
require auth
word
- word to search (required)
pixiv.searchAutoComplete(word)
require auth
word
- word to search (required)
pixiv.userDetail(userId, options)
userId
- Pixiv user idoptions
- object (optional)
pixiv.userIllusts(id, options)
require auth
id
- Pixiv illust idoptions
- object (optional)type
- one ofillust
|manga
pixiv.userBookmarksIllust(id, options)
require auth
id
- Pixiv illust idoptions
- object (optional)restrict
- one ofpublic
|private
(default:public
)
pixiv.userBookmarkIllustTags(options)
require auth
options
- object (optional)restrict
- one ofpublic
|private
(default:public
)
pixiv.illustBookmarkDetail(id, options)
require auth
id
- Pixiv illust idoptions
- object (optional)
pixiv.illustComments(id, options)
require auth
id
- Pixiv illust idoptions
- object (optional)
pixiv.illustRelated(id, options)
require auth
id
- Pixiv illust idoptions
- object (optional)
pixiv.illustDetail(id, options)
require auth
id
- Pixiv illust idoptions
- object (optional)
pixiv.illustNew(options)
require auth
options
- object (optional)
pixiv.illustFollow(options)
require auth
options
- object (optional)restrict
- one ofall
|public
|private
(default:all
)
pixiv.illustRecommended(options)
require auth
options
- object (optional)
pixiv.illustRecommendedPublic(options)
options
- object (optional)
pixiv.illustRanking(options)
require auth
options
- objectdate
: Datemode
:day
|week
|month
|day_male
|day_female
|week_original
|week_rookie
|day_r18
|day_male_r18
|day_female_r18
|week_r18
|week_r18g
|day_manga
|week_manga
|month_manga
|week_rookie_manga
|day_r18_manga
|week_r18_manga
|week_r18g_manga
(default:day
)
pixiv.illustMyPixiv()
require auth
pixiv.illustAddComment(id, comment)
require auth
id
- Pixiv illust idcomment
- string
pixiv.ugoiraMetaData(id)
require auth
id
- Pixiv illust(ugoira) id
pixiv.trendingTagsIllust(options)
require auth
options
- object (optional)
pixiv.bookmarkIllust(id, restrict, tags)
require auth
id
- Pixiv illust idrestrict
- one ofpublic
|private
(default:public
)tags
- array of string (optional)
pixiv.unbookmarkIllust(id)
require auth
id
- Pixiv illust id
pixiv.mangaRecommended(options)
require auth
options
- object (optional)
pixiv.mangaNew(options)
require auth
options
- object (optional)
pixiv.searchNovel(word, options)
require auth
word
- word to search (required)options
- object (optional)search_target
:partial_match_for_tags
|exact_match_for_tags
|title_and_caption
(default:partial_match_for_tags
)sort
:date_desc
|date_asc
(default:date_desc
)duration
:within_last_day
|within_last_week
|within_last_month
pixiv.novelRecommended(options)
require auth
options
- object (optional)
pixiv.novelRecommendedPublic(options)
options
- object (optional)
pixiv.novelNew(options)
require auth
options
- object (optional)
pixiv.userRecommended(options)
require auth
options
- object (optional)
pixiv.userFollowing(id, options)
require auth
id
- Pixiv user idoptions
- object (optional)restrict
:public
|private
(default:public
)
pixiv.userFollower(id, options)
require auth
id
- Pixiv user idoptions
- object (optional)
pixiv.userMyPixiv(id)
require auth
id
- Pixiv user id
pixiv.followUser(id, restrict)
require auth
id
- Pixiv user idrestrict
- one ofpublic
|private
(default:public
)
pixiv.unfollowUser(id)
require auth
id
- Pixiv user id
pixiv.setLanguage(lang)
set HTTP header Accept-Language for pixiv api request
lang
- HTTP header Accept-Language
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
options
- object (optional)
Tests
Export pixiv username and password before running Tests.
$ export USER_NAME=Pixiv username
$ export PASSWORD=Pixiv password
$ npm test
Related projects
PxView - Android/iOS client for Pixiv built in react-native
License
MIT