ITHCWY: Robert Ellison's Blog

Capture DropCam (Nest Cam) frames to Google Drive

Capture DropCam frames to Google Drive

Here's an easy way to capture frames from a DropCam to Google Drive. This only works if you have a public feed for your DropCam.

Go to the public page for your DropCam (Settings -> Public -> Short URL Link) and then view source for that page. Near the top you can find the still image URL for your DropCam:

<meta property="og:image" content="https://nexusapi.dropcam.com/get_image?uuid=12345&height=200" />

In Google Drive create a new Apps Script (If you don't already have Apps Script you can find it via Connect more apps...). Paste in the following code:

function downloadFrame() {
  var timestamp = Date.now().toString();
  
  var url = 'https://nexusapi.dropcam.com/get_image?uuid=12345&height=1280&cb=' + timestamp;
  var response = UrlFetchApp.fetch(url);
  var blob = response.getBlob();
  blob.setName(timestamp + '.jpg');
  
  var folders = DriveApp.getFoldersByName('DCFrames');
  while (folders.hasNext()) {
    var folder = folders.next();
    folder.createFile(blob);
    break;
  }
}

Replace the uuid parameter in the URL with the uuid from the still image URL for your DropCam. Note that the height parameter in the script has been changed to 1280 to get the largest possible image. A timestamp is being used to add a random cache busting parameter to the still image URL and is also used as the filename for the image.

The script will save the images to a folder called DCFrames - either create this folder in your drive or change this parameter to the desired folder.

Run the script and check that it's working. If everything looks good go to Resources -> Current project's triggers in the Apps Script editor. You can now set up a timer to save a frame as frequently as every minute (which I'm using to collect frames to make a daily time lapse movie). You can also ask Apps Script to send you an email when the script fails.

Updated 2015-07-01: DropCam is now Nest Cam - assuming that Nest keep the API going everything should keep working as above for both types of camera.

Comments

Stephen Smele
Thanks for the handy GB filling tip.
Kyle Held

Worked like a charm. Thanks!

Add Comment

All comments are moderated to weed out spam. Email address is optional and is only used to display your Gravatar.