npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

jvc

v0.2.4

Published

Node.js jeuxvideo.com API client.

Downloads

5

Readme

jvc npm version

Node.js jeuxvideo.com API client.

Caution

This library is in early beta, and not complete at all. I implemented only the methods I needed, and I'm not going to add support for other methods unless I need them too.

However, I happily accept pull requests; feel free to implement the features you need, and please get in touch with me if you need some advices on how to hack this library.

Usage

const jvc = require('jvc')

You can then call all the supported API methods on the jvc object. Some methods will require you to be logged in (like private messages access and forums post), while others will work anonymously.

Also, the jvc object is fully overridable thanks to bind-late. Look the source to see what you can customize!

All code examples that need a connected API will use connectedJvc object, and anonymous methods will just use jvc.

All the code examples assume to be run in an ES7 asynchronous function.

Login

// Need to handle captcha prompts.
const handleCaptcha = async err => {
  if (!err.captcha) {
    throw err
  }

  // Prompt the user to fill given captcha URL.
  const code = await doSomethingWith(err.captcha)

  return await err.retry(code) // Retry request.
    .then(null, handleCaptcha) // Recursively ask for captcha.
}

const connectedJvc = await jvc.login({ user: 'foo', pass: 'bar' })
  .then(null, handleCaptcha)

// You can then call methods that require connection on `connectedJvc`.

Note: once you have a connectedJvc object, you can find the connection cookie in connectedJvc.user.cookie. If you store it permanently, you can restore it like this:

const connectedJvc = jvc.override({
  user: { cookie: 'the cookie you stored' },
})

This way you avoid getting the captcha prompt everytime. Though, I have no idea how long the cookie will stay valid. Please tell me if you have more informations about this.

Private messages

List

// Get first page.
const list = await connectedJvc.pm.list()

// list:
//   count: Number
//   page: Number
//   unread: Number
//   threads:
//     - id: Number
//       subject: String
//       author: String
//       date: Date
//       isRead: Boolean
//

// Get second page.
const next = await connectedJvc.pm.list({ page: 2 })

Thread

// Get the last 5 messages of a thread (ID from previous list).
const thread = await connectedJvc.pm.thread({ id: list.threads[0].id })

// thread:
//   id: Number
//   subject: String
//   members: [String]
//   count: Number
//   next: Number
//   messages:
//     - image: String
//       author: String
//       date: Date
//       post: String

// Get next 10 messages.
const next = await connectedJvc.pm.thread({
  id: list.threads[0].id,
  offset: thread.next,
})

Example

See the jvc-cli project for a concrete usage example. Or if you just want an interactive demo:

npm install -g jvc-cli
jvc login
jvc pm