Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # How does it work?
- # Get cookie file and html code with curl.
- # Pipe html to grep and sed and search for file name
- # Get confirm code from cookie file with awk.
- # Finally download file with cookie enabled, confirm code and filename
- # gDriveDL "https://drive.google.com/uc?export=download&id=0i_rjRJFN5EmftWVySUmCRjMtHDt"
- # gDriveDL "https://drive.google.com/open?id=0i_rjRJFN5EmftWVySUmCRjMtHDt"
- # gDriveDL "https://drive.google.com/file/d/0i_rjRJFN5EmftWVySUmCRjMtHDt/view"
- # gDriveDL "https://drive.google.com/file/d/0i_rjRJFN5EmftWVySUmCRjMtHDt/edit?usp=sharing"
- ggURL='https://drive.google.com/uc?export=download'
- ggID="$(sed 's/\W/\n/g' <<<"$1" | egrep -o '\w{26,30}')"; echo -n "${ggID} "
- gfNM="$(curl -sc /tmp/gcokie "${ggURL}&id=${ggID}" | grep -o '="uc-name.*</span>' | sed 's/.*">//;s/<.a> .*//')"
- gKD="$(awk '/_warning_/ {print $NF}' /tmp/gcokie)"; echo -n "${gKD} "
- curl -sLb /tmp/gcokie "${ggURL}&confirm=${gKD}&id=${ggID}" -o "${gfNM}" && echo "${gfNM}"
Add Comment
Please, Sign In to add comment