Google直接链接 [英] Google drive direct link

查看:157
本文介绍了Google直接链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谷歌驱动器文件是否有直接链接,所以我可以通过链接下载它们?根据我的理解,webContentLink只能被浏览器使用,downloadUrl可以用于小文本文件,并且可以使用类似于XMLHttpRequest或其他内容。

解决方案

webContentLink downloadUrl 是您可以用来下载驱动器文件的两个主要链接。




  • downloadUrl 要求您授权使用OAuth 2.0(使用 downloadUrl +& access_token =+ access_token 或将授权HTTP头)。它可以用来下载任何尺寸的文件。不知道是什么让你相信它只适用于小文本文件。不是。 downloadUrl 是一个临时的网址,约在24小时有效。 webContentLink 要求用户登录Google帐户。基本上,它使用cookie授权,这就是我们通常说它被用在浏览器中的原因。但是,该链接还有一个有趣的用例:如果您的文件是公开共享的,那么此链接不需要任何类型的授权,而 downloadUrl 仍然需要您使用OAuth 2.0访问令牌。 webContentLink 永不过期。


Is there some kind direct links for google drive files, so I could download them by their links? Even temporary links would have been enough.

As I understood, webContentLink can be used only by browsers, downloadUrl can be used for small text files and shoud be used with something like XMLHttpRequest or something else.

解决方案

webContentLink and downloadUrl are the two main links you may use to download a Drive file.

  • downloadUrl requires you to authorize using OAuth 2.0 (append the access token to the URL using downloadUrl + "&access_token=" + access_token or using the Authorization HTTP header). It can be used to download files of Any size. Not sure what made you believe it's only for small text files. It's not. The downloadUrl is a temporary URL that is valid around 24h.
  • webContentLink requires the user to be signed in a Google Account. Basically, it uses cookie authorization which is why we usually say it's to be used in a browser. However there is another interesting use-case for that link: If your file is shared publicly then this link does not require any kind of authorization whereas downloadUrl still needs you to use an OAuth 2.0 access token. The webContentLink never expires.

这篇关于Google直接链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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