Google Drive网盘文件直链获取一键脚本
说明:本脚本可以将Google Drive
网盘的文件分享链接或者文件ID
变成直链,方便我们在很多情况下调用。只支持文件分享,不支持文件夹。文件分享ID
为26
到48
位。
使用
1、需求
wget、grep、cat、head #系统一般都有,Centos 7可能要安装wget
2、下载脚本
wget --no-check-certificate -qO /usr/local/bin/gdlink 'https://www.moerats.com/usr/shell/gdlink.sh' && chmod a+x /usr/local/bin/gdlink
3、使用方法
注意: 获取的分享链接权限为”知道链接的任何人“。
#Work with share link/使用分享链接方式 gdlink 'https://drive.google.com/open?id=0B8SvBXZ3I5QMcUduTMJEanRkMzQ' #Work with file id/使用文件ID方式 gdlink '0B8SvBXZ3I5QMcUduTMJEanRkMzQ' #download with share link/使用分享链接方式直接使用wget下载链接 ##可将其中./download改成自己需要的文件名或文件绝对路径 gdlink 'https://drive.google.com/open?id=0B8SvBXZ3I5QMcUduTMJEanRkMzQ' |xargs -n1 wget -c -O ./download
4、调用场景
比如该DD
教程:Linux VPS无限制一键全自动DD安装Windows脚本。
先获取到谷歌网盘里的DD
镜像链接
https://drive.google.com/open?id=0B8SvBXZ3I5QMcUduTMJEanRkMzQ
调用该分享链接。(将文件ID
替换为自己的即可)
#Work with share link/使用分享链接方式 bash DebianNET.sh -dd "$(echo "https://drive.google.com/open?id=0B8SvBXZ3I5QMcUduTMJEanRkMzQ" |xargs -n1 bash <(wget --no-check-certificate -qO- 'https://moeclub.org/attachment/LinuxShell/gdlink.sh'))" #Work with file id/使用文件ID方式 bash DebianNET.sh -dd "$(echo "0B8SvBXZ3I5QMcUduTMJEanRkMzQ" |xargs -n1 bash <(wget --no-check-certificate -qO- 'https://moeclub.org/attachment/LinuxShell/gdlink.sh'))"
网盘直链获取工具也可以参考下面的网址
实例下载:
[root@iZj6c9ev4k7bawyw8s7nljZ ~]# wget https://link.gimhoy.com/googledrive/aHR0cHM6Ly9zdG9yYWdlLmdvb2dsZWFwaXMuY29tL2thZ2dsZS1kYXRhc2V0cy8xMzk2MzAvMzI5MDA2L2Zhc2hpb24tcHJvZHVjdC1pbWFnZXMtZGF0YXNldC56aXA/R29vZ2xlQWNjZXNzSWQ9d2ViLWRhdGFAa2FnZ2xlLTE2MTYwNy5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSZFeHBpcmVzPTE1NTk4MDExMzImU2lnbmF0dXJlPVpSY1psUmdCYmRCVWViMGU3dGJQYnFXYmt5azFIUGNIZ1NGSGNobGNlVTBmdlJqell6bnQyVGhQQ0xNbmgzSUJZdDdOQ2U0dUtrbUJuN1Y2YzJIdVFBMzFPZ2pyT3ZhSkM5VnlscHZOQ1VVV1ZYYkJFZ2RKVzFMVTBjQzFnS2JUSnFIMG1wbGEzRnkwYktwaEZVZnp4TGtGbGZST3o2JTJGMlVET0F3c2tyUWtVT2FhMlcwd0JCaDdvWDl6WWpZSU15Nnh4M0FvMDFoM3pnNEpQSDQ0UE4yazdPUEcwU1RMZDVEME5CZnpHOXpYVjk2OWwlMkJ4d28zQnBuN1NQdk5vVkNKZERWbG5rY2N3WThKQWVaM0dlZFpWYURMdjVMRnJ1bXRNM08lMkZGOXRZM2pGRFVidUU4VklZTXBIMXJMbnZBcWdWaFRmUHR3ZEx0cmpxWHlKOGxOS0NEZyUzRCUzRA==.zip -c -O ./dataset.zip [root@iZj6c9ev4k7bawyw8s7nljZ ~]# wget --no-check-certificate -qO /usr/local/bin/gdlink 'https://www.moerats.com/usr/shell/gdlink.sh' && chmod a+x /usr/local [root@iZj6c9ev4k7bawyw8s7nljZ ~]# gdlink 'https://drive.google.com/open?id=1lQZOIkO-9L0QJuk_w1K8-tRuyno-KvLK' |xargs -n1 wget -c -O ./train.zip Warning: wildcards not supported in HTTP. --2019-06-03 14:18:02-- https://doc-0c-4o-docs.googleusercontent.com/docs/securesc/ha0ro937gcuc7l7deffksulhg5h7mbp1/me71dile70q5qah4h97fnk7otq9tsnto/1559541ad Resolving doc-0c-4o-docs.googleusercontent.com (doc-0c-4o-docs.googleusercontent.com)... 216.58.220.193, 2404:6800:4005:80d::2001 Connecting to doc-0c-4o-docs.googleusercontent.com (doc-0c-4o-docs.googleusercontent.com)|216.58.220.193|:443... connected. HTTP request sent, awaiting response... 200 OK Length: unspecified [application/zip] Saving to: ‘./train.zip’ [ <=> ] 10,633,411,064 12.2MB/s in 13m 49s/s 2019-06-03 14:31:51 (12.2 MB/s) - ‘./train.zip’ saved [10633411064]