How to restore a deleted Twitter video using your Firefox cache

Caveats: You must have used your computer to view the Twitter video, not a phone or tablet! I used the process below on Windows, but similar approaches will apply on Mac and Linux and to Google Chrome.

Earlier today someone I follow on Twitter posted a video which they subsequently deleted. I liked the video and wanted to share it, but it was gone!

Of course, browsers cache most web page assets they load and so I figured I would have a local copy of it somewhere, I just needed to work out where, and how to get it into a readable format. The steps are:

  1. Find cache folder
  2. Download cache browser
  3. Find video ID
  4. Extract video segment files from cache
  5. Stitch files back together

Firefox stores its cache in a binary format of its own making, so we can’t just go and look at the cache folder and see what’s in it, like we could years ago, but you will need to find your cache folder. Mine was at


The next thing to do is go and grab a copy of MZCacheView. This is the awesome app which will let you search for, and extract, files from your Firefox cache. When you open it, it will auto-detect your Firefox profile and list all the files it finds in the cache

Each video on Twitter is split into multiple segments (using the .m4s extension) using the ID of the video, not of the tweet, so we need to get the video ID next – the easiest way to do that is to use the cache filter in MZCacheView to limit the domain to and use the Quick Filter to search for ext_tw_video_thumb. After enabling the preview pane (press F8), you’ll have to go through each one by hand, but once you’ve got the right thumbnail, the ID in the URL of the video thumbnail (a ~19-digit number) is what you now want to put into the quick filter.

You should now have a list of about a dozen files, each of which has the video ID somewhere in the URL column. Two of these will be your image thumbnail, three will be playlists that tell you which video files you want (and in which order you’ll need to stitch them together) and the remainder are the video files. Find the playlist which uses the highest resolution in its URLs to video segments (e.g. /pu/vid/0/0/720x1280/) and note the mp4 and m4s files it links to, and the order they are listed in.

Now use that list of filenames to identify the files in your search list, CTRL+click them and then right-click and select “Copy Selected Cache Files To…” and choose an output directory.

Then you just need to cat the files together. e.g.

cat file-1.mp4 >> saved-video.mp4
cat file-2.m4s >> saved-video.mp4
cat file-3.m4s >> saved-video.mp4

Now you should be able to play saved-video.mp4 and do whatever you like with it!

Keeping up with the lizards

It used to be the case that I pored over Mozilla (and later Firefox) release notes. But I stopped sometime in 2004, around the point when I accepted that XUL development was too hard to be doing in my spare time and yes, Firefox was clearly better than IE at just about everything.

This means that I now miss all the cool announcements

Firefox location bar doesn’t work under Ubuntu

Some of the shortcut keys for Firefox on Ubuntu are different to those on Windows. The most pertinent one for me is that the <backspace> key as a shortcut for clicking the “Back” button has been disabled. This is easily fixed in about:config by changing the value of browser.backspace_action to 0.

The most annoying however is the one which appears to have no fix, and for which I haven’t yet found a Bugzilla or Launchpad entry. In fact I’m not even sure which one it belongs to.

CTRL+SHIFT+arrow doesn’t select chunks of text in the Firefox location bar. It just selects all of it. I’m very used to chopping and changing URLs by hitting ALT+D followed by some keyboard selection goodness. No more apparently. Want to take off the “/blog” from a URL? That’s ALT+D and backspace five times. Hope you can count really quickly because sometimes my fingers move much faster than the location bar updates.