Skip to content

Pixiv api client for node.js written in typescript.

License

Notifications You must be signed in to change notification settings

maple3142/pixiv-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pixiv-client

Pixiv api client for node.js written in typescript.

Example

// ES6:
import { PixivDesktopApi, PixivMobileApi, downloadAsStream } from 'pixiv-client'
// Commomjs:
const { PixivDesktopApi, PixivMobileApi, downloadAsStream } = require('pixiv-client')

;(async () => {
  // Desktop api examples
  const dc = await PixivDesktopApi.create() // no after-login function in PixivDesktopApi
  const r = await dc.getIllustData(70337017)
  downloadAsStream(r.urls.original).pipe(fs.createWriteStream(__dirname + '/test.png')) // or `await downloadToLocal(r.urls.original, __dirname + '/test.png')`
  console.log(await dc.getUserProfileData(5323203))

  // Mobile api examples
  const mc = await PixivMobileApi.login({
    username: 'USERNAME',
    password: 'PASSWORD'
  })
  console.log(await mc.getRanking('day'))
  console.log((await mc.getUserBookmarks(mc.oauth.info.user.id)).illusts)

  // Working with async iterator
  const ar = []
  const result = await c.searchIllusts('ノゾミ(プリコネ)', {
    searchTarget: 'exact_match_for_tags'
  })
  for await (const r of c.makeIterable(result)){
    ar.push(...r.illusts)
  }
  console.log(ar.length)
})()

Documentation

About

Pixiv api client for node.js written in typescript.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published