Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rudokemper/download-gdrive-media-from-csv
A Python script that uses the Google API to download all Drive files from a column in an input CSV
https://github.com/rudokemper/download-gdrive-media-from-csv
Last synced: 19 days ago
JSON representation
A Python script that uses the Google API to download all Drive files from a column in an input CSV
- Host: GitHub
- URL: https://github.com/rudokemper/download-gdrive-media-from-csv
- Owner: rudokemper
- Created: 2023-10-26T16:29:33.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2023-10-26T18:42:29.000Z (about 1 year ago)
- Last Synced: 2024-12-12T14:39:43.388Z (29 days ago)
- Language: Python
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Google Drive Media Downloader and CSV Updater
This Python script is designed to download media files from Google Drive and update a CSV file with the filenames of the downloaded files.
**How it works**
1. The script reads a CSV file and identifies a column that contains Google Drive links to media files.
2. It authenticates with the Google Drive API using OAuth 2.0. If a token is already available and valid, it uses that. Otherwise, it prompts the user to log in and authorizes the application.
3. The script then iterates over each row in the CSV file, extracts the Google Drive ID from the link, and downloads the corresponding file. If the file already exists in the specified directory, it skips the download.
4. After downloading the file, it updates the row in the CSV with the filename of the downloaded file and writes the updated row to a new CSV file.
5. The process repeats until all rows in the CSV file have been processed. The script then prints a message indicating that all media files have been downloaded and the CSV file has been updated.
**Requirements**This script requires the following Python libraries:
- csv
- io
- os
- pickle
- magic
- requests
- google_auth_oauthlib
- google.auth.transport.requests
- googleapiclient.discovery
- googleapiclient.httpBefore running the script, make sure to define your input and output CSV filenames and columns, and replace 'credentials.json' with the path to your Google API credentials file.