Hey you guys: my friend Toby wrote a script that allows you to bulk erase your Tumblr should you ever desire to do so. As his astute warning below indicates, IT WILL ERASE YOUR WHOLE TUMBLR. So, you know, unless you want to do that…don’t do it.
But, anyway, I love my friends who can do freaking useful things. I had to manually delete my entire Facebook wall awhile back and it was super annoying. I can imagine others might run into a similar situation with the Tumblr, so I feel it is my duty to pass the word on. His post, plus the script below:
Let’s say you, like me, set up a Tumblr blog a long time ago and used it to post junk, or just be a mirror of whatever you posted on Twitter or something. Then, you decided you wanted to actually try using Tumblr, like for reals. You look around for a way to just nuke the whole thing, delete all the damn posts and start FRESHY FRESH.
Well, it seems this can’t be done (or it couldn’t when I went looking, maybe it has changed/will change). There is no way to do just wipe it clean and begin again. I discovered this for myself, and after much grumbling I went looking for a solution; I found a cached copy of some defunct non-Tumblr-blog with the original version of the below code. It didn’t work, so I fixed it, and here is the result.
<?php
// !!!!!!!!WARNING!!!!!!!
// RUNNING THIS FILE WITH THE APPROPRIATE CREDENTIALS WILL
// ERASE ALL YOUR POSTS FROM YOUR TUMBLR BLOG!
// Tumblr Blog Info
$tumblr_email = 'YOUR@EMAIL.COM';
$tumblr_password = 'YourPassword';
$tumblrDomain = 'blah'; // if your tumblr is blah.tumblr.com, put 'blah' here
$i = 0;
do {
$xml = simplexml_load_file("http://" . $tumblrDomain . ".tumblr.com/api/read?start=" . $i . "&num=50&rand=" . rand());
$i+= 50;
$count = count($xml->posts->post);
if ($count == 0) break;
foreach($xml->posts->post as $post) {
$postId = (string)$post[id];
echo $postId . "\n";
$request_data = http_build_query(array('email' => $tumblr_email, 'password' => $tumblr_password, 'post-id' => $postId));
// Send the POST request (with cURL)
$c = curl_init('http://www.tumblr.com/api/delete');
curl_setopt($c, CURLOPT_POST, true);
curl_setopt($c, CURLOPT_POSTFIELDS, $request_data);
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($c);
$status = curl_getinfo($c, CURLINFO_HTTP_CODE);
curl_close($c);
// Check for success
if ($status == 201) echo "Success! The new post ID is $result.\n";
else if ($status == 403) echo "Bad email or password\n";
else echo "Error: $result\n";
}
}
while ($count > 0);
?>