attr_accessor :summary, :alternate
attr_accessor :send_tb
attr_accessor :trackback_url_array
+ attr_accessor :edit_uri
def initialize(conf, title, category = nil, content = "")
@conf = conf
@title = title
end
def get_entry_info(edit_uri)
+ @edit_uri = edit_uri
entry_info = Command.new.get(edit_uri, @conf.username, @conf.password)
entry_info.doc.elements.each('entry/title') do |e|
if $DEBUG
--- /dev/null
+def tag(tag_str)
+ "<!-- #{tag_str} -->"
+end
+
+def tag_post(tag_str)
+ case @conf.service
+ when 'livedoor'
+ require 'rubygems'
+ require 'mechanize'
+
+ blog_id = @conf.blog_id
+ entry_id = @entry.edit_uri.split("=").last
+
+ login_uri = "http://member.livedoor.com/login/"
+ edit_uri = "http://cms.blog.livedoor.com/cms/article/edit?blog_id=#{blog_id}&id=#{entry_id}"
+
+ agent = WWW::Mechanize.new
+ page = agent.get(login_uri)
+ login_form = page.forms.with.name('loginForm').first
+
+ login_form['livedoor_id'] = @conf.username
+ login_form['password'] = @conf.password
+ login_form.submit
+
+ page = agent.get(edit_uri)
+ edit_form = page.forms.with.name('ArticleForm').first
+ puts edit_form
+ edit_form['tag'] = tag_str
+ edit_form.submit(edit_form.buttons.with.name('.save').first)
+ else
+ end
+end