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 🙏

© 2025 – Pkg Stats / Ryan Hefner

node-23video

v1.0.8

Published

node-23video is a full implementation of The 23 Video API (or more correctly, The Visualplatform API) for Node.js.

Readme

23 Video API for Node.js

node-23video is a full implementation of The 23 Video API (or more correctly, The Visualplatform API) for Node.js.

The library includes:

  • Implementations of all the methods in the API.
  • Methods to handle the exchange of OAuth of credentials (more information).
  • A handy command-line interface to the 23 Video API.

The library and it dependencies is easily installed with npm install node-23video:

Use the 23 Video API in Node.js

Making simple request to the open API:

var Visualplatform = require('node-23video')
var vp = Visualplatform(domain);
vp.album.list({search:'test'})
  .then(
    function(data){...},
    function(errorMessage){...}
  );

Making OAuth signed requests to the API:

var Visualplatform = require('node-23video')
var vp = Visualplatform(domain, key, secret);
vp.album.create({title:'New album'}, access_token. access_token_secret)
  .then(
    function(data){...},
    function(errorMessage){...}
  );

Methods can be called as:

vp.photo.updateUploadToken(...)
vp['photo.updateUploadToken'](...)
vp['/api/photo/update-upload-token'](...)

The first parameter is always a JS object with the filter data described in the API documentation.

All methods requiring authentication takes access_token and access_token_secret as their second and third parameters.

The library using @kriszyp's node-promise complete implementation of JavaScript promises.

Making use of cached responses

If you add a requestMethod with value GET' to the request arguments, the module will use an anonymous GET request, to make use of caching and save resources on the api. Will be overruled if include_unpublished_p is true, since administritive permissions are necessary and can't be made with a GET-request.

Exchanging tokens (or: Having user grant access to the API)

The library includes two methods wrapping the OAuth token flow, .beginAuthentication() and .endAuthentication().

A few examples can illustrate how the methods are used. First, the command-line interface uses it like this:

var visualplatform = require('./visualplatform')(program.domain, program.key, program.secret, 'oob');
visualplatform.beginAuthentication()
  .then(function(url){
        console.log('To verify access, open the following URL in your browser and follow the instructions.\n  '+url+'\n');
        program.prompt('To complete the authorization, paste the string from the browser here: ', function(verifier){
                         process.stdin.destroy();
                         visualplatform.completeAuthentication(null, verifier)
                           .then(
                             function(credentials){
                                   console.log('\nCREDENTIALS FOR 23 VIDEO:');
                                   console.log('Domain:\t\t\t', credentials.domain);
                                   console.log('Consumer key:\t\t', program.key);
                                   console.log('Consumer secret:\t', program.secret);
                                   console.log('Access token:\t\t', credentials.oauth_token);
                                   console.log('Access token secret:\t', credentials.oauth_token_secret);
                                   console.log('')
                                 },
                             function(message){
                                   console.log('Error while completing authentication:', message);
                                 });
                       });
      }, function(message){
        console.log('Error while beginning authentication:', message);
      });

A more likely example handles login through 23 Video. In the Express application framework, this might be achieved like this:

// Instance of the library
var visualplatform = require('./visualplatform')(null, program.key, program.secret, 'http://examples.com/oauth/23video');

// Bootstrap Express to handle HTTP service
var express = require('express');
var app = express.createServer();

// Create a URL at http://examples.com/oauth/23video/redirect which initiates the flow
app.get('/oauth/23video/redirect', function(req, res){
    visualplatform.beginAuthentication()
      .then(function(url){
          res.redirect(url);
       })
});

// Create a URL at http://examples.com/oauth/23video to handle callback and retrieval of access credentials
app.get('/oauth/23video, function(req, res){
    visualplatform.completeAuthentication(req.query.oauth_token, req.query.oauth_verifier)
      .then(function(credentials){
          console.log('domain', credentials.domain);
          console.log('site_id', credentials.site_id);
          console.log('token', credentials.oauth_token);
          console.log('token secret', credentials.oauth_token_secret)
          res.redirect('/');
        })
});

Using the command-line interface for Node.js

The library comes with ./23video a command-line interface (CLI) for The 23 Video API. Like the library itself, the CLI does open API requests, signed request and can handle token exchange or login.

Open requests without signatures

./23video -m photo.list search test limit 30

Signed requests to the API

./23video -k <consumer_key> -s <consumer_secret> -at <access_token> -as <access_secret> -m photo.list search test limit 30

Get access credentials from consumer keys

./23video --auth -k <consumer_key> -s <consumer_secret>

Full documentation is available with ./23video --help:

Usage: 23video [options]

Options:

-h, --help                            output usage information
-V, --version                         output the version number
-m, --method <method>                 Method to call in the 23 Video API
-h, --hostname [hostname]             Domain for the 23 Video site
-a, --auth                            Authenticate against the 23 Video API
-k, --key [key]                       OAuth consumer key
-s, --secret [secret]                 OAuth consumer secret
-at, --access_token [access_token]    OAuth access token
-as, --access_secret [access_secret]  OAuth access token secret

To-do

  • Handle file uploads in the library
  • Handle file uploads through CLI
  • Store credentials on disk for easy access on the CLI
  • Prompt for domain, method, key/secret in CLI when required