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

C:\Users\<username>\AppData\Local\Mozilla\Firefox\Profiles\<profile-id>.default-release\cache2

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 twimg.com 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!

Beautiful world history

Twitter is mostly a cesspit of wailing and existential despair and so I avoid it, but the one beacon of light which does call me back in on a regular basis is Ticia Verveer’s account.

Ticia is an archaeologist who regularly posts photos and articles of incredible discoveries from around the world, from a display of noses once used to “repair” Roman and Greek marble statues in the 19th century to Iron Age mudbricks with 3,000 year old finger impressions.

There’s a constant stream of something to learn and wonder at, and isn’t that what we really want from the internet?

I have forked Charbot Green

About a year ago Libby Miller wrote Charbot Green, a BBC Radio 4 announcement bot for Twitter. It’s written in JRuby, uses the H2 database and the source code is in SVN here.

A screenshot of CharbotGreen on Twitter

It’s a really great app and I thought I’d have a play, but half-way through the install I realised that setting up an H2 DB server was a step too far, so instead I rewrote it to be a pure Ruby app using the SQLite3 database. Using SQLite3 keeps it a self-contained app in a single directory without the need to run a database server.

You can get the code from GitHub here.

My small changelist looks like this:

  • H2 replaced by SQLite3
  • links to iPlayer use the short form of the URL
  • if available, the subtitle, such as episode number is displayed
  • now a pure ruby app!

I haven’t tested it very hard, just run it up a couple of times, so please do let me know of bugs or feel free to go fork it yourself!

Twitter on Ubuntu – use Gwibber

Screenshot of Gwibber
Screenshot of Gwibber

Gwibber is a native desktop Twitter client for Ubuntu. It will post updates to and receive updates from Twitter as well as a host of other services like Flickr, Facebook, Digg, can update your Pidgin status and pull in any other RSS or Atom feed you like.

It will sit in your notification area waiting until you get some messages which it will display as pop-ups in the corner of your screen, and won’t steal focus whilst it does so (take that, twitterfox!).

It is unobtrusive, attractive and easy to use. Theme templates are just HTML and CSS. I recommend giving it a go.

In Jaunty Jackalope it is in the Universe repositories (so sudo apt-get install gwibber will work) but for everyone else you can either follow the instructions on this page (which means you will get future updates) or go direct to the Gwibber PPA page, expand the section with your distro listed and grab the .deb file.

A fork in the twitter?

There is some current hullabaloo over twitter’s most recent hires.

I agree with the commenters on that post. Shutting down productivity tools with two weeks’ notice is an big, big problem.

Worse for me is the implication that Twitter are content for this to happen and content to hire people who do this (the commenters have also picked up on this).

The only salvageable situation would seem to either keep the services running or as Justin Mason suggests, open sourcing them.

I think this is the Twitter exit warning for me.

Post to Twitter from Ubuntu Deskbar

Deskbar is a Gnome widget you can embed in a panel and can be used for opening applications, opening items from your browser history, doing web searches and all sorts. It’s not as good as Quicksilver but better than Launchy. It fires when you hit a key combo (mine is CTRL+SPACE) and looks a bit like this:

Screenshot of Deskbar on Ubuntu

For the soulless, Twitter is length limited asynchronous multicast IM, for everyone else, it’s a nice way to keep up to date with what your friends are doing using the web, IM or SMS. My rarely-posted to Twitter page is here.

Lucky for me, Deskbar is easily extendable , and so that’s just what I’ve done. I looked at the Twitter Wiki, found a Python Twitter library downloaded their little icon thing and written a sript to let you post to Twitter from your Deskbar. It looks like this:

Screenshot of Deskbar with Twitter plugin installed

To install:

  1. Install python-twitter
  2. Grab deskbar-twitter.py and twitter.png and put them in ~/.gnome2/deskbar-applet/handlers/
  3. Open your downloaded deskbar-twitter.py in an editor
  4. Replace TWITTER_USERNAME and TWITTER_PASSWORD with your Twitter details
  5. Replace YOUR_USERNAME with your Ubuntu username

It took longer to write this blog post than the code, so patches welcome.