gdown.sh — google drive download large files from linux bash
#!/bin/bash # usage: gdown fileid /path/to/filename fileid=$1 filename=$2 curl -sLc /tmp/gdcookie "https://drive.google.com/uc?export=download&id=${fileid}" > /dev/null curl -sLb /tmp/gdcookie "https://drive.google.com/uc?export=download&confirm=`awk '/download/ {print $NF}' /tmp/gdcookie`&id=${fileid}" --create-dirs -o ${filename} rm -f /tmp/gdcookie
gdrive_download.sh
# gdrive_download FILEID FILENAME # where FILEID is the id in get shareable link in gdrive 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 }
download.sh
#!/bin/bash # Script for downloading file from remote server. # Usage: ./download.sh gdrive <FILE_ID> <FILENAME> function gdrive() { 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 } if [ $# -eq 0 ]; then echo "Usage: $(basename $0) {gdrive}" echo "\t./download.sh gdrive <FILE_ID> <FILENAME>" exit fi if [ "$1" == "gdrive" ]; then $1 $2 $3 exit fi $1
Also see old post: https://tovld.com/archives/3570
Rating of article:
[Total: 1 Average: 5]