Google Photos REST API “BASE_URL=dv” return "302 Moved" error

Viewed 188

I was using Google Photos REST API to download my videos. Based on the documentations, I was using the below curl command with BASE_URL=dv parameters to get the video file and getting 302 Moved error but video is in READY state. Pasted the output below. Kindly help to resolve the error.

API:

curl --compressed --output - --request GET   --header 'Authorization: Bearer ACCESS_TOKEN'   --header 'Accept: application/json' 'BASE_URL=dv'

Output:

<HTML>
<HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="VIDEO_URL">here</A>.
</BODY></HTML>
1 Answers

I believe your goal as follows.

  • You want to download the video as a file using curl command.

In this case, please use the following curl command.

Modified curl command:

curl -L "base-url=dv" -o sampleFilename
  • In this case, it seems that the access token is not required to be used.

  • Please use -L and --location for the redirect.

  • When base-url is https://lh3.googleusercontent.com/lr/###, please use https://lh3.googleusercontent.com/lr/###=dv as the URL as follows.

      curl -L "https://lh3.googleusercontent.com/lr/###=dv" -o sampleFilename
    

References:

Related