gif-provider
gif-provider is a JavaScript module that allows you to querying various gif APIs. Queries can be done to a single API at a time, or to multiple, with the results aggregated.
The module currently supports fetching gifs from Giphy. Support for Tenor is in progress.
You can easily extend gif-provider to support other APIs, either by contributing on GitLab, or by implementing your own GifProvider class.
Installation
npm install --save @jych/gif-provider
Getting Started
Installing
In Node and CommonJS build systems:
const {GifProviderFactory} = require('@jych/gif-provider');
In ES6 Modules and Typescript:
import {GifProviderFactory} from 'jych/gif-provider';
Example Usage
Querying Giphy:
const {GiphyGifProvider} = require('@jych/gif-provider');
const gifProvider = new GiphyGifProvider();
gifProvider.search("rat mouse")
.then( gifs => {
// ...
} );
Querying multiple sites:
const {CompositeGifProvider, GifProviderFactory} = require('@jych/gif-provider');
const gifProvider =
new CompositeGifProvider(GifProviderFactory.getProviders([ "giphy", "other", "foobar" ]));
gifProvider.search("rat mouse")
.then( gifs => {
// gifs is a flat array of results from each site
// ...
} );
Docs
Full docs can be generated for offline use with:
npm i @jych/gif-provider
cd node_modules/@jych/gif-provider
npm i
npm run generate-docs
cd docs
open index.html