Google-photos – Getting a unique identifier for a photo/video in Google Photos without creating ‘sharable link’

google-photos

I'd like to apply tags to my photos/videos in Google Photos.

Currently it's possible to simulate tags using albums, but the process is very awkward (a big problem is that you can't search for albums by name when adding a photo to an album).

My plan is to create a local tagging system, but without downloading my multi-GB photos collection and tagging the actual photo files themselves.

Rather, I would use something like a JSON file, where each tag corresponds to a key, and its value is an array of all the photos/videos to which I've attached that tag.

For this to work, I need a way to uniquely identify any given photo in my Google Photos collection.

Now one way to go about creating a unique identifer is to create a "Sharable Link". But not only is this extremely slow (it's also less safe because it potentially exposes the photos to url crawling bots).

This then leads to my question: is it possible to get simply a 'permalink' to the photo/video item?

I want to stress emphatically that I'm not asking whether it's possible to get a "direct link" to an image, which is a question often asked about services like Imgur/Google Photos/etcs by people who wish to embed uploaded images in their blog posts etc.

For my purposes it's totally fine if the link takes me not to the image itself, but to a webpage that shows the image.

Now, when I'm in Google Photos, when I click on a photo, I see that the address bar changes to something like: "https://photos.google.com/photo/AF1QipOZhjDi_zk1oqs274840HF6roEykpBuIlCMWDgI"

Is this safe to use as a unique identifier/permalink? Or will it expire after a while?

Note that this link is not a 'direct link' to the image – but to a page.

Thanks so much for any help in advance.

Best Answer

The URL slug is your best bet I think. They are a (private) permalink to any given photo as far as I can tell and URLs are easy to use in a Chrome extension.

The "proper" unique ID is the media item id returned by the Google Photos API, however there is no way to get the media item id from the URL. Vice versa, the API gives you the URL given the media item id.