A high-performance Python utility that reads Video IDs from a CSV file, scrapes rich metadata (including hidden music data like Record Labels) using yt-dlp, and exports the results directly to a Google Sheet.
- Rich Metadata Extraction: Fetches Artist, Track Title, Duration, Record Label, and Category.
- Concurrency: Uses multi-threading to process multiple videos simultaneously.
- Robust UI: Features a beautiful CLI interface with progress bars, spinners, and summary tables using the
richlibrary. - Cloud Sync: Automatically handles Google Sheets connections and batch uploads.
- Python 3.7+
- A Google Cloud Project with Sheets API & Drive API enabled.
- A Service Account JSON key file (
credentials.json).
-
Clone or download this repository.
-
Install dependencies:
pip install pandas gspread yt-dlp rich
- Setup Credentials:
- Place your Google Service Account key in the project folder and rename it to
credentials.json. - Share your target Google Sheet with the
client_emailfound insidecredentials.json.
- Prepare your CSV:
- Ensure your input file is named
Dom Snow-videos.csv(or update theINPUT_CSV_FILEvariable in the script). - The first column must contain the YouTube Video IDs.
- Run the script:
python video_processor.py
You can adjust the following variables at the top of video_processor.py:
INPUT_CSV_FILE: The source file containing Video IDs.GOOGLE_SHEET_NAME: The name of your Google Spreadsheet.TARGET_TAB_NAME: The specific tab name (e.g., 'yt_101225').MAX_WORKERS: Number of concurrent download threads (Default: 5).
The script generates the following columns in your Google Sheet:
| Column | Description |
|---|---|
| Video ID | The unique YouTube ID. |
| URL | Direct link to the video. |
| Artist | The detected artist (from music metadata or channel name). |
| Title/Track | The detected track name or video title. |
| Duration | Length of the video (HH:MM:SS). |
| Record Label | Extracted from video description/tags if available. |
| Category | YouTube category (e.g., Music, Gaming). |
| Upload Date | The date the video was published. |
- This script uses
yt-dlpto scrape data. While powerful, it is slower than the official API but provides more detailed music data. - To avoid rate limits,
MAX_WORKERSis set to 5. Increasing this significantly may cause YouTube to temporarily block your IP.