2010-03-21
Twitterのfollowerをlistに追加するワンライナー
140文字以内に収まるように頑張った結果
perl -MNet::Twitter -e'$t->add_list_member(sugyan,listname,$_)for@{($t=new Net::Twitter traits,[API::Lists,Legacy],netrc,1)->followers_ids}'
add_list_member に渡す引数(上記では sugyan, listname)はハードコード、
指定する名前のlistは作ってあって、.netrcファイルにusernameとpasswordが書いてあるという前提。
machine api.twitter.com login sugyan password ********
あと全然知らなかったのだけど、1つのlistに登録できるのは500ユーザまでらしい。
Page not found | Twitter Developers
ので、followersが500を超えている場合は"followers/ids"でとれるidの最初の500件までしか登録されない。たぶん。
"followers_ids"は5000件くらいまでは一発で取れるようなのでshuffleすれば毎回違うメンバーでlist作れるかも
perl -MList::Util=shuffle -MNet::Twitter -e'$t->add_list_member(sugyan,followingme,$_)for shuffle@{($t=new Net::Twitter traits,[API::Lists,Legacy],netrc,1)->followers_ids}'
トラックバック - http://d.hatena.ne.jp/sugyan/20100321/1269108392
リンク元
- 142 http://pipes.yahoo.com/pipes/pipe.info?_id=tDfBdGWF3RGl9XNm1L3fcQ
- 37 http://pipes.yahoo.com/pipes/pipe.info?_id=f1ae63990f6d5b9e48ce807a77bb9995
- 13 http://b.hatena.ne.jp/
- 10 http://twitter.com/
- 7 http://b.hatena.ne.jp/entrylist/it
- 7 http://pipes.yahoo.com/pipes/pipe.info?_id=12e453e301454b799b3ac6642aa089b5
- 6 http://pipes.yahoo.com/pipes/pipe.info?_id=49361476efd1fe9761d9bbd6c3a05f4d
- 5 http://b.hatena.ne.jp/entrylist
- 4 http://wiki.15cc.net/index.php?Twitter Botの作り方まとめ
- 3 http://hootsuite.com/dashboard
