Skip to content

Instantly share code, notes, and snippets.

@myouju
Last active February 26, 2016 05:14
Show Gist options
  • Save myouju/c8f051c2030ffd04fb9d to your computer and use it in GitHub Desktop.
Save myouju/c8f051c2030ffd04fb9d to your computer and use it in GitHub Desktop.
僕が考えた最強のCUI twitterクライアント(白目
FROM dahlb/alpine-node
RUN npm install twitter user-stream coffee-script
ADD stream stream
ENTRYPOINT ./node_modules/coffee-script/bin/coffee stream
#!/usr/bin/env coffee
"use strict"
twitter = require('twitter')
keys = {
consumer_key: '',
consumer_secret: '',
access_token_key: '',
access_token_secret: ''
}
p = new twitter keys
tweet = process.argv[2]
p.post 'statuses/update', {status: tweet}, (data) ->
if not data
return
console.log(data)
#!/usr/bin/env coffee
"use strict"
stream = require 'user-stream'
keys = {
consumer_key: '',
consumer_secret: '',
access_token_key: '',
access_token_secret: ''
}
s = new stream keys
s.stream()
s.on 'data', (json) ->
try
if 'event' of json
if json['event'] == 'favorite'
console.log "fav. #{json['source']['name']} @#{json['source']['screen_name']}\n#{json['target_object']['text']}\n"
else
console.log json
else
console.log "#{json['user']['name']} @#{json['user']['screen_name']}\n#{json['text']}\n"
catch err
console.log err
console.log json
@myouju
Copy link
Author

myouju commented Feb 25, 2016

npm install twitter user-stream coffee-scriptで始められるの便利

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment