Fragments: Accessing YouTube Account Data in Google Spreadsheets via OAuth

If you’re running a Youtube account, how might you collect Insights data for all your videos as spreadsheet entries that can be used in the preparation of reports about your social media effectiveness?

One way might be to go to each video in turn and download the separate CSV data files created for each video. Alternatively, you can grab the data via the YouTube/GData API (

I haven’t actually got round to getting any data out of my YouTube account and into a Google spreadsheet yet, but I have dome the first step, which is to set up the authentication using OAuth. Here’s the Google Apps script I used…

function youtube(){
  // Setup OAuthServiceConfig
  var oAuthConfig = UrlFetchApp.addOAuthService("youtube");

  // Setup optional parameters to point request at OAuthConfigService.  The "twitter"
  // value matches the argument to "addOAuthService" above.
  var options =
      "oAuthServiceName" : "youtube",
      "oAuthUseToken" : "always"

  var result = UrlFetchApp.fetch("", options);
  var o  = Utilities.jsonParse(result.getContentText());

[Gist here:]

The first time you run the script, it should request access from your YouTube account…

The next step is to work out what to pull from Youtube, and how to actually store it in the spreadsheet…

PS a couple more Youtube snippets of interest:
YouTube documentation wizard: customise your YouTube API documentation view
interactive YouTube API explorer

Playing With R/ggplot2 Online (err, I think..?!)

Trying to get my head round what to talk about in another couple of presentations – an online viz tools presentation for the JISC activity data synthesis project tomorrow, and an OU workshop around the iChart eSTeEM project – I rediscovered an app that I’d completely forgotten about: an online R server that supports the plotting of charts using the ggplot library (err, I think?!):

Example of how to use

By the by, I have started trying to get my head round R using RStudio, but the online ggplot2 environment masks the stats commands and just focusses on helping you create quick charts. I randomly uploaded one of my F1 timing data files from the British Grand Prix, had a random click around, and in 8(?) clicks – from uploading the file, to rendering the chart – I’d managed to create this:

ggplot - British Grand Prix

What it shows is a scatterplot for each car showing the time on the current leader lap that the leader is ahead. When the plotted points drop from 100 or so seconds behind to just a few seconds behind, that car has been lapped.

What this chart shows (which I stumbled across just by playing with the environment) is a birds-eye view over the whole of the race, from each driver’s point of view. One thing I don’t make much use of is the colour dimension – or the size of each plotted point – but if tweak the input file to include the number of laps a car is behind the leader, their race position, the number of pitstops they’ve had, or their current tyre selection, I could easily view a couple more of these dimensions.

Where there’s a jump in the plotted points for a lap or two, if the step/break goes above the trend line (the gap to leader increases by 20s or so), the leader has lapped before the car. If the jump goes below the trend line (the gap to the leader has decreased), the leader has pitted before the car in question.

But that’s not really the point; what is the point is that here is a solution (and I think mirroring options are a possibility) for hosting within an institution an interactive chart generator. I also wonder to what extent it would be possible to extend the environment to detect single sign on credentials and allow a student to access a set of files related to a particular course, for example? Alternatively, it looks as if there is support for loading files in from Google Docs, so would it be possible to use this environment as a way of providing a graphing environment for data files stored (and maybe shared via a course) within a student’s Google Apps account?

Further Innovations in Campus Mapping

Almost a year or so ago I posted some quick round-ups of some recent innovations (at the time) in UK HE’s use of online campus maps (Open Data Powered Location Based Services in UK Higher Education, Innovations in Campus Mapping). Retweeting a post from Mike Nolan (Mapping the campus) about Edge Hill’s use of OpenStreetMap as the basis of an intereactive campus map (a nice example of how local benefits can support the common good?) I got a couple of tweeted responses about use of OpenStreetMap elsewhere:

– @danmcquillan mentioned how “my social computing 2nd years added detail & edits to @openstreetmap for @GoldsmithsUoL” [GoldsmithsUoL on OpenStreetMap]

– @julieallinson sent a link to the blog post that announced the University of York’s latest interactive map release, as well as to a behind the scenes post, which describes their use of custom tiles from CloudMade with the Google Map API providing the interactive map infrastructure. Data for location markers is stored in a Google Spreadsheet and then transformed into an appropriate JSON format via YQL which is glued into the map using a dash of JQuery. Magic:-)

I was also interested to see how the York U Estates department was releasing information about their building codes.

A quick trawl turned up a couple of other approaches to campus mapping that I don’t think I’ve mentioned before:

– the University of Warwick interactive map appears to use Bing maps, and as part of the offering provides a crude room level search:

– From the GoGeo team at Edina, a how-to post on creating simple campus maps using Digimap ROAM. Digimap ROAM is a service that allows you to annotate Ordnance Survey maps that can then be “printed off” as PDF documents.

The GoGeo blog post ends with a tease – “In the next post, we will look at some more advanced uses of Digimap data in campus maps” – but I can’t find any evidence of such a follow on post appearing?

So – any other innovations in campus based interactive maps out there (and in particular, web team blog posts about some of the technical details, including links to github repos containing the relevant code, perhaps?!;-)

PS Further OSM based campus maps: University of Cambridge