[go: up one dir, main page]

giffer-adapter-twitter

1.0.0 • Public • Published

giffer-adapter-twitter - An image grabber for twitter

Originally made to be used with the giffer download bot Giffer. This adapter can also be used standalone to grab gifs from the public twitter API endpoints.

Authentication

enter your Twitter API credentials in the config.js file, see config.js.example

API

The Giffer Twitter Adapter has the following API:

new Adapter(endpoint, parameters, imageTypes)

Creates a new Adapter object

endpoint (required)

The following values can be provided:

See Twitter Dev API

parameters (required)

Object holding optional Twitter Stream API endpoint parameters. The Twitter Stream API endpoints can take a set of given parameters which can be found in the API documentation for each endpoint.

imageTypes

Regexp String containing the images we want the Adapter to emit

Example:

'gif|jpe?g|png'

or

'gif'

Adapter.start()

Starts the Giffer Adapter

Adapter.stop()

Stops the Giffer Adapter

Example

Instantiating and starting

  const instance = new Adapter({
    endpoint: 'statuses/filter',
    parameters: {
      track: ['javascript', 'gifs', 'funny', 'images', 'pics'],
      stall_warnings: true
      },
    image_types: '(gif|jpg|jpeg|png)'
  });
  instance.start();

Listening to the gif event

  instance.on('gif', (url, metadata) => {
    console.log('image url', url);
    console.log('tweet source url', metadata.origin);
  });

Package Sidebar

Install

npm i giffer-adapter-twitter

Weekly Downloads

2

Version

1.0.0

License

ISC

Last publish

Collaborators

  • gmickel