Puffbox’s Project MyTube: hooray for APIs

A few days ago, I bought an iPod Touch; and I can finally understand the fuss. I didn’t really want it; I’m not short of portable media players, and my Android phone gave me a perfectly good touchscreen to play with. But I’m very excited about mobile-optimised web interfaces at the moment, and felt I needed an iPod/iPhone to do some proper testing (as opposed to educated guesswork).

I’ve been especially blown away by the quality of videos streamed from YouTube. For example, I’m a big ice hockey fan – and the NHL (the big league in North America) is kind enough to put full highlights of every game on YouTube. But as you can probably guess, a flying puck isn’t easy to see in a heavily pixellated non-HD video stream. It’s a completely different story on the iPod Touch – crystal clear.

But – unless I’ve missed it? – there’s no easy way in the built-in YouTube applications, either on the iPod or Android, to log into your YouTube account and see your various ‘subscriptions’. On the face of it, it’s an extraordinary omission. Subscriptions are effectively your personalised EPG, allowing you to cut through the chaos, and get to the content you want. Isn’t that exactly what you want/need? So I did it myself.

If you go to mytube.puffbox.co.uk, you’ll see an intro page with a dropdown list of various YouTube channels: these are being called in dynamically via Javascript, from the puffboxtv account on YouTube, courtesy of Google’s astonishingly comprehensive API. (I got the list of HMG YouTube channels from Steph’s digitalgovuk catalogueding!) When you choose a channel from the dropdown, it makes a further API call, drawing a list of the last 10 videos posted to that account, with upload dates and thumbnails. Click on a title, and you’ll see the clip description, plus an embedded player. On a normal browser, the clip will play on the page; on an iPhone/iPod or Android unit, it’ll play in the native YouTube app, full-screen. The ‘back’ button in the top left corner (not the browser back button!) returns you to the list of videos.

That’s pretty cool… but here’s the really clever bit. If you have made your YouTube subscriptions publicly visible, you can call your own favourite channels into the dropdown – go to http://mytube.puffbox.co.uk/?account=yourname and you should see a familiar list. I should stress, my site never holds any personal information: it’s all coming in dynamically from YouTube.

As with most of my experimental stuff, it comes with zero guarantees. There are rough edges, and it could be a little prettier. But here’s the important point: I knocked this together in 24 hours*, thanks principally to (a) Google’s wonderful API and (b) the free JQuery javascript library to process the responses.

Coincidentally, as I was putting the finishing touches to the site, I came across Charles Arthur’s piece in today’s Guardian about the Home Office crime mapping problems – which concluded thus:

The Free Our Data campaign thinks the practices outlined in the memo do not go far enough: what external developers especially are looking for is pure data feeds of events, rather than static maps… Ironically, the police’s efforts to meet the deadlines might be better aimed at producing those data feeds with time, location and crime form data which could then be used by external developers – who would be able to produce maps more quickly than in-house efforts.

I couldn’t agree more – and I hope my efforts over the last 24 hours prove the point. I’m amazed by how easy (relatively speaking) such things are becoming. The common thread across all the really successful web 2.0 properties is the availability of an API, allowing developers to work their own unique magic. As I’ve said before… Government needs to recognise this, and get in the API game. Not just as a ‘nice to have’, but as an absolute priority.

* 24 hours? Well, put it this way. It was working perfectly in Firefox, Safari (desktop and mobile), Chrome, Android… but not IE. It’s taken me the best part of a day to make it work in IE, and I still can’t really understand what I’ve done differently to finally make it work. Opera’s acting really strangely, but I’ve spent long enough playing with it for now.

Two weeks with my T-Mobile G1

The release of the first ‘Googlephone’ running the open source Android couldn’t have come at a better time for me.

My Nokia E65 had served me well, but was getting a bit temperamental. I’d already handed all my email over to Google, and was keen to do likewise with my calendar needs (bye bye Outlook!). Plus, Google tends to just get it right, where Apple’s track record is a bit patchy in my experience. Of course I was going to get a Googlephone; and with my contract’s minimum period having just expired, why wait?

Let me straight away: I like it a lot. A heck of a lot. But it’s not without its faults, some of them significant.

The screen is beautiful, the interface is beautiful, the unit itself is pretty (rather than iconic). As you’d expect with Google, everything integrates neatly. When you power up for the first time, you’re asked for your Google Account details – and yes, thankfully, that includes ‘apps for your domain‘ accounts. Instantly, you’re looking at your Gmail inbox, with all the same contacts, and your Google calendar. Change something on your desktop PC, and it reflects instantly to the phone – and vice versa. That’s enough to make you love the phone itself.

The keyboard is small but usable with practice. The web experience is excellent, with the browser firing up instantly. Google Maps is as good as you’d expect, with or without GPS. Oh yeah, and it’s good at making phonecalls too. Google’s contacts app has come in for criticism, much of it justified; but its integration with Gmail gives you a headstart, importing from Outlook was easy, and courtesy of Gravatar, I’ve managed to add photos for a remarkable proportion of my contacts with zero effort.

But there are faults, some of which will resolve themselves over time. Others won’t.

  • Zoom. For me, the key to the iPhone is the multi-touch operation, which the G1 doesn’t have. So if you want to zoom in on a photo or a web page, you’re pressing zoom in/out buttons. It feels so primitive already.
  • Camera. Three megapixels is respectable, and the quality is fine. But jeez, is it slow to snap… almost unusably so. I’m seriously considering carrying a proper camera again; and that’s really not good enough.
  • Lack of homescreen widgets. If you’ve ever seen Nokia’s Widsets, you’ll recognise the horizontally scrolling desktop on the G1. Some aspects are cool: it scrolls beautifully, you can add shortcuts to individual contacts, and there’s widget functionality. But the selection of widgets is shockingly small: an analogue clock, a picture frame, a Google search box, and that’s it. No calendar view. No to-do list. No weather widget. I’m hoping this is just a temporary weakness, forgiveable since Android’s only been properly public for a matter of days. But still…
  • Lack of ‘send’ functionality. I’m amazed it doesn’t include the ability to send contacts or calendar events via SMS, Bluetooth, email or anything else. Yet.
  • Media playback. There’s a respectable ‘Music’ app, and there’s even some Flight of the Conchords in there to start you off. But if you’re hoping to stream anything other than YouTube, or playback video, you’re going to have to visit the Android Market and hope for the best. For now, you’ll be disappointed.

There’s quite a lot to play with in the Android Market: a selection of weather apps, the barcode-scanning programs are fun, there’s a fantastic Twitter app called Twidroid, and who can resist (proper) PacMan? The big names are starting to appear – among them the Telegraph and MySpace, and others will follow no doubt (including MySociety, I hear?). Again, early days.

Android is unquestionably going places, and there’s an undeniable thrill at being in at the very start, watching it all evolve. But I’d recommend steering clear of the ‘free on 18 month contract’ deals. Although there’s no mention of it in the T-Mobile publicity, my local shop sold it to me for £50 on a 12-month contract; by which time I bet better devices will be available, and no nastiness with unlocking / jailbreaking.

Onepolitics now Android and iPhone-optimised

I’ve just rebuilt my onepolitics website, which aims to bring together the latest from a personal selection of prominent political blogs into a single page. It’s the third incarnation of the site in less than a year: initially it was built in WordPress, then rebuilt in June as a more straightforward PHP/RSS-powered website. It’s had a steady trickle of people using it, measured in the dozens each day, but I’ve never pitched it as a public service: it’s always been for me primarily, but anyone else is welcome to drop by.

Version three recognises the primary use case of the key target audience (me): mostly on my mobile. And having just got my hands on a new T-Mobile G1 Googlephone, it seemed sensible to make the design work best in that context. So I’ve recoded the pages to give b-i-g touchscreen-friendly clickable areas, and applied some conditional code to select appropriate styling for the G1 and (as best I can) the iPhone. If you’re on something else, including a desktop browser, you’ll still get more or less the v2 design.

I’ve abandoned the filtering options, as it didn’t seem people were using them anyway. So now the site concentrates solely on its ‘homepage’ presentation of the latest 20 items from the political blogs considered by our editorial board (me again) to be the most prominent and influential. Updating is lightning fast, usually within a few minutes of an article’s publication, as it’s powered by feeds from Google Reader.

If anyone’s got an iPhone, could you try it out for me, and let me know how well it matches? I’ve tried to follow the Apple guidance, as far as I could be bothered anyway; and testiphone.com has been helpful (when used in conjunction with Firefox’s User Agent Switcher plugin).

PS: Quick Android tip. I’ve only seen it advertised on 18-month contracts, with no charge for the handset; but I got mine in a T-Mobile store on a 12-month contract for a £49.99 payment. I don’t know about you, but 18 months is a l-o-n-g time to be locked in.