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

frinkiac

v1.0.2

Published

A Universal JavaScript wrapper for the Frinkiac API

Downloads

49

Readme

Frinkiac

Universal JavaScript library for Frinkiac. (un-official)

Professor Frink

Installation

npm install --save frinkiac

Usage

This is a Node.js search wrapper for the Amazing Frinkiac Search Engine. https://frinkiac.com

Here's a simple example of using Frinkiac's (public?) search API to get a list of episode and timestamp results for a Simpsons related quote.

// basic search usage
var frinkiac = require('frinkiac');

frinkiac.search('smrt')
    .then(function(res) {
        if (res.status !== 200) {
            throw res;
        } else {
            return res.data;
        }
    })
    .catch(function(err) {
        throw err;
    })
    .then(function(data) {
        var memeURLs = data.map(frinkiac.memeMap, frinkiac); // ['https://frinkiac.com/meme/S05E03/512110?b64lines=']
        //note: memeMap doesn't do bas64 encoding for the caption lines
    });

This module's search API eg. frinkiac.search('stupid flanders') returns a promise with the original response object, So you need to check the response object status before moving on.

As a helper function, you can use frinkiac.memeMap(val, idx) to turn all the search responses into proper meme url's, but make sure to bind the frinkiac object to the map eg. data.map(frinkiac.memeMap, frinkiac)

This module also provides URL utilities that you can use to form your own requests These are unbound URL utils, and might be all you need to design your own req, res workflow.

var mySearchURL = frinkiac.searchURL('blurst of times'); // 'https://frinkiac.com/api/search?q=blurst%20of%20times'
var myMemeURL = frinkiac.memeURL('S04E17', '798296', 'Blurst of times?!') // 'https://frinkiac.com/meme/S04E17/798296?b64lines=Qmx1cnN0IG9mIHRpbWVzPyE%3D'
var myCaptionURL = frinkiac.captionURL('S04E17', '798296') // 'https://frinkiac.com/api/caption?e=S04E17&t=798296'

API

.memeMap(Array) => function(item, idx) => Array

Util to quickly map over search results and return proper image URLs.

.captionURL(episode, timestamp) => String

Util to generate a URL for the Frinkiac Caption API. Episode and timestamp are strings you get from the search url.

.memeURL(episode, timestamp, caption) => String

Util to generate a URL for the Frinkiac Meme API which returns an image with a caption. Args can all be Strings.

.searchURL(quotation) => String

Util to generate a URL that can be used to get Search results from Frinkiac. Input whatever quote, name, etc. to get results.

.search(quotation) => Promise

API helper to get you a direct interface with Frinkiac API. No setup or teardown needed as long as you have a network connection and Ajax stack in either Node, Chrome, etc. Will return an Axios promise that should be checked for status codes before returning the next thenable. Also note, Axios' response object uses response.data to reference the actual data from response.

Etc.

npm test to run tests and node examples/example.js to see a set of results returned in the console.

License

MIT © Amir Djavaherian