1

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>
Kirubakaran
  • 378
  • 4
  • 20

1 Answers1

1

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:

Tanaike
  • 181,128
  • 11
  • 97
  • 165
  • 1
    Hi Tanaike, Than you very much. It is resolved the issue. Also, I found ```curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L)``` for ```libcurl``` usage. – Kirubakaran Dec 27 '20 at 08:11