twitteR サンプル †twitteRとは †Rベースののtwitterクライアント インストールと読み込み †> install.packages("twitteR")
> library("twitteR")
以下、自分以外のIDは伏せてます。 認証がいらないAPI †
> head( publicTimeline() ) [[1]] [1] "xxxx: @xxxx u jealous or something?" [[2]] [1] "xxxx: @xxxx なにこのあいこんかわえええええ!" [[3]] [1] "xxxx: RT @xxxx: I need a boyfriend for the month! Good luck w/ that lOl" [[4]] [1] "xxxx: @xxxx, Ciro vice, o DEM dançou com o caso Arruda" [[5]] [1] "xxxx: @xxxx how much does it cost to watch?" [[6]] [1] "xxxx: @xxxx Cuuuuute!"
> head( userTimeline("yokkuns") )
[[1]]
[1] "yokkuns: おぉ、これは便利。もうbot作れてしまうな"
[[2]]
[1] "yokkuns: あ、ちゃんとマニュアルあった"
[[3]]
[1] "yokkuns: statusはどうやって取るんだろう"
[[4]]
[1] "yokkuns: 出来た"
[[5]]
[1] "yokkuns: テスト"
[[6]]
[1] "yokkuns: sess <- initSession('myUser', 'myPass') ns <- updateStatus('this is my new status message', sess)"
認証が必要なAPI †
> yokkuns <- initSession("yokkuns","********")
> head( friendsTimeline(yokkuns) ) [[1]] [1] "xxxxxx: 二日酔いけてーいwあぁかえりてぇ" [[2]] [1] "xxxxxx: 自分と大して身長の変わらない少年がランドセルしょってた。ウケる。" [[3]] [1] "xxxxxx: ワンストップ・サービスって取り組みは評価する。普及するには難しいけど。そうなればこの公共人生相談所はハローライフとかに改名して生活再建を謳うのが良い。もはや仕事を斡旋してどうこうなるレベルではないような気がするんだ。" [[4]] [1] "xxxxxx: ポッポは、年収と月収の違いは理解できてるのかなぁ?年だよぉ。 QT @xxxxxx 子ども手当、年収2000万円上限 政府調整、与党に引き下げ案 NIKKEI NET http://bit.ly/7a8A6T" [[5]] [1] "xxxxxx: おはようございます。今日はメトロ遅延していないようで安心しました。" [[6]] [1] "xxxxxx: 寒い。寒すぎる。"
> head( mentions(yokkuns) ) [[1]] [1] "xxxxx: @yokkuns \"R\"に反応。" [[2]] [1] "xxxxx: @yokkuns おはっす!寒いですねーー!" [[3]] [1] "xxxxx: @yokkuns コーヒー 60円了解しました。先月の食費は、3980円、今月は今日までに760円です。" [[4]] [1] "xxxxx: @yokkuns だめ!!!!" [[5]] [1] "xxxxx: @yokkuns 歌詞探してねw" [[6]] [1] "xxxxx: @yokkuns 特急料金を…(ry 歌詞がない…。" statusクラス †返ってくる結果は、statusクラスのオブジェクトのリストになっていて、statusクラスは以下のようなメソッドが用意されている。
|