Download Google Drive files with WGET
Last Updated by Code Sport. Filed under linux, ubuntuOverview: How to Download Google Drive Files from the Linux Command Line…
If you need to update Claymore remotely (i.e., there is no physical access to your mining rig’s USB ports), the following options allow you to download Google Drive files via the command line in 1 line of code.
Note: These scenarios work on publicly shared Google Drive links, where no user authentication is required.
$ wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O FILENAMEWhere: -O = name of file to write (save) the download
For large files, google drive requires a download confirm code, which is stored in a cookie. See this StackOverflow solution for details. Here is the command line directive:
$ 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=FILEID' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=FILEID" -O FILENAME && rm -rf /tmp/cookies.txtsource: https://gist.github.com/iamtekeste/3cdfd0366ebfd2c0d805#gistcomment-2316906
$ nano ~/.bash_aliases
function gdrive_download () { CONFIRM=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate "https://docs.google.com/uc?export=download&id=$1" -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p') wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$CONFIRM&id=$1" -O $2 rm -rf /tmp/cookies.txt }
Usage:
$ gdrive_download long_google_drive_file_id filename.extsource: https://gist.github.com/iamtekeste/3cdfd0366ebfd2c0d805#gistcomment-2359248