如何通过curl或wget下载Google Drive网址 [英] How to download a Google Drive url via curl or wget

查看:386
本文介绍了如何通过curl或wget下载Google Drive网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法通过curl或wget下载公开浏览的Google Drive网址?例如,可以执行以下操作:

Is there a way to download a publicly-viewable Google Drive url via curl or wget? For example, being able to do something like:

curl -O myfile.xls https://drive.google.com/uc?export=download&id=1Wb2NfKTQr_dLoFJH0GfM0cx-t4r07IVl

请注意,我正在寻找可公开浏览的文件,无需登录我的Google帐户(或让其他人登录其帐户等)。

Note, I'm looking to do this on a publicly-viewable file without having to sign into my Google account (or have someone else sign into their account, etc.).

如果我有cors头文件:

If helpful, the cors headers I have are:

 "kind": "drive#file",
 "id": "1Wb2NfKTQr_dLoFJH0GfM0cx-t4r07IVl",


推荐答案

您需要使用 -L 开关使curl跟随重定向,并且文件名的正确开关是 -o 。您还应该引用网址:

You need to use the -L switch to make curl follow redirects, and the correct switch for the filename is -o. You should also quote the URL:

 curl -L -o myfile.xls "https://drive.google.com/uc?export=download&id=0B4fk8L6brI_eX1U5Ui1Lb1FpVG8"

这篇关于如何通过curl或wget下载Google Drive网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆