Socket
Socket
Sign inDemoInstall

twitter-video

Package Overview
Dependencies
90
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    twitter-video

Easily posts native video to twitter's video API.


Version published
Weekly downloads
208
increased by14.92%
Maintainers
1
Install size
6.66 MB
Created
Weekly downloads
 

Changelog

Source

2.0.0 2015-08-05

  • Introduced streaming interface as the default export. Initial documentation on how to use is in the readme.
  • Old file path based interface moved to the .fromFile method. It should work the same.
  • More README updates, and streaming API improvements coming soon!

Readme

Source

twitter-video

npm travis

Posts native video to twitter's video API.

Install

npm install twitter-video

Usage

var twitterVideo = require('twitter-video')
var Twit = require('twit')

var oauth = {
  consumer_key: '123',
  consumer_secret: '123',
  access_token: '123',
  access_token_secret: '123'
}

var T = Twit(oauth)
var PATH = '/path/to/video.mp4'

twitterVideo.fromFile(PATH, oauth, function (err, media_id) {
  // Now you have a media ID you can post with a tweet
  var params = {status: 'yolo', media_ids: [ media_id ]}
  T.post('statuses/update', params, function post (err, data, res) {
    // Tweet with video is live
  })
})

var twitterStream = twitterVideo(oauth)
var videoStream = fs.createWriteStream(PATH)

twitterStream.on('finish', function() {
  twitterStream.on('media_id', function(media_id) {
    var params = {status: 'so nice i posted it twice', media_ids: [ media_id ]}
    T.post('statuses/update', params, function post (err, data, res) {
      // Tweet with video is live
    })
  })
})

videoStream.pipe(twitterStream)

CLI

npm i -g twitter-video

Installing this globally gives you access to the twitter-video command:

$ twitter-video
Uploads .mp4 video to twitter with a status updates
Usage: twitter-video [options]
    --config              configure your API keys
    --video, -v           path to mp4 file e.g. '~/myVideo.mp4' (requires -s)
    --status, -s          twitter status text e.g. 'this is a tweet yolo' (requires -v)

Before you can post videos to twitter, you need to configure your oAuth keys.

  1. Visit: https://apps.twitter.com
  2. Create a new app. This requires that a cell number is added to your twitter account.
  3. Generate an access token on the "Keys and Access Tokens" tab

Next configure twitter-video

$ twitter-video --config
? Consumer Key 123
? Consumer Secret ***
? Access Token 123
? Access Token Secret ***
Attention: Secret API keys saved to /Users/username/.config/twitter-video
Ready to Send!

Now you can post a tweet with a native video!

$ twitter-video -v DRQCQaiww7XlAYJP.mp4 -s 'engage'
Post created at: https://twitter.com/twittername/status/624602234223865857

Contributing

Contributions welcome! Please read the contributing guidelines first.

Changelog

See CHANGELOG.md for news and updates.

License

ISC

Keywords

FAQs

Last updated on 06 Aug 2015

Did you know?

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc