Raise the fooBar Rotating Header Image

javascript

How to delete entire twitter conversations (direct messages)?

I recently wanted to delete a massive twitter conversation with thousands of messages. To my surprise, there’s no way to delete a whole conversation with a single click in the Twitter.com Web GUI. The Twitter MacOS App has a “Delete Conversation” entry in a conversation’s context menu, but that just removes it from the Gui. Restarting the app shows that it is, in fact, still present.

My guess is that their Message storage doesn’t allow efficient deletion of conversations. But what if I _really_ want to get rid of them?

An option is to search for these services… you know… those shady ones that claim they can do the job for you, want access to your twitter account and, after you have granted them full access, ask you to take out your wallet and pay if you _really_ want them to help you. Well, F such a business model. Seriously.

There’s an easier, much safer way to delete entire conversations and guess what: I’ll tell it to you for free!

Okay, here’s what you do:

  1. Open Chrome (we’ll need the developer console. Other browsers might work, too, but I use Chrome, so I’m gonna stick with it here)
  2. Log in to twitter and go to your “Me” page
    https://twitter.com/<yournick>
  3. Open your messages (the button with the envelope) and select the conversation you want to delete. You now have the conversation-to-be-deleted in front of you.
  4. Open the JavaScript Developer console (Command+Alt+J on Chrome / MacOS)
  5. Paste the following JavaScript into the console and press enter:
    $('#global-actions').append($('<li id="del-script">').append($('<a class="js-nav">"').text('...')));
    window.delscrpt = setInterval(function() {
      $('.js-dm-error:visible').each(function() { $('a.js-dismiss', this).click(); });
      var count = $('.js-dm-delete').length;
      if (count < 3) {
        $('#del-script a').text('Del Done.');
        clearInterval(window.delscrpt);
        return;
      }
      var randIdx = Math.floor((Math.random()*count)+1);
      $('#del-script a').text('Del ' + randIdx + '/' + count);
      $('.js-dm-delete').eq(randIdx).click();
      $('.dm-delete-confirm .js-prompt-ok').each(function() { $(this).click(); });
    }, 2000);
  6. Sit back, relax and watch your conversation disappear one message at a time.

DISCLAIMER:

  • Don’t expect any support. Use at your own risk. I think this should be pretty obvious 😉
  • This method works by directly manipulating the HTML DOM of the twitter page (remote controlling the GUI if you will). It works for now (mid-September 2013), but if twitter changes their homepage, this method will die. Keep that in mind.
  • The deletion might take some time. We don’t want to hammer the twitter servers and get our account blocked after all 😉
  • Twitter has some major issues with message deletion (internal server error’s and stuff). That’s why we can’t delete messages in order and have to delete them randomly until the conversation is empty. You can’t just delete parts of a conversation. You’ve been warned.
  • The script will stop when less than 3 messages are left in the conversation, in order not to bug out. You’ll have to spend the 10 seconds and delete these last messages manually.
  • The script displays some numbers in the twitter navigation bar (in the background). The first number is the index of the randomly selected message that’s being deleted from within the returned message list. The second is the total number of messages currently returned by the twitter servers. This total number doesn’t represent the “real” number of left-over messages all the time. That’s just because of the way twitter works and spits out your messages… Non-deterministic NoSQL and stuff…

Hope it’s useful to anyone 🙂

The Dark Age Of JavaScript – is it over?

Today, I extended my jsAnimation stuff (mentioned earlier) to be able to interact with ajax calls. The result looks great and the whole thing feels really powerful from a development point of view (check it out by clicking “Recently dugg” on the right side of my blog).

The evolution of JavaScript has been quite strange… Back in the days when it appeared, it has been massively abused. Every morron scripted the hell out of his site to have snow falling all over the page, some animal jumping around the cursor or a window poping up every thirty seconds asking if you like the site. All that stuff was miserably coded and was just annoying.

Due to this abuse, JavaScript lost a lot of it’s credibility for professional use. At one point, even the simplest use of JavaScript immediately led to comments like “OMG, youre using javascript? You kiddie, go hide your unprofessional website!!”. By that time, the developpers were focusing on dynamic html-generating languages like PHP, JSP, ASP etc. JavaScript’s dishonored situation lasted quite a long time as I remember and has only changed when this frigging XMLHttp object appeared a few years ago.

Yeh, the Ajax boom led to a JavaScript resurrection. As you surf the web today, you see JavaScript everywhere again, even without noticing it. Since in the meantime web animation technologies like flash, silverlight etc. appeared, it isn’t surprising to see moving parts on a website anymore, and so JavaScript crept back into the game again. Still, it takes some skills to write well-working and nice-looking JavaScript but people seem to be more competent now and browsers, on their part, became more standardized as well.

It seems like the dark age for JavaScript is over now… let’s just hope history won’t repeat itself.