gpt4 book ai didi

google-apps-script - 如何在 Google Drive API 中获取修订版的导出链接

转载 作者:行者123 更新时间:2023-12-03 21:40:23 25 4
gpt4 key购买 nike

我正在使用 Google Apps Scripts 尝试获取 Google 绘图的各种修订版的 exportLinks 列表。下面的代码重现了这个问题。要试用它,请使用绘图 ID 调用 getRevisionHx。

//Google oAuth
function googleOAuth_(name,scope) {
var oAuthConfig = UrlFetchApp.addOAuthService(name);
oAuthConfig.setRequestTokenUrl("https://www.google.com/accounts/OAuthGetRequestToken?scope="+scope);
oAuthConfig.setAuthorizationUrl("https://www.google.com/accounts/OAuthAuthorizeToken");
oAuthConfig.setAccessTokenUrl("https://www.google.com/accounts/OAuthGetAccessToken");
oAuthConfig.setConsumerKey("anonymous");
oAuthConfig.setConsumerSecret("anonymous");
return {oAuthServiceName:name, oAuthUseToken:"always"};
}

function getRevisionHx(resource_id){
var scope = 'https://www.googleapis.com/auth/drive';
var myKey = KEY_DELETED_FROM_SAMPLE_CODE;

var fetchArgs = googleOAuth_('drive', scope);
fetchArgs.method = 'GET';

var url = "https://www.googleapis.com/drive/v2/files/" + resource_id + "/revisions?key=" + myKey;
var urlFetch = UrlFetchApp.fetch(url, fetchArgs);

... //snip

}

在 snip 中,urlFetch 成功了,它有一个修订列表,每个修订都有 exportLinks。如果我获取其中一个 exportLinks 并使用 Web 浏览器下载它,它总是检索文档的最新版本,而不是指定的修订版。这是一个错误还是我做错了什么?

换句话说,上述所有代码似乎都可以正常工作(API 调用成功并返回预期的内容),但返回的 exportLink URL 并未指向他们所说的修订版。

最佳答案

已重现相同的结果。

我会为你报告此事。对造成的不便表示歉意。

关于google-apps-script - 如何在 Google Drive API 中获取修订版的导出链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17284278/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com