DEV Community


Posted on • Updated on

Download Files From Google Drive With curl/wget

Sometimes we need to use curl/wget to download files from Google Drive from scripts. In terms of small file, we don't have any issues, but on the other hand, with a big file(especially download pre-trained model) needs to download the file manually which is very annoyed.

In this my last post in 2019, I'll show you how to avoid downloading files manually.

Small file

This is my Processing sketch and the size of the file is 2MB.
In the link, 0B-0p-MTxJBSCU2lwaGNUZ3VYSG8 is fileId

$ wget "<fileId>" -O <fileName>
Enter fullscreen mode Exit fullscreen mode
$ wget "" -O myProcessing_sketch.mp4
Enter fullscreen mode Exit fullscreen mode

Alt Text

Big file

In terms of a big file, the way to download is a little bit complicated since Google Drive tries to scan the file to make things secure.

In this case, we will try to download M2Det's pre-trained model.

GitHub logo VDIGPKU / M2Det

M2Det: A Single-Shot Object Detector based on Multi-Level Feature Pyramid Network


Codebase for AAAI2019 "M2Det: A Single-Shot Object Detector based on Multi-Level Feature Pyramid Network" [Paper link]

Author: Qijie Zhao. Date: 19/01/2019




Beyond scale variation, appearance-complexity variation should be considered too for the object detection task, due to that the object instances with similar size can be quite different.

To solve this, we extend multi-scale detection fashions with a new dimension: multi-level. Deeper level learns features for objects with more appearance-complexity variation(e.g., pedestrian), while shallower level learns features for more simplistic objects(e.g., traffic light).

1, We propose Multi Level FPN:

2, Based on MLFPN, we propose a single-shot object detector: M2Det, which represents the Multi-Level Multi-Scale Detector.


a. Construct the base feature:

We use the output of FFMv1(Feature Fusion Module v1) to construct the base feature. The size is fixed as…

To download a big file, we will need 4 digits which are code in a shell script. Then we also need fileId and fileName as well.

curl -sc /tmp/cookie "${fileId}" > /dev/null
code="$(awk '/_warning_/ {print $NF}' /tmp/cookie)"  
curl -Lb /tmp/cookie "${code}&id=${fileId}" -o ${fileName} 
Enter fullscreen mode Exit fullscreen mode

Happy New Year from NYC

Buy Me A Coffee

Top comments (2)

christianbueno1 profile image
Christian Bueno

Thanks pal, very useful information, go ahead.

0xkoji profile image