I want to download data from google drive link shared by someone using google colab. I am a new user of colab and I don't know how to do that. the links are
x_train: https://drive.google.com/open?id=1cUaIEd9-MLJHFGjLz5QziNvfBtYygplX
y_train: https://drive.google.com/open?id=1hv24Ufiio9rBeSqgnNoM3dr5sVGwOmBy
x_test: https://drive.google.com/open?id=1AH9lKHT5P2oQLz8SGMRPWs_M9wIM2ZRH
y_test: https://drive.google.com/open?id=1i4_azocSDuU3TcDf3OSHO1vF0D5-xMU6
Thanks in advance
You can use gdown
if the file is shared publicly.
!gdown 1cUaIEd9-MLJHFGjLz5QziNvfBtYygplX
If it's shared to you only, you need to use pydrive
# Install the PyDrive wrapper & import libraries.
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
from google.colab import auth
from oauth2client.client import GoogleCredentials
# Authenticate and create the PyDrive client.
auth.authenticate_user()
gauth = GoogleAuth()
gauth.credentials = GoogleCredentials.get_application_default()
drive = GoogleDrive(gauth)
file_id = '1cUaIEd9-MLJHFGjLz5QziNvfBtYygplX'
downloaded = drive.CreateFile({'id':file_id})
downloaded.FetchMetadata(fetch_all=True)
downloaded.GetContentFile(downloaded.metadata['title'])
If they share a folder, it's too long so I made it short in my library.
!pip install kora
from kora import drive
drive.download_folder('1HvIeNhqtFVllXFWzH5NawDdnIfgGDwCK')