How to batch rename Tumblr tags?

unor picture unor · Nov 10, 2012 · Viewed 21.1k times · Source

I have tagged over 700 blog posts with tags containing hyphens, and these tags suddenly stopped working in 2011, because Tumblr decided (without any notice) to forbid hyphens in tags (I guess hyphens are blocked now, because spaces in tags (which are allowed) get changed to hyphens.). Unfortunately, Tumblr is not willing to globally rename all tags containg hyphens (although these tags are of no use anymore → 404).

Now I want to rename my tags myself.

I tried to do it with the "Mass Post Editor" (tumblr.com/mega-editor), but it's not possible to select posts by tag. I'd have to manually select post after post and look if a certain tag was used, and if so, delete it and add a new one instead. This would be a huge job (700 tagged posts, but more than 1000 in total).

So I thought that the Tumblr API might help me. I'm no programmer, but I'd be willing to dig into it, if I could get some help here as a starting point.

I think I need the following process:

  1. select all posts that are tagged with x (= a tag containing hyphens)
  2. tag all these posts with y (= a tag without hyphens)
  3. delete the tag x on all these posts

I'd start this process for every affected tag manually.


I see that the method (or whatever you call it) /post knows the request parameter tag:

Limits the response to posts with the specified tag

(I guess I can only hope that this works for tags containing hyphens, too.)

After that I'd need a way to add and remove tags from that result set. /post/edit doesn't say anything about tags. Did I miss something? Isn't it possible to add/remove tags with the API?


Have you an idea how I could "easily" rename my tags?

Is it possible with the API? Could you give me a starting point, tip etc. how I could manage to do it?


I don't know if this might be helpful, but I noticed that the search function is still able to find posts "tagged" with tags that contain hyphens.

Example: let's say I have the tag foo-bar. It is linked with /tagged/foo-bar (→ 404). I can find the posts with /search/foo-bar (but this is of course not ideal because it might also find posts that contain (in the body text) words similar/equal to the tag name).

I tried to encode the hyphen (/tagged/foo%2Dbar), but no luck.

Answer

alex baldwin picture alex baldwin · Oct 25, 2013

just for the record, because this is a popular google search: i've done it! you can use it at http://dev.goose.im/tags/.

i used a combo of PHP and jquery, basing my jquery off of a previous tumblr api script i wrote a year or two ago, and used this tumblr php oauth script for the authentication. if anyone wants me to put up the source code, i'd be happy to.