使用本網站上的另一個答案,我能夠找到這個 curl 腳本:#!/bin/bashfileid="0Bz-w5tutuZIYY3h5YlMzTjhnbGM"filename="MyFile.tar.gz"curl -c ./cookie -s -L "https://drive.google.com/uc?export=download&id=${fileid}" > /dev/nullcurl -Lb ./cookie "https://drive.google.com/uc?export=download&confirm=`awk '/download/ {print $NF}' ./cookie`&id=${fileid}" -o ${filename}它能夠下載大型 Google Drive 文件(顯示警告頁面)。此外,我能夠給我們pip install gdown命令:gdown https://drive.google.com/uc?id=0Bz-w5tutuZIYY3h5YlMzTjhnbGM或pip install youtube-dl圖書館:youtube-dl https://drive.google.com/uc?id=0Bz-w5tutuZIYY3h5YlMzTjhnbGM`我什至可以在 NODE.js 中運行 gdown 腳本:const {spawn} = require("child_process"); var g = spawn("gdown", ["https://drive.google.com/uc?id=0Bz-w5tutuZIYY3h5YlMzTjhnbGM"]); g.stdout.on('data', (d) => { console.log(d.toString()); }); g.stderr.on('data', (d) => { console.log(d.toString()); }); g.on('close', (d) => { console.log("closed with: " + d.toString()); });問題:我希望能夠使用 Google Drive 為網站托管大文件,為此我需要能夠生成直接下載鏈接。我在想像向 mynodewebsite/GOOGLE_DRIVE_LINK 發出 GET 請求,甚至向 node.js 服務器發出套接字請求,要求它獲取鏈接,然后等待生成的鏈接響應。但是,雖然我可以使用上述方法緩慢下載文件,但我如何簡單地返回 / 文件的直接鏈接?我是否需要將 google drive 文件下載到 node.js 服務器上,等待它完成處理,然后將該文件的路徑返回給客戶端,然后再將其刪除?這會破壞大文件的目的,因為我想使用 Google Drive 作為完整的托管......那么我怎樣才能簡單地返回直接的 Google Drive 下載鏈接而不是下載整個東西?
添加回答
舉報
0/150
提交
取消