[CentOS/Ubuntu...]Linux 下载 Google Drive/Docs(谷歌硬盘/文档 作者: Chuwen 时间: 2018-10-04 分类: Linux > ## 在某个群有群友想要 `LineageOS 16 for mido` 的 ROM 包,奈何他“网络环境不佳”,没法下载;所以我就想到了先在服务器上下载,让他从我的服务器上下载,这样速度就快很多了 > ## 然后我就找到了 “下载别人在 Google Drive 分享的文件” 工具 # 1. 环境要求 - ## `wget` 命令 > ## 这个一般 Linux 系统都有 `wget`,如果没有,请使用系统自带的包管理器安装。 > ## 1. 如 `CentOS` 执行 `sudo yum install wget -y` 安装 > ## 2. 如 `Ubuntu`、`Debian`... 执行 `sudo apt install wget -y` 安装 > ## 这里仅列出我用过的,其他的自行 `Google`、`Baidu`、`Bing`... - ## `perl` 命令 > ## 我服务器是 `CentOS`,默认安装了 `perl`。其它的就不清楚了,如果没有,请自行 `Google`、`Baidu`、`Bing` “如何安装 perl” - ## 能正常访问 `Google Drive`(这点不再累述 # 2. 获取脚本 ``` #下载脚本 wget https://raw.githubusercontent.com/circulosmeos/gdown.pl/master/gdown.pl #给予执行权限 chmod +x gdown.pl ``` # 3. 使用此工具 ## 3-1. 语法介绍 ``` ./gdown.pl "Google Drive 文件地址" "保存的文件名" ``` ## 3-2. 使用实例 > ### 举个栗子,我要下载 `https://drive.google.com/uc?id=1GEnu4VboPXz7cLpFaS3Cd7QZZNtFYHgz&export=download` 里的文件,并把它命名为 `[Unofficial]LinageOS_16_mido.zip`,则执行以下命令: ``` ./gdown.pl "https://drive.google.com/uc?id=1GEnu4VboPXz7cLpFaS3Cd7QZZNtFYHgz&export=download" "[Unofficial]LinageOS_16_mido.zip" ``` ### 在我服务器的执行结果 ``` [root@google 8.8.8.8]# ./gdown.pl "https://drive.google.com/uc?id=1GEnu4VboPXz7cLpFaS3Cd7QZZNtFYHgz&export=download" "[Unofficial]LinageOS_16_mido.zip" Cannot open cookies file ‘gdown.cookie.temp’: No such file or directory --2018-10-04 12:19:49-- https://drive.google.com/uc?id=1GEnu4VboPXz7cLpFaS3Cd7QZZNtFYHgz&export=download Resolving drive.google.com (drive.google.com)... 216.58.219.46, 2607:f8b0:4007:807::200e Connecting to drive.google.com (drive.google.com)|216.58.219.46|:443... connected. HTTP request sent, awaiting response... 200 OK Length: unspecified [text/html] Saving to: ‘[Unofficial]LinageOS_16_mido.zip’ [ <=> ] 3,273 --.-K/s in 0s 2018-10-04 12:19:49 (26.2 MB/s) - ‘[Unofficial]LinageOS_16_mido.zip’ saved [3273] --2018-10-04 12:19:49-- https://docs.google.com/uc?export=download&confirm=Iqag&id=1GEnu4VboPXz7cLpFaS3Cd7QZZNtFYHgz Resolving docs.google.com (docs.google.com)... 216.58.219.46, 2607:f8b0:4007:807::200e Connecting to docs.google.com (docs.google.com)|216.58.219.46|:443... connected. HTTP request sent, awaiting response... 200 OK Length: unspecified [text/html] Saving to: ‘[Unofficial]LinageOS_16_mido.zip’ [ <=> ] 3,288 --.-K/s in 0s 2018-10-04 12:19:50 (36.2 MB/s) - ‘[Unofficial]LinageOS_16_mido.zip’ saved [3288] --2018-10-04 12:19:50-- https://docs.google.com/uc?export=download&confirm=ZJ6h&id=1GEnu4VboPXz7cLpFaS3Cd7QZZNtFYHgz Resolving docs.google.com (docs.google.com)... 216.58.219.46, 2607:f8b0:4007:807::200e Connecting to docs.google.com (docs.google.com)|216.58.219.46|:443... connected. HTTP request sent, awaiting response... 302 Moved Temporarily Location: https://doc-10-bg-docs.googleusercontent.com/docs/securesc/ha0ro937gcuc7l7deffksulhg5h7mbp1/ro9vcgvpcd5dctqcoph9mpgbdggu27fj/1538625600000/18164488606473695945/*/1GEnu4VboPXz7cLpFaS3Cd7QZZNtFYHgz?e=download [following] Warning: wildcards not supported in HTTP. --2018-10-04 12:19:50-- https://doc-10-bg-docs.googleusercontent.com/docs/securesc/ha0ro937gcuc7l7deffksulhg5h7mbp1/ro9vcgvpcd5dctqcoph9mpgbdggu27fj/1538625600000/18164488606473695945/*/1GEnu4VboPXz7cLpFaS3Cd7QZZNtFYHgz?e=download Resolving doc-10-bg-docs.googleusercontent.com (doc-10-bg-docs.googleusercontent.com)... 216.58.219.33, 2607:f8b0:4007:807::2001 Connecting to doc-10-bg-docs.googleusercontent.com (doc-10-bg-docs.googleusercontent.com)|216.58.219.33|:443... connected. HTTP request sent, awaiting response... 200 OK Length: unspecified [application/zip] Saving to: ‘[Unofficial]LinageOS_16_mido.zip’ [ <=> ] 571,841,706 100MB/s in 6.8s 2018-10-04 12:19:57 (80.6 MB/s) - ‘[Unofficial]LinageOS_16_mido.zip’ saved [571841706] [root@google 8.8.8.8]# ls gdown.pl [Unofficial]LinageOS_16_mido.zip [root@google 8.8.8.8]# ``` > #本文由 [现在网](https://nowtime.cc) 原创,转载请注明原文链接:[https://nowtime.cc/linux/473.html](https://nowtime.cc/linux/473.html) 标签: Linux, CentOS, Google, GitHUb, Ubuntu, Google Drive
谢谢
太给力了!