Created
October 1, 2017 14:30
-
-
Save fuzzmonkey/88a3311e989bd396e2a2f53ce72f2a87 to your computer and use it in GitHub Desktop.
Ruby script for downloading a file from google drive given a public file id
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# usuage ruby download_google_drive.rb <FILE ID> | |
fileid = ARGV[0] | |
confirm_code = `wget --save-cookies 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\/p'` | |
`wget --load-cookies cookies.txt 'https://docs.google.com/uc?export=download&confirm=#{confirm_code}&id=#{fileid}'` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment