Package Exports
- pixiv-api-client
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-api-client) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Pixiv API Client
Promise based Pixiv API client for node.js and react native
Install
$ npm install pixiv-api-client --save
Usage
const PixivApi = require('pixiv-api-client');
const pixiv = new PixivApi();
const word = 'ラブライブ';
//login and call api that require login
pixiv.login('username', 'password').then(() => {
return pixiv.illustFollow().then(json => {
console.log(json);
return json;
});
});
//search illusts
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.searchIllust(word, options)
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)
word
- word to search (required)
pixiv.searchAutoComplete(word)
word
- word to search (required)
pixiv.userDetail(userId, options)
userId
- Pixiv user idoptions
- object (optional)
pixiv.userIllusts(id, options)
id
- Pixiv illust idoptions
- object (optional)
pixiv.userBookmarksIllust(id, options)
id
- Pixiv illust idoptions
- object (optional)restrict
- one ofpublic
|private
pixiv.illustBookmarkDetail(id, options)
require auth
id
- Pixiv illust idoptions
- object (optional)
pixiv.illustComments(id, options)
id
- Pixiv illust idoptions
- object (optional)
pixiv.illustRelated(id, options)
id
- Pixiv illust idoptions
- object (optional)
pixiv.illustDetail(id, options)
id
- Pixiv illust idoptions
- object (optional)
pixiv.illustNew(options)
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)
mode day_r18
| day_male_r18
| day_female_r18
| week_r18
| week_r18g
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
(default:day
)
pixiv.trendingTagsIllust(options)
options
- object (optional)
pixiv.bookmarkIllust(id)
require auth
id
- Pixiv illust idoptions
- object (optional)restrict
- one ofpublic
|private
(default:public
)
pixiv.unbookmarkIllust(id)
require auth
id
- Pixiv illust idoptions
- object (optional)restrict
- one ofpublic
|private
(default:public
)
pixiv.mangaRecommended(options)
options
- object (optional)
pixiv.mangaNew(options)
options
- object (optional)
pixiv.searchNovel(word, options)
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)
options
- object (optional)
pixiv.userRecommended(options)
options
- object (optional)
pixiv.userFollowing(id, options)
restrict private
require auth
id
- Pixiv user idoptions
- object (optional)restrict
:public
|private
(default:public
)
pixiv.followUser(id)
require auth
id
- Pixiv user id
pixiv.unfollowUser(id)
require auth
id
- Pixiv user id
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
License
MIT