how to programmatically download a public Google D

2020-08-09 10:59发布

问题:

I have a backend server that has to download a file on Google Drive that has been shared to public by the owner. Our clients are emailing us the link and we get the link from the email -- no UI is involved. The program needs to get or download the file and process it offline .

The google samples seem to be runnig using the UI where as this is a automated backend process.Also, this application is to running on my server and not on Google App Engine . Do I still need to register my app if all I am doing is acessing files shared to public by the owner.

For reference , please note that it is trivial to download /wget a file shared on Dropbox .

回答1:

You don't need any Google SDK if you know the link and the file is public. Just use a standard HTTP GET method to download the file.



回答2:

This is an older question (and already has an accepted answer), but Google just announced a new way to tackle this problem that makes it quite a bit easier to solve; basically, you can now (as of 11/28/2012) make a folder and set the folder to be public, and then any file put in the folder can be downloaded via HTTP GET without ever getting an intermediate page (regardless of the filesize). Details:

http://googleappsdeveloper.blogspot.com/2012/11/announcing-google-drive-site-publishing.html