gpt4 book ai didi

google-apps-script - 调用 Drive.Files.get(fileId,{alt : 'media' }) in Google apps script (Google Drive API/REST V2)

转载 作者:行者123 更新时间:2023-12-03 07:40:47 24 4
gpt4 key购买 nike

当我尝试使用 Drive.Files.get(fileId,{alt: 'media'}) 从Google 应用程序脚本(我使用的是 Google Drive API/REST V2)。

奇怪的是,我的文件内容似乎在错误消息中返回,如下:

{
"message":"Response Code: 200. Message: id\turl\tthumbnail_url\ttitle\tpublishedAt\tdescription\tchanelId\tcategoryId\ttags\tduration\tdislikeCount\tviewCount\tlikeCount\tcommentCount\r\n....",
"name":"HttpResponseException",
"fileName":"Code",
"lineNumber":142,
"stack":"\tat Code:142 (updateChannelVideos)\n",
"statusCode":200
}

您知道如何在不使用 UrlFetchApp 等服务的情况下从服务器端获取文件内容吗?

最佳答案

Google Apps 脚本似乎无法处理来自 var myFile = Drive.Files.get(fileID,{alt: 'media'}); 的响应,如果还没有,您可能需要归档为错误。

编辑: updated related issue ticket here .

您可能会发现使用 DriveApp 比使用 Drive 高级服务更容易。根据您的其余代码,在混合 DriveDriveApp 调用时不需要额外的范围。

例如你可以使用:

var myFile = DriveApp.getFileById(fileID).getAs('text/plain').getDataAsString(); 

关于google-apps-script - 调用 Drive.Files.get(fileId,{alt : 'media' }) in Google apps script (Google Drive API/REST V2),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51726914/

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