Twitter4Rv0.3.0 The Ultimate Open Source Ruby Library for the Twitter REST API
前置き 前回の記事でOAuthを使ってTwitter APIにアクセスすることができるようになりましたが、ruby-oauthは内部でNet::HTTPを呼び出しているため、そのままではGoogle App Engine for Java上のJRuby(以下JRuby for GAE/J)で利用できません。 「JRuby for GAE/JでもNet::HTTPが使えるようになる」というrb-gae-supportと組み合わせればOKなのかもしれませんが*1、OAuthの仕様自体はシンプルなものですし、せっかくなので勉強がてら自分で実装してみることにします。 車輪の再発明おいしいです!*2 ちなみにタイトルにRuby編と付いていますが、他の言語編を作成する予定は特にありません。 OAuthの仕様 実装の前にOAuthの仕様や、そもそもの成り立ちについて調べました。既にわかりやすいまとめ記事
最近プラグインを作ったりしてTermtterが便利になってきたので,ご紹介です. Gemにはまだ入っていません 最近作ったプラグインなので,gem termtterには,まだ入っていません.GithubのTermtterをcloneしてbin/termtterを使うと,今回紹介するプラグインが使えます. https://github.com/jugyo/termtter UserStream受信する Termtterはデフォルトでは定期的にタイムラインを取得しに行くが,user_streamプラグインを利用すると,UserStreamを受信できます. favoriteされた,followされた,statusをdeleteした,listに追加されたり外されたりした,といったイベントも流れてきて便利です. Termtterはデフォルトでは定期的にタイムラインを取得しに行くので,1分くらいは何か
UserStreamを受信するときに,毎回Net::HTTPがどうとか書いていて,めんどうだったので,UserStreamを受信するgemを作った. 1行ずつ受信したJSON(のテキスト)をくれるから,使いたいように使える. UserStreamReceiver.new.run{|chunk| p JSON.parse(chunk) } 内部的には,id:tilyさんのOAuth::CLI::Twitterを使ってAccessTokenを取得していて,最初に起動したときに,対話的にPINを入れるように言ってきたりする. 既存のtwitterクライアントから使いたい場合とかは,コンストラクタにAccessTokenを指定して使うこともできる. bin/以下に2つコマンドが入ってる. user-stream-receiver 受信したJSONを表示する. user-stream-receive
via. collecting data from streaming APIs in twitter – The Storyteller まだα版とのことですが、いつの間にかStreaming APIなんてものが出てたんだ。。。 http://apiwiki.twitter.com/Streaming-API-Documentation すでにPHPを使ったコードも出てますが、fopenとfgetsでストリームをハンドリングできるので比較的簡単に実装できますね。ちなみに、Twitter Streaming APIから日本語のつぶやきをPHPで取得する | 最近わかってきたことにあるコードが判りやすいです。以下、引用。パブリックタイムラインのうち、ひらがなもしくはカタカナが含まれているものを出力するコードだそうです。 <?php $user = 'username'; $password
Streaming APIとは TwitterのStreaming APIをご存知でしょうか。 Twitter API Wiki / Streaming API Documentation 2009年4月頃から試験的に公開されているAPIなので、ご存知な方も多いと思います。2009年8月現在でまだαテスト中ですが、これを利用すると、push型でリアルタイムに情報を受け取ることができます。 TwitterのAPIは基本的にpull型なので、クライアントが能動的にリクエストを発行しなければ情報を受け取ることができません。しかし、1時間あたりのリクエスト回数、1リクエストあたりの最大データ数など、APIには様々な制限がかけられていますので、例えばリアルタイム性の必要なプログラムや、大量のtweetsが必要な統計プログラムなどの用途で通常のAPIを利用するのは厳しいものがあります。 そのような時は
クロスドメインでのデジタルアイデンティティを守る APIアクセス権を委譲するプロトコル、 OAuthを知る 作島 立樹 NRIパシフィック 2008/1/21 マッシュアップと呼ばれる仕組みで、既存のWebサービスが次々とつながり、新たなサービスが登場している。しかし、メールアドレスなど重要な個人情報が意図せずに「つながれてしまう」可能性もある。そこで登場したのがアクセス権の「委譲」を目的としたプロトコル、OAuthである。本記事ではOAuthの仕組みとともに、なぜそれが登場したのかという背景にも触れる(編集部) マッシュアップの犠牲になるユーザーのアイデンティティ GETなどのHTTPメソッドをもちいてURLへリクエストする、いわゆる「RESTful」【注1】なWeb APIを使ったアプリケーション同士の交流は、いままさに隆盛を極めている。「マッシュアップ」と呼ばれているこのサービス形態
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く