simonedegiacomi / gphotosuploader

Unofficial Google Photos uploader and Go library
GNU General Public License v3.0
99 stars 30 forks source link

Adding photos to specific (precreated) album #2

Open zuci42 opened 6 years ago

zuci42 commented 6 years ago

Dears, I wonder how to implement subj.

I am absolutely lost looking for docs for these api url

NewUploadUrl = "https://photos.google.com/_/upload/uploadmedia/rupio/interactive?authuser=2"
EnablePhotoUrl = "https://photos.google.com/_/PhotosUi/mutate"

Especially the last one! How did you get them? (:

simonedegiacomi commented 6 years ago

Hi, unfortunately there aren't any documented API for Google Photos. I found the two urls looking at the requests (using the developer tools) that the browser was making while uploading some images.

I guess that the functionality to add photos to a specific album can be achieved making a further request. The first step would be to upload an image using the official website and then try to move the image to an album, looking at the network tab of the dev tools of the browser to find the needed url

zuci42 commented 6 years ago

Many thanks - I will try. Looking back everything looks so obvious! (:

simonedegiacomi commented 6 years ago

I added a parameter for the cli interface and an argument for the UploadOptions object to specify the album id. I tried it with my account and it works, but the code uses some constants and i'm not sure if they are account dependent. @zuci42 You can try if it works with your account, the commit with the update is this one 9e6786052eb94b2ab29a7fb097f056465b3880b6

zuci42 commented 6 years ago

Oh, this so cool of you dude! Thank you so much! I've just discussed yesterday evening google photos/picasa api and this issue.

Not shared album looks like: https://photos.google.com/album/AF1QipM2jepS5TIW1pIzeOlVjBj29k6IlmCAr_OyNFJf

shared looks like this: https://photos.google.com/share/AF1QipO6Jo8HoUvoPl2iw0yXikxIClji1XgYgTZTnzOZ1mp88IvOxWy3Mdu8nF5uofA5jA?key=somekey

By now it do not works:

go run main.go --album AF1QipO6Jo8HoUvoPl2iw0yXikxIClji1XgYgTZTnzOZ1mp88IvOxWy3Mdu8nF5uofA5jA --upload some.jpg
# command-line-arguments
./main.go:52: too many arguments in call to utils.NewUploader
    have (auth.Credentials, string, int)
    want (auth.Credentials, int)

Regretfully by now I don't have more time for further troubleshooting. Will return here later!

jhult commented 6 years ago

The --album parameter is working well for me.

It looks like the code has the correct constant. Some other constants can be found here.