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

@mkusaka/pocket-api-client

v0.0.4

Published

pocket api client

Readme

pocket-api-client

promise based pocket api client. Inspired by https://github.com/tobiaswright/pocket-api and https://github.com/vicchi/node-getpocket/blob/master/getpocket.js

install

npm install --save @mkusaka/pocket-api-client

useage

node

import ApiClient from "@mkusaka/pocket-api-client";

/*
  get request token
    you may have to authorize app using oauth2. steps are below.

    1. make server at locahost (example are at main.go, `go run main.go` up server at `http://localhost:8080/get`)

    2. make code and execute as below.
*/

const client = new ApiClient("your consumer_key");
client.getRequestToken()

/*
    3. then, url shown at console log like follow. so access and add permisson to application.
    open following url and accept application with running local server (go run main.go makes good for use). This must operate at least once.
          https://getpocket.com/auth/authorize?request_token=1111-abdc-eee&redirect_uri=http://localhost:8080/get


// I think this sequence are very troublesome (this troublesome comes from low understanding of me.. ). I should add some adequate redirect process, then it makes easier.
*/

/*
  get access token
    you can get access token using reuquest token and consumer_key exist. steps are below
      1. get consumer_key and request token (like above).
      2. set client and request
*/

const client = new ApiClient("your consumer_key", {
  requestToken: "your request token"
});

/*
  get articles
    you can article using access_key and consumer_key exist. steps are below
      1. get consumer_key and access key (like above).
      2. set client and request
*/

const client = new ApiClient("your consumer_key", {
  accessToken: "your request token",
});

client.retrieveArticles({
  count: 1
})
  .then(articles => {
    // some process
  });

example use

import ApiClient, { responseArticle } from "@mkusaka/pocket-api-client";
var fs = require("fs");


async function fn() {
  const client = new ApiClient("consumer_key", {
    accessToken: "access_token",
  });
  return await client.retrieveArticles({
    since: 1555081200,
    state: "all"
  }).then(articles => {
    const mdarticles = articles.map((e: responseArticle) => {
      return `- [${e.resolved_title && e.resolved_title.length > 0 ? e.resolved_title : e.resolved_title}](${e.resolved_url && e.resolved_url.length > 0 ? e.resolved_url : e.given_url})`
    }).join("\n")

    return mdarticles
  })
  .then(mdarticles => {
    return fs.writeFile("out.md", mdarticles, err => {
      if (err) console.log(err);
      else console.log("write file end");
    });
  });
}

fn();

(my) output

- [Linux From Scratch](http://www.linuxfromscratch.org/lfs/view/stable/)
- [Fixing the Gemfile not found (Bundler::GemfileNotFound) error](https://blog.willj.net/2011/08/02/fixing-the-gemfile-not-found-bundlergemfilenotfound-error/)
...

TODO

  • seamless process like follow will be implemented (maybe).
const client = new ApiClient("your consumer_key", {
}).
  client.retrieveArticles({
  count: 1
})
  .then(articles => );

ref