Last active
February 26, 2016 05:14
-
-
Save myouju/c8f051c2030ffd04fb9d to your computer and use it in GitHub Desktop.
僕が考えた最強のCUI twitterクライアント(白目
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM dahlb/alpine-node | |
RUN npm install twitter user-stream coffee-script | |
ADD stream stream | |
ENTRYPOINT ./node_modules/coffee-script/bin/coffee stream |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
npm install twitter user-stream coffee-script
で始められるの便利