Socket
Book a DemoInstallSign in
Socket

gifs-api

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gifs-api

GIFS.com Public-API client

0.0.4
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

gifs-api

Node.js API for gifs.com's public-api for importing media.

Accepted media types:

  • gif -> image/gif.
  • mp4 -> video/mp4.
  • webm -> video/wemb.

Routes:

  • /import, takes in a source URL, sends it the API endpoint then imports it into gifs.com's API.
  • /upload, takes a file/stream/binary-data in the form of a multipart-form, sends it to the API endpoint then makes the equivalent files.

Sample usage in code:

  • Import any media, mp4, gif, webm
const gifs = require('gifs-api');

const urls = ['https://giant.gfycat.com/ClutteredSevereCur.gif', 'https://fat.gfycat.com/JovialPerkyArmyant.webm', 'https://pbs.twimg.com/tweet_video/Ca0ztmfWIAAi-UX.mp4'];
urls.forEach(function(url) {
  gifs.import(url, function(status, response) {
    console.log('url', url, status, response);
  });
});

// Alternatively
urls.forEach(function(url) {
  gifs.import({source: url, attribution: {user: 'nbcsnl', site: 'twitter'}, title: '40th Anniversary SNL'}, function(status, response) {
    console.log('url', url, status, response);
  });
});
  • To restrict importing, use:
  • gifs.importMP4.
  • gifs.importWEBM.
  • gifs.importGIF.
  • Upload any accepted media: mp4, gif, webm.
const fs   = require('fs');
const gifs = require('gifs-api');
const glob = require('glob');

glob('**/*.mp4', function(err, mp4Matches) {
  if (err)
    throw err;

  mp4Matches.forEach(function(mp4Match) {
    fs.readFile(mp4Match, function(err, stream) {
      if (err)
	throw err;

      var form = {
	file: stream,
	title: mp4Match,
	attribution_url: 'https://mysite.com',
	attribution_user: 'yourself',
	attribution_name: 'mysite',
      };

      gifs.upload(form, function(status, response) {
	console.log('mp4Match', mp4Match, status, response);
      });
  });
});

For stricter uploading, use:

  • gifs.uploadMP4.
  • gifs.uploadWEBM.
  • gifs.uploadGIF.

FAQs

Package last updated on 20 Mar 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.