Facebook Logo

I had a need for downloading all of my facebook photos.  One way you can do this is by downloading a full copy of your facebook data.  Unfortunately, this only includes the low-resolution version of your photos.  There are some other options online, but most looked pretty sketchy.

I knew about facebook’s Graph API and played around with it a little before.  So, I decided to use this as an opportunity to work with that a little more and play around with the go language.

The Graph API uses oauth for authentication, but in this case, I wanted to write a simple command line application so the oauth flow seemed a little more than I wanted to do.  To get around this I used facebook’s Graph API Explorer to manually get the access token and then paste it directly into the app.  This introduces a few additional steps, but for my one-off use case, this was acceptable.  It also eliminates the need for creating a new “facebook app.”

I have played around with go only a little before so it took a little longer as I was rediscovering everything, but a little bit later I had a working app that downloaded the high-resolution photos from facebook that I was looking for.

I really like the fact that this whole app is really just one go file.  You can see this in the following gist.

Disclaimer: I haven’t paid too much attention to the details of go’s memory handling in this app.  I wouldn’t be surprised if the above doesn’t properly handle memory in all cases.

Back to blog...