0
!wget https://drive.google.com/file/d/1BeeBFUY6BS-H66NMcx3hF1rwE3Yi3p3z/view?usp=sharing
!mv view?usp=sharing HorizonZero.png

# Downloading lena.bmp
!wget https://drive.google.com/file/d/1sOxv4LHEuGNnZJEg7gl2ZiehdKU4ojjF/view?usp=sharing
!mv view?usp=sharing lena.bmp
``````````````````````````````````````````````````````````````````
**the image link for horizon.png is actually**
https://drive.google.com/file/d/1gGltsV4k7z3akTqB726FWzi5tUnNSCqf/view?usp=sharing
 but !mv i added from view
`````````````````````````````````````````````````````````````````````````
**the output should be like this**

--2020-08-01 19:30:57--  https://drive.google.com/uc?id=1Djfm4PqE7Su4WqEdZKiGL-8HtrbVBuMm
Resolving drive.google.com (drive.google.com)... 74.125.203.139, 74.125.203.113, 74.125.203.100, ...
Connecting to drive.google.com (drive.google.com)|74.125.203.139|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://doc-08-40-docs.googleusercontent.com/docs/securesc/ha0ro937gcuc7l7deffksulhg5h7mbp1/91pcoqqtp058dfpuoqspvbr6s66n7q9t/1596310200000/05356688754188258246/*/1Djfm4PqE7Su4WqEdZKiGL-8HtrbVBuMm [following]
Warning: wildcards not supported in HTTP.
--2020-08-01 19:30:57--  https://doc-08-40-docs.googleusercontent.com/docs/securesc/ha0ro937gcuc7l7deffksulhg5h7mbp1/91pcoqqtp058dfpuoqspvbr6s66n7q9t/1596310200000/05356688754188258246/*/1Djfm4PqE7Su4WqEdZKiGL-8HtrbVBuMm
Resolving doc-08-40-docs.googleusercontent.com (doc-08-40-docs.googleusercontent.com)... 74.125.203.132, 2404:6800:4008:c03::84
Connecting to doc-08-40-docs.googleusercontent.com (doc-08-40-docs.googleusercontent.com)|74.125.203.132|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 111636 (109K) [image/png]
Saving to: ‘uc?id=1Djfm4PqE7Su4WqEdZKiGL-8HtrbVBuMm’

uc?id=1Djfm4PqE7Su4 100%[===================>] 109.02K  --.-KB/s    in 0.002s  

2020-08-01 19:30:58 (57.7 MB/s) - ‘uc?id=1Djfm4PqE7Su4WqEdZKiGL-8HtrbVBuMm’ saved [111636/111636]

--2020-08-01 19:31:07--  https://drive.google.com/uc?id=19xZhsjs_r0tLwtu_Wl5DB5rG26dhw069
Resolving drive.google.com (drive.google.com)... 74.125.204.139, 74.125.204.113, 74.125.204.100, ...
Connecting to drive.google.com (drive.google.com)|74.125.204.139|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://doc-10-40-docs.googleusercontent.com/docs/securesc/ha0ro937gcuc7l7deffksulhg5h7mbp1/frtrtg5v8nd6vf0ff6cs1dh3jvqv28ui/1596310200000/05356688754188258246/*/19xZhsjs_r0tLwtu_Wl5DB5rG26dhw069 [following]
Warning: wildcards not supported in HTTP.
--2020-08-01 19:31:07--  https://doc-10-40-docs.googleusercontent.com/docs/securesc/ha0ro937gcuc7l7deffksulhg5h7mbp1/frtrtg5v8nd6vf0ff6cs1dh3jvqv28ui/1596310200000/05356688754188258246/*/19xZhsjs_r0tLwtu_Wl5DB5rG26dhw069
Resolving doc-10-40-docs.googleusercontent.com (doc-10-40-docs.googleusercontent.com)... 74.125.203.132, 2404:6800:4008:c03::84
Connecting to doc-10-40-docs.googleusercontent.com (doc-10-40-docs.googleusercontent.com)|74.125.203.132|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 263222 (257K) [image/bmp]        **it is recognized........................**
Saving to: ‘uc?id=19xZhsjs_r0tLwtu_Wl5DB5rG26dhw069’

uc?id=19xZhsjs_r0tL 100%[===================>] 257.05K  --.-KB/s    in 0.003s  

2020-08-01 19:31:08 (79.6 MB/s) - ‘uc?id=19xZhsjs_r0tLwtu_Wl5DB5rG26dhw069’ saved [263222/263222]



````````````````````````````````````````````````````````````
**but my output I coming like this plz help**

--2021-06-01 07:17:27-- https://drive.google.com/file/d/1BeeBFUY6BS-H66NMcx3hF1rwE3Yi3p3z/view?usp=sharing 解决 drive.google.com (drive.google.com) ... 74.125.31.138, 74.125.31.102, 74.125.31.113, ... 正在连接到 drive.google.com (drive.google.com)|74.125.31.138|:443... 已连接。已发送 HTTP 请求,等待响应... 302 临时移动位置:https ://accounts.google.com/ServiceLogin?service=wise&passive=1209600&continue=https://drive.google.com/file/d/1BeeBFUY6BS-H66NMcx3hF1rwE3Yi3p3z/ view?usp%3Dsharing&followup=https://drive.google.com/file/d/1BeeBFUY6BS-H66NMcx3hF1rwE3Yi3p3z/view?usp%3Dsharing [关注] --2021-06-01 07:17:27-- https://accounts.google.com/ServiceLogin?service=wise&passive=1209600&continue=https://drive.google.com/file/d/1BeeBFUY6BS-H66NMcx3hF1rwE3Yi3p3z/view?usp%3Dsharing&followup=https://drive.google。 com/file/d/1BeeBFUY6BS-H66NMcx3hF1rwE3Yi3p3z/view?usp%3Dsharing 正在 解析 accounts.google.com (accounts.google.com)... 108.177.12.84, 2607:f8b0:400c:c0b::54 正在连接到 accounts.google .com (accounts.google.com)|108.177.12.84|:443... 已连接。已发送 HTTP 请求,正在等待响应... 200 OK 长度:未检测到未指定 [text/html] .....?????? 保存到:'view?usp=sharing'</p>

view?usp=sharing [ <=> ] 65.35K --.-KB/s in 0.001s

2021-06-01 07:17:27 (104 MB/s) - 'view?usp=sharing' 已保存 [66920]

--2021-06-01 07:17:27-- https://drive.google.com/file/d/1sOxv4LHEuGNnZJEg7gl2ZiehdKU4ojjF/view?usp=sharing 解决 drive.google.com (drive.google.com).. . 173.194.217.101, 173.194.217.113, 173.194.217.139, ... 连接到 drive.google.com (drive.google.com)|173.194.217.101|:443... 已连接。已发送 HTTP 请求,等待响应... 302 临时移动位置:https://accounts.google.com/ServiceLogin?service=wise&passive=1209600&continue=https://drive.google.com/file/d/1sOxv4LHEuGNnZJEg7gl2ZiehdKU4ojjF/view? usp%3Dsharing&followup=https://drive.google.com/file/d/1sOxv4LHEuGNnZJEg7gl2ZiehdKU4ojjF/view?usp%3Dsharing [关注] --2021-06-01 07:17:27-- https://accounts.google.com/ServiceLogin?service=wise&passive=1209600&continue=https://drive.google.com/file/d/1sOxv4LHEuGNnZJEg7gl2ZiehdKU4ojjF/view?usp%3Dsharing&followup=https://drive.google.com/ file/d/1sOxv4LHEuGNnZJEg7gl2ZiehdKU4ojjF/view?usp%3Dsharing 正在 解析 accounts.google.com (accounts.google.com)... 74.125.31.84, 2607:f8b0:400c:c03::54 正在连接到 accounts.google.com (accounts .google.com)|74.125.31.84|:443... 已连接。已发送 HTTP 请求,正在等待响应... 200 OK 长度:未指定 [text/html] ### 未检测到..................................................... 保存到:'view?usp=sharing'</p>

view?usp=sharing [ <=> ] 65.40K --.-KB/s in 0.002s

2021-06-01 07:17:27 (26.4 MB/s) - 'view?usp=sharing' 已保存 [66972]


**the problem here I the image is not getting recognized in google colobatory it is coming [text/html] but it should come [png /jpg/bmp]please help to get over this problm**
4

1 回答 1

0

以下命令应满足您的需求:

!wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=1BeeBFUY6BS-H66NMcx3hF1rwE3Yi3p3z' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=1BeeBFUY6BS-H66NMcx3hF1rwE3Yi3p3z" -O HorizonZero.png && rm -rf /tmp/cookies.txt

如果您想知道它的作用,您会看到它使用 Google Drive 文件 ID(我从您的问题本身中获取)配置下载,将 Horizo​​nZero.png 设置为输出文件,使用 --keep 指定的 cookies.txt 文件-session-cookie 在下载过程中保存 cookie 信息(如果你的文件很大,这很有用),启用下载的自动确认,也通过 --no-check-certificate 跳过证书检查,并在下载结束后结束。

于 2021-06-01T09:16:01.287 回答