Fetch a random photo from Google Photos with API - google-photos

I want to write an app that fetches a random photo from my Google Photos set of photos using the Google Photos API. This is the new Google Photos, not the old one that was linked to a Google Drive.
In my review of the API Docs, it seems that you can list albums, and perhaps list what the albums contain, but it's not obvious to me how to download a photo itself. Can anyone figure it out?

Try with this API: https://developers.google.com/photos/library/reference/rest/v1/mediaItems/list
It lets you list the photos from your library and returns two parameters, productUrl and baseUrl, that you could use to get the photo.

Related

Select some photos from witnin an album and Create a url to share them using Google Photo APIs

I managed to create a Google Photo Album and upload many photos to this album using the Google Photo API.
I need also using Google Photo API again, to select only a couple of these photos and create a url in order to share this.
I would appreciate any help,
Nick

Google Photos API - Can I access existing enrichments?

I'm using the Google Photos Java API to create a small program to access the contents of a pre-existing album. I have been able to get code up and running that can report the album's name, and the media items it contains and so on, but not the text added between photos. I understand that the API considers these texts a form of enrichment and I can see there are functions for adding such enrichments to an album, but is there any way to list the enrichments already in an album? Or otherwise access the text a user has previous added between photos via the platform's desktop browser interface?
Unfortunately the Google Photos Library API does not provide a way to access existing album enrichments when accessing the contents of an album.
This has been filed as a feature request on the issue tracker for the API. You can 'star' it to draw attention to it and be notified of any updates: https://issuetracker.google.com/129050144

How to get direct permanent link to public image on Google Photos?

I have Google Photo public album and I want to receive direct links for photos form this album. This links I'll use on my blog web pages. How I can to do it?
P.S.: I know that Picasa Web Albums had this feature.
At this time Google actively changes its image service behavior. Now, there is not any algorithms how to receive direct and permanent links to your shared photos. The URLs are received by the right-button click, like https://lh3.googleusercontent.com/(LONGLONGCODE...)=w800-h600-no, are temporary and live one-two days and then will be closed.
You can try new Google service - Google Archive Album. This service was created as holder for albums from the deleted Picasa service. But it contains photos and albums from Google Photo too. The Google Archive Album have two greats advantages:
links are much shorter the from those of Google Photos,
this links are permanent!
For working with Google Archive Album you need to follow rules:
create standard (NOT PUBLIC) album in Google Photos.
go to Google Archive Album and make sure that you see the new album.
add to album required photos and only now change its type to the public by creating the shared link to it.
again go to Google Archive Album, open your album.
click on first photo.
right-clink on photo image and copy link to the clipboard.
insert received link where you need.
repeat steps 5-7 for others photos.
voilĂ !
But how long time Google Archive Album will working I don't know :(
P.S.: If you don't know - URL links from Google Photos and Google Archive Album can be tuned. For detail reads the special site.

Is there query API for Google Photos (photos.google.com)

We can choose cat photos taken in a location in the google photos app, but I wonder if there is any API for that?
I did some search and people suggested we can use the old google+ API for upload, but I'm looking into getting a list of photos that match the search.
Or, perhaps to get a list of photos in a given public photo albums?

Search photo & videos from facebook

Can we search public photos & videos from facebook by tags as input perameter as we do in flickr using the tags we search photos and flickr API returns list of photos.
Any help or suggestion would be greatly appriciated.
Thanks
Gaurav
last time I checked, photos uploaded to Facebook do not have tags. Therefore, it isn't possible to return photos that match a tag. What you could do, is search for groups or apps on Facebook and then retrieve the public photos there.
The search URL format is https://graph.facebook.com/search?q=watermelon&type=post&access_token=AAAAAAITEghMBAHwKSuFoX7OpcyCezYGO1JkVzBaQq6fBdXoHPayxZCxta4EZC0fYSLPjO16Yf9FKOAkhOHrU2ROZCZB9fcbLsDtPFgy67dK5TXOeYJqG, where q is your query. More info can be found here. https://developers.facebook.com/docs/reference/api/
Here is an app that allows you to search facebook photos!
The below api query will return everything that has that object_id tagged.
https://graph.facebook.com/[object_id]/tagged
An example of this would be looking for everything tagging Heat Ultra Lounge (a project I'm working on). To get the objects tagged with this tag, I would use the below get address and include &access_token=[my or my app's access token]. Like so:
https://graph.facebook.com/118613151504271/tagged?access_token=[youraccesstoken]