Promise based Pixiv API client for node.js and react native
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.
$ npm install pixiv-api-client --save
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
});
});
options
- object (optional)headers
: custom headers for request
code
- Authorization code return by pixiv auth server through PKCE flowcodeVerifier
- Code verifier generated from PKCE challenge
Api client will try once to relogin again on error if rememberPassword is set to true
username
- Pixiv usernamepassword
- Pixiv passwordrememberPassword
- Boolean (default:true
)
Refresh access token with refreshToken
refreshToken
- string (if not provided, will use refresh token that stored with api client after login)
nickName
- string
require auth
require auth
fields
- object- pixivId
- currentPassword
- newPassword
require auth
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
|popular_desc
(popular_desc
only available for pixiv premium member) (default:date_desc
)start_date
: Dateend_date
: Date
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
)start_date
: Dateend_date
: Date
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
)start_date
: Dateend_date
: Date
require auth
word
- word to search (required)
require auth
word
- word to search (required)
require auth
word
- word to search (required)
userId
- Pixiv user id (required)options
- object (optional)
require auth
id
- Pixiv user id (required)options
- object (optional)type
- one ofillust
|manga
require auth
id
- Pixiv user id (required)options
- object (optional)restrict
- one ofpublic
|private
(default:public
)
require auth
options
- object (optional)restrict
- one ofpublic
|private
(default:public
)
require auth
id
- Pixiv user id (required)options
- object (optional)
require auth
id
- Pixiv user idoptions
- object (optional)restrict
- one ofpublic
|private
(default:public
)
require auth
options
- object (optional)restrict
- one ofpublic
|private
(default:public
)
require auth
id
- Pixiv illust id (required)options
- object (optional)
require auth
id
- Pixiv novel id (required)options
- object (optional)
require auth
id
- Pixiv illust id (required)options
- object (optional)
require auth
id
- Pixiv illust id (required)options
- object (optional)
require auth
id
- Pixiv illust id (required)options
- object (optional)
require auth
id
- Pixiv illust comment id (required)options
- object (optional)
require auth
id
- Pixiv illust comment id (required)options
- object (optional)
require auth
id
- Pixiv novel id (required)options
- object (optional)
require auth
id
- Pixiv novel id (required)options
- object (optional)
require auth
id
- Pixiv novel id (required)options
- object (optional)
require auth
id
- Pixiv novel comment id (required)options
- object (optional)
require auth
id
- Pixiv novel comment id (required)options
- object (optional)
require auth
id
- Pixiv illust id (required)options
- object (optional)
require auth
id
- Pixiv illust id (required)options
- object (optional)
require auth
id
- Pixiv novel id (required)options
- object (optional)
require auth
id
- Pixiv novel id (required)options
- object (optional)
require auth
id
- Pixiv novel id (required)raw
- boolean (optional, default is false) Set to true to return return raw response string or false to return novel object
require auth
id
- Pixiv novel series id (required)options
- object (optional)
require auth
options
- object (optional)
require auth
options
- object (optional)restrict
- one ofall
|public
|private
(default:all
)
require auth
options
- object (optional)restrict
- one ofall
|public
|private
(default:all
)
require auth
options
- object (optional)
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
)
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
)
require auth
require auth
require auth
id
- Pixiv illust id (required)comment
- string (required)parentCommentId
- Pixiv comment id (optional, to reply to comment`
require auth
id
- Pixiv novel id (required)comment
- string (required)parentCommentId
- Pixiv comment id (optional, to reply to comment`
require auth
id
- Pixiv illust(ugoira) id (required)
require auth
options
- object (optional)
require auth
options
- object (optional)
require auth
id
- Pixiv illust id (required)restrict
- one ofpublic
|private
(default:public
)tags
- array of string (optional)
require auth
id
- Pixiv illust id (required)
require auth
id
- Pixiv novel id (required)restrict
- one ofpublic
|private
(default:public
)tags
- array of string (optional)
require auth
id
- Pixiv novel id (required)
require auth
options
- object (optional)
require auth
options
- object (optional)
require auth
word
- word to search (required)options
- object (optional)search_target
:partial_match_for_tags
|text
|keyword
(default:partial_match_for_tags
)sort
:date_desc
|date_asc
|popular_desc
(popular_desc
only available for pixiv premium member) (default:date_desc
)start_date
: Dateend_date
: Date
require auth
word
- word to search (required)options
- object (optional)search_target
:partial_match_for_tags
|text
|keyword
(default:partial_match_for_tags
)sort
:date_desc
|date_asc
|popular_desc
(popular_desc
only available for pixiv premium member) (default:date_desc
)start_date
: Dateend_date
: Date
require auth
word
- word to search (required)options
- object (optional)search_target
:partial_match_for_tags
|text
|keyword
(default:partial_match_for_tags
)start_date
: Dateend_date
: Date
require auth
options
- object (optional)
require auth
options
- object (optional)
require auth
options
- objectdate
: Datemode
:day
|week
|day_male
|day_female
|week_rookie
|day_r18
|day_male_r18
|day_female_r18
|week_r18
|week_r18g
(default:day
)
require auth
options
- object (optional)
require auth
id
- Pixiv user id (required)options
- object (optional)restrict
:public
|private
(default:public
)
require auth
id
- Pixiv user id (required)options
- object (optional)
require auth
id
- Pixiv user id (required)
require auth
id
- Pixiv user id (required)restrict
- one ofpublic
|private
(default:public
)
require auth
id
- Pixiv user id (required)
set HTTP header Accept-Language for pixiv api request
lang
- HTTP header Accept-Language
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)
Export pixiv username and password before running Tests.
$ export refresh_token=pixiv account refresh_token
$ npm test
PxView - Android/iOS client for Pixiv built in react-native
MIT