Wednesday, September 12, 2012

Google User Content API?


Last night I wanted to download an originally sized image from Google+, which lead me to this odd little user content API.  I should note that the image that I'm using as an example here is in my instant upload.  I haven't shared it in any way on Google+  Yet, if you can construct the URL (obviously not a trivial task) then you can access it.

Here is the basic image URL:

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJ_4MAcZSc0ILAHsvDPPNSkaHhA4xZ4jXPwEyxN4JHpGg9ByRPmYDQFm897BP7SQvNAAqEvyrrFT6_hxRN3Pj-2DetuAm1t_tulfFs5EHZ3Fu5jJUUjUj3LpUkuF1-2HZu1kXuG-2NuAGa/IMG_20120912_092939.jpg <- Default sized at 512px height

Here are the simple parameters that I was able to flush out.  Each is placed in a /parameters/ path section before the image name:

/s768/IMG_20120912_092939.jpg <- Sized at 768px height
/h768/IMG_20120912_092939.jpg <- Sized at 768px height
/w768/IMG_20120912_092939.jpg <- Sized at 768px width
/c/IMG_20120912_092939.jpg <- Cropped (defaults to 512x512)
/d/IMG_20120912_092939.jpg <- Downloads the image (defaults to original resolution, but is effected by other parameters)
/g/IMG_20120912_092939.jpg <- Produces XML used by Google's pan/zoom, see: http://howiprovedit.com/archives/74
/h/IMG_20120912_092939.jpg <- When h is given without being followed by an integer it wraps the image in html (image effected by other parameters)
/o/IMG_20120912_092939.jpg <- Adds a "Play" circle to the center of the image
/p/IMG_20120912_092939.jpg <- Crops the image in the same manner as /c/ (odd)

These seem to hint at other parameters that I have not been able to ascertain:

/b/IMG_20120912_092939.jpg
/k/IMG_20120912_092939.jpg
/r/IMG_20120912_092939.jpg
/e1234/IMG_20120912_092939.jpg
/h1234/IMG_20120912_092939.jpg
/q123/IMG_20120912_092939.jpg
/t123/IMG_20120912_092939.jpg
/v/IMG_20120912_092939.jpg

It also looks like you can do some mix and match on the parameters:

/w123-h768/IMG_20120912_092939.jpg <- Sized at 123px width and scaled height (h parameter ignored) 
/h768-w256-c/IMG_20120912_092939.jpg <- Cropped at 341x341 ???
/h768-w123-c/IMG_20120912_092939.jpg <- Cropped at 164x164 ???
/h543-c/IMG_20120912_092939.jpg <- Cropped at 543x543
/s123-h543-c/IMG_20120912_092939.jpg <- Cropped at 123x123...s takes precedence over h
/h543-s123-c/IMG_20120912_092939.jpg <- Cropped at 123x123...s still takes precedence over h
/w123-h768-c/IMG_20120912_092939.jpg <- Cropped at 123x123...w takes precedence over h
/h768-w123-c/IMG_20120912_092939.jpg <- Cropped at 123x123...w still takes precedence over h
/h256-c-o/IMG_20120912_092939.jpg <- Cropped at 256x256 with a "play" button in the middle
/b-h768-c-o/IMG_20120912_092939.jpg <- Cropped at 768x768 with a "play" button in the middle, b has no obvious effect
/c-s256-h/IMG_20120912_092939.jpg <- Cropped at 256x256 and wrapped in html
/h512-o-h/IMG_20120912_092939.jpg <- Height of 512 with a "play" button and wrapped in html

...then I got bored.  Is this documented anywhere?  I wasn't able to find anything and am doubting that I ever will.


No comments: