Python: download files from google drive using url

前端 未结 9 1327
眼角桃花
眼角桃花 2020-11-27 11:51

I am trying to download files from google drive and all I have is the drive\'s URL.

I have read about google API that talks about some drive_service and

9条回答
  •  醉梦人生
    2020-11-27 12:41

    Having had similar needs many times, I made an extra simple class GoogleDriveDownloader starting on the snippet from @user115202 above. You can find the source code here.

    You can also install it through pip:

    pip install googledrivedownloader
    

    Then usage is as simple as:

    from google_drive_downloader import GoogleDriveDownloader as gdd
    
    gdd.download_file_from_google_drive(file_id='1iytA1n2z4go3uVCwE__vIKouTKyIDjEq',
                                        dest_path='./data/mnist.zip',
                                        unzip=True)
    

    This snippet will download an archive shared in Google Drive. In this case 1iytA1n2z4go3uVCwE__vIKouTKyIDjEq is the id of the sharable link got from Google Drive.

提交回复
热议问题