Twitter Streaming APIのstatuses/filterを試す


なんとなくTwitterStreamingAPIを試してたのでメモ

キーワードでレスポンスを絞り込む

trakingというファイルを用意して、以下を入力
キーワードは400まで指定できるみたいだけど、ヒット件数が多くなると取りこぼしも多くなるんだと思う。

track=basketball,football,baseball,footy,soccer

以下で実行

curl -d @tracking https://stream.twitter.com/1/statuses/filter.json -uAnyTwitterUser:Password 

場所でレスポンスを絞り込む

locationsというファイルを用意して、日本ら辺を指定
なお絞り込みに使用されるのは、プロフィールに瀬底している位置情報でなく、tweet自体の位置情報。

locations=122.87,24.84,153.01,46.80

以下で実行

curl -d @locations https://stream.twitter.com/1/statuses/filter.json -uAnyTwitterUser:Password 

ユーザーでレスポンスを絞り込む

followingというファイルを用意してidを指定
ユーザーidはは以下のURLで返されるxmlでわかる
https://twitter.com/users/show/#{ユーザー名}.xml
5000ユーザーまで指定できる

follow=12,13,15,16,20,87

以下で実行

curl -d @following https://stream.twitter.com/1/statuses/filter.json -uAnyTwitterUser:Password