Created
December 15, 2012 11:15
-
-
Save kimihito/4293882 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#file name is title of article. | |
#!/usr/bin/env ruby | |
#-*- coding: utf-8 -*- | |
require 'tumblr_client' | |
Tumblr.configure do |config| | |
config.consumer_key = "YOUR_CONSUMER_KEY" | |
config.consumer_secret = "YOUR_CONSUMER_SECRET" | |
config.oauth_token = "YOUR_ACCESS_TOKEN" | |
config.oauth_token_secret = "YOUR_TOKEN_SECRET" | |
end | |
client = Tumblr.new | |
Dir::glob("./article/*.txt").each { |f| | |
file = open(f) | |
title = File.basename(f,".txt") | |
content = "" | |
File.foreach(file) do |article| | |
content << article | |
end | |
client.text("kimihito.tumblr.com", :state => "published", :title => title, :body => content) | |
} | |
puts "Posted!!" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
#-*- coding: utf-8 -*- | |
require 'tumblr_client' | |
Tumblr.configure do |config| | |
config.consumer_key = "YOUR_CONSUMER_KEY" | |
config.consumer_secret = "YOUR_CONSUMER_SECRET" | |
config.oauth_token = "YOUR_ACCESS_TOKEN" | |
config.oauth_token_secret = "YOUR_TOKEN_SECRET" | |
end | |
client = Tumblr.new | |
client.text("kimihito.tumblr.com", :state => "published", :title => "hoge", :body => "foo") | |
puts "Posted!!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment