Created
March 18, 2013 14:40
-
-
Save anonymous/5187613 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# !!!!! まだ動きません!!!!! Fastladder 側で改修が必要 !!!!! | |
require 'user-stream-receiver' | |
require 'json' | |
require 'rest_client' | |
UserStreamReceiver.new.run{|chunk| | |
begin | |
chunk = JSON.parse(chunk) | |
next unless chunk['text'] | |
hash = { | |
feedlink: "https://twitter.com/#{chunk['user']['screen_name']}", | |
link: "https://twitter.com/#{chunk['user']['screen_name']}/status/#{chunk['id']}", | |
title: "Twitter #{chunk['user']['screen_name']}", | |
body: chunk['text'], | |
author: chunk['user']['screen_name'], | |
category: 'Twitter', | |
published_date: chunk['created_at'] | |
} | |
p hash | |
RestClient.post 'http://fastladder.dev/rpc/update_feed', json: hash.to_json, api_key: '7fe6b9092d8f9c1feedcc06829ed9db2' #API KEY 自分のにして | |
rescue | |
p 'error' | |
end | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fastladder 側に必要な改修
RPC 側で通常の Feed の購読の仕組みをガッツリ使ってしまっているので、フィードじゃないものをガンガン送りつけるとかできない。
なので feedlink 以外に feeddescription とか feedtitle とか feedtitle とかが入ってる形でコールされたら Feed の購読のフロー通さず直接データベースに放りこむみたいにする。
これが出来ると嬉しいこと
以上。