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

giphy-api-without-credentials

v1.1.0

Published

Node.js Giphy API, modified to fix CORS errors in browser apps

Downloads

18

Readme

giphy-api-without-credentials

Simple to use Node.js module for the giphy.com API. All search parameters and endpoints can be found on the Giphy API documentation.

This version is a minor tweak of Austin Kelleher's giphy-api module that simply sets withCredentials to false in the HTTP request.

Are you seeing this error in your browser app?

A wildcard '*' cannot be used in the 'Access-Control-Allow-Origin' header when the credentials flag is true.

If so, this right here is the module you're looking for.

Giphy logo

Installation

npm i giphy-api-without-credentials -S

Importing

Since the original module receives the API key by invocation which is not supported by ES6 import, you'll have to use require()

// If you have your own API key, use import the module like this
const giphy = require('giphy-api-without-credentials')('API KEY HERE');
// If you're using the public api key you can just invoke without an argument
const giphy = require('giphy-api-without-credentials')();

Phrase search

Search all Giphy GIFs for a word or phrase. Supported parameters:

  • q - search query term or phrase
  • limit - (optional) number of results to return, maximum 100. Default 25.
  • offset - (optional) results offset, defaults to 0.
  • rating - limit results to those rated (y,g, pg, pg-13 or r).
  • fmt - (optional) return results in html or json format (useful for viewing responses as GIFs to debug/test)
// Search with a plain string
giphy.search('pokemon', function(err, res) {
    // Res contains gif data!
});
// Search with options
giphy.search({
    q: 'pokemon',
    rating: 'g'
}, function(err, res) {
    // Res contains gif data!
});

Giphy Id search

Search all Giphy gifs for a single Id or an array of Id's

//Search with a single Id
giphy.id('feqkVgjJpYtjy', function(err, res) {

});
// Search with an array of Id's
giphy.id([
    'feqkVgjJpYtjy',
    '7rzbxdu0ZEXLy'
], function(err, res) {

});

Translate search

Experimental search endpoint for gif dialects. Supported parameters:

  • s - term or phrase to translate into a GIF
  • rating - limit results to those rated (y,g, pg, pg-13 or r).
  • fmt - (optional) return results in html or json format (useful for viewing responses as GIFs to debug/test)
// Translate search with a plain string
giphy.translate('superman', function(err, res) {

});
// Translate search with options
giphy.translate({
    s: 'superman',
    rating: 'g',
    fmt: 'html'
}, function(err, res) {

});

Random

Random gif(s) filtered by tag. Supported parameters:

  • tag - the GIF tag to limit randomness by
  • rating - limit results to those rated (y,g, pg, pg-13 or r).
  • fmt - (optional) return results in html or json format (useful for viewing responses as GIFs to debug/test)
// Random gif by tag
giphy.random('superman', function(err, res) {

});
// Random gif with options
giphy.random({
    tag: 'superman',
    rating: 'g',
    fmt: 'json'
}, function(err, res) {

});

Trending

Trending gifs on The Hot 100 list

  • limit (optional) limits the number of results returned. By default returns 25 results.
  • rating - limit results to those rated (y,g, pg, pg-13 or r).
  • fmt - (optional) return results in html or json format (useful for viewing responses as GIFs to debug/test)
// Trending Hot 100 gifs
giphy.trending(function(err, res) {

});
// Trending Hot 100 gifs with options
giphy.trending({
    limit: 2,
    rating: 'g',
    fmt: 'json'
}, function(err, res) {

});

Stickers

Animated stickers are gifs with transparent backgrounds. All giphy-api functions support stickers except id, which is not a supported Giphy sticker endpoint. In order to use the sticker API instead of the gif API, simply pass the api property to a giphy-api function.

giphy.search({
    api: 'stickers',
    q: 'funny'
}, function(err, res) {

});