This is a collection of utilities ("commands") to mass edit posts on a Tumblr blog.
There are currently three commands that are supported:
ClearLikes
: Unlikes all previously liked posts.PrivatizePosts
: Turns all published posts private.UpdateCommunityLabels
: Updates the community labels on all published posts.
Each command allows for an optional tag & start date to filter on which published posts are being updated.
- Run
bundle install
to install the gems! - Copy
config/application_config.sample.rb
toconfig/application_config.rb
. - Add your Tumblr API keys & Tumblr OAuth tokens to that configuration file.
- If you have more than 1k posts that you want to make private, you'll need to have "backup" API keys & OAuth tokens by adding more than one set of credentials to the config. I recommend having at least one set of key per every ~950 posts or so.
⚠️ Please take caution when doing this! This may be against Tumblr's terms of service.
- If you have more than 1k posts that you want to make private, you'll need to have "backup" API keys & OAuth tokens by adding more than one set of credentials to the config. I recommend having at least one set of key per every ~950 posts or so.
- Change the
tumblr_blog_url
in the configuration file to your blog URL.
To run the ClearLikes command, use the ClearLikes
argument:
- Run
ruby script.rb ClearLikes
ruby script.rb ClearLikes --help
will list all of the available options.
To run the PrivatizePosts command, use the PrivatizePosts
argument:
- Run
ruby script.rb PrivatizePosts --state_date=YYYY-MM-DD
ruby script.rb PrivatizePosts --help
will list all of the available options.
Note: This is currently not supported by non-official API clients. Keep an eye on Tumblr's public API documentation for when this is supported.
To run the UpdateCommunityLabels command, use the UpdateCommunityLabels
argument:
- Run
ruby script.rb UpdateCommunityLabels --community_labels=sexual_themes,violence,drug_use
ruby script.rb UpdateCommunityLabels --help
will list all of the available options.
If you'd like to contribute, you'll probably want to get Sorbet up and running by either...:
- Use VSCode and install
watchman
(brew install watchman
on macOS) & the Sorbet extension - Add a pre-commit hook that runs
srb tc
If you'd like to add a new utility, please...:
- Add a new command in
lib/command
with the following structure:
# typed: strict
class Command::NewCommand < Command
extend T::Sig
sig {params(options: Options, config: Config, client: TumblrClient).void}
def call(options, config, client)
Base::IterateThroughPosts.call(options, config, client) do |post|
puts "Updating post #{post.id} (#{post.post_url})" if options.verbose
# do something
end
end
end
- Add the command to the
Command::Command
enum inlib/lib/command.rb
:
class Command < T::Enum
enums do
PrivatizePosts = new
UpdateCommunityLabels = new
+ NewCommand = new
end
end
- Add the new file to
lib/tumblr_utilties.rb
to ensure it's loaded:
# note, order matters!
require_relative('command/new_command.rb')
- Add the new command call to the entry
script.rb
file:
when Command::Command::NewCommand
Command::NewCommand.call(options, config, client)
- And then you can call it via:
ruby script.rb NewCommand
File an issue! I'm more than happy to assist where I can. :)