24時間前から現在までのTwitterの自分postをmixiに投稿する
Twitter側はこれを使います。
mixiはこれを使おうと思ったのですが、メンテナンスされていなくて古い。
http://rubyforge.org/projects/mixi/
なので修正して、githubに上げました。
http://github.com/closer/ruby-mixi/tree/master
日記を投稿する部分しか直していないので、他の機能使いたい場合は直してください。
で、以下を実行する。ユーザー名とパスワードは適当に入れてください。
#!/usr/bin/env ruby require "kconv" require "rubygems" require "twitter" require "mixi" username = '' password = '' httpauth = Twitter::HTTPAuth.new(username, password) twitter = Twitter::Base.new(httpauth) todays_timeline = [] twitter.user_timeline({:count => 200}).each do |line| todays_timeline.push(line.text) if DateTime.parse(line.created_at) > DateTime.now - 1 end todays_timeline.reverse! puts body = todays_timeline.join("\n") con = Mixi::Connection.new(:email => '', :password => '') con.login_user.add_diary('Twiter', body.toeuc)