5
votes
  • I have some audio recordings on Google Drive
  • the files are "viewable by anyone with the link"
  • I have created a podcast feed that links to these files

In order for a podcast client to download the files, it needs a direct download link. The Google Drive API returns two fields in a file's metadata that can play this role:

  • webContentLink is intended to be used in a browser. It allows my podcast client to download files less than 25MB; unfortunately, over this amount Google requires user confirmation since the file is not virus-scanned. This user-confirmation step prevents my podcast clients from downloading the file if it is over 25MB.
  • downloadUrl is what you're supposed to use, but I cannot get it to work at all. If I copy-paste a downloadUrl directly into my browser's address bar, I get nothing. Similarly my podcast client can't download anything with a downloadUrl.

This issue seems unresolved and suggests this is still broken, but I have a few questions:

  • should I need to submit an API key with the downloadUrl request? No key is needed for webContentLink.
  • is there a workaround for this issue?
1
For downloadUrl, you cannot access the contents in a browser. Try testing if you are able to get the contents with the downloadUrl using [Oauth 2.0 Playground][1] and see if you can see the contents of the file. [1]: developers.google.com/oauthplayground - KRR
I have the same issue. Impossible to download a file from Google Drive with Apis if the file is over 25 MB. Have you found a workaround ? :) - Maƫl

1 Answers

1
votes

When requesting the file with the downloadUrl you must specify the following authorization in your request header:

"Authorization: Bearer $token"

Where $token is the access_token returned by gapi for the user like this:

gapi.auth2.getAuthInstance().currentUser.get().getAuthResponse().access_token;

So if you were using curl the request would be something like this:

curl -o download -H "Authorization: Bearer $token" $downloadUrl