Pixiv Downloader
Download pics from pixiv with or without an account
If you want to see a use case go into the Code tab and look for the lib/main.js
file !!
All the functions who who need to be logged in will be noted in the JSDoc and in the README
Getting started
npm i @ibaraki-douji/pixivts --save
Getting pixiv Tags
const Pixiv = require("@ibaraki-douji/pixivts");
const pixiv = new Pixiv.Pixiv();
pixiv.predict('a tag').then(tags => {
console.log(tags);
})
Search artworks by tag
pixiv.getIllustsByTag('YOUR PIXIV TAG').then(res => {
console.log(res);
});
pixiv.getIllustsByTag('YOUR PIXIV TAG', {mode: 'all', page: 2}).then((res) => {
console.log(res);
});
Count all the pics for a tag
pixiv.getTagIllustCount("YOUR PIXIV TAG").then((res) => {
console.log(res);
});
pixiv.getTagIllustCount("YOUR PIXIV TAG", {mode: 'all'}).then((res) => {
console.log(res);
});
Get related tags from another tag
pixiv.getRelatedTags("YOUR PIXIV TAG").then((res) => {
console.log(res);
});
Search Artworks by User
pixiv.getIllustsByUserID('THE ID', {limit: 100}).then(res => {
console.log(res);
});
Retriving All infos from an artwork
pixiv.getIllustByID('ID').then(res => {
console.log(res);
});
Download the image
pixiv.download(new URL(artwork.urls[0].original)).then(res => {
fs.writeFileSync("./test.jpg", res);
});
Get daily ranking (Login required)
pixiv.getDailyRanking().then(res => {
console.log(res);
});
Get recommended users (Login required)
pixiv.getRecommendedUsers().then(res => {
console.log(res);
});
Get favorite tags (Login required)
pixiv.getFavoriteTags().then(res => {
console.log(res);
});
Get recommended illusts (Login required)
pixiv.getRecommendedIllusts().then(res => {
console.log(res);
});
Get new illusts (Login required)
pixiv.getNewIllusts().then(res => {
console.log(res);
});
Login with credentials
⚠ You need to install puppeteer npm i puppeteer --save
This function will open a browser to login and the user can verify the captcha (if prompted)
pixiv.login('email or id', 'pass').then(logged => {
console.log(logged);
});
Login with cookies (Recommended)
To get the cookies go to pixiv, login to your account.
Then open the dev tools Ctrl+Shift+I
or F12
, go in the network tab.
After select a line (a picture or anything), in the popup search Headers tab and find cookies. After that copy ALL cookies (this is a big cookie data) and parse it in the program. (btw don't take the cookies:
just take the value).
pixiv.staticLogin('cookies 🍪', 'the same useragent of the cookies');
Check the login
let loged = pixiv.isLogged();
Logout
pixiv.logout();
Get the current login infos
let creds = pixiv.getLogin();
console.log(creds);
Thanks for downloading my pixiv package, if you have any questions or suggestions, feel free to contact me on Discord : Ibaraki Douji#1406