pixiv-client
    TypeScript icon, indicating that this package has built-in type declarations

    0.3.1 • Public • Published

    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

    Keywords

    none

    Install

    npm i pixiv-client

    DownloadsWeekly Downloads

    1

    Version

    0.3.1

    License

    MIT

    Unpacked Size

    23.6 kB

    Total Files

    23

    Last publish

    Collaborators

    • maple3142