jmhobbs

Dashwire Photo Export

I used to have a Windows phone, and I used a cool service called Dashwire to sync all my photos, contacts, etc. to the web.

Dashwire is shutting down this month, which is sad, but I haven't used it in a long time, since I switched to Android. However, I've still got photos on there, and I'd like to grab them before they are gone. Unfortunately, Dashwire doesn't have an easy export option that I could find.

So, pass one involved the photos RSS feed available on the site. I wrote this script to grab the feed, parse and download the photos.

import sys
import time
import feedparser
import urllib

if 2 > len( sys.argv ):
  print "usage: %s " % ( sys.argv[0], )
  exit(1)

url = 'http://dashwire.com/%s/photos/feed' % ( sys.argv[1], )

print "Fetching: ", url

rss = feedparser.parse( url )

for item in rss.entries:
  timestamp  = time.strftime( '%Y-%m-%d %H:%M:%S', item.date_parsed )
  file_url   = item.media_content[0]['url'].replace( '-mobile.jpg', '.jpg' )
  file_local = '%s - %s.jpg' % ( timestamp, item.title )

  print "Downloading %s to %s" % ( file_url, file_local )

  request = urllib.urlopen( file_url )
  with open( file_local, 'wb' ) as handle:
    handle.write( request.read() )
  request.close()

It works as advertised, but it only drags down public photos, and only the most recent 30.

For round two I opened up the Dashwire dashboard and poked around their AJAX calls.

Turns out they have an images.json which has entries for every one of your photos in it.

[{
  "rotation": 0,
  "unique_id": "-1294276037.2068.1142222",
  "modified_at": 1252717454,
  "body": null,
  "title": null,
  "seconds": 1252373668,
  "guid": "aWGu0CNZGr3OCJadbiFPIW",
  "private": true,
  "bucket": "media3.dashwire.com",
  "tags": [],
  "type": "Image",
  "id": 6734053,
  "height": 1920,
  "comments_count": 0,
  "ratings_average": 0,
  "width": 2560
},...]

To get this file, log into the dashboard, then download http://my.dashwire.com/images.json.

Once you have that, you will also need to figure out your user guid. You can do that with JavaScript, it's stored in Dashwire.User.guid.

Then just plug it into the script below to get your stuff out!

import sys
import time
import json
import urllib

USER_KEY = '[get this from dashwire]'
obj = None

with open( 'images.json', 'r' ) as handle:
  obj = json.loads( handle.read() )

for image in obj:
  file_url = 'http://%s/media/%s/%s.jpg' % ( image['bucket'], USER_KEY, image['guid'] )
  timestamp = time.strftime( '%Y-%m-%d %H:%M:%S', time.localtime( image['seconds'] ) )
  file_local = '%s - %s.jpg' % ( timestamp, image['title'] )

  print "Downloading %s to %s" % ( file_url, file_local )

  request = urllib.urlopen( file_url )
  with open( file_local, 'wb' ) as handle:
    handle.write( request.read() )
  request.close()

Now sit back and enjoy as it downloads your photos!

Hurry up though, it all shuts down on Febuary 15th