Skip to content

Latest commit

 

History

History
50 lines (28 loc) · 1.69 KB

File metadata and controls

50 lines (28 loc) · 1.69 KB

Scraping YouTube Reviews Using the YouTube API

This project involves scraping captions or transcripts from YouTube videos using the YouTube Data API. It retrieves captions for either individual videos or entire playlists, storing the extracted data into a CSV file.

Overview

The Python script utilizes the googleapiclient library to interact with the YouTube Data API v3 for fetching video captions. Additionally, it utilizes the youtube_transcript_api library to access and retrieve the captions.

Installation

To run the script, follow these steps:

  1. Install the necessary Python packages:

    pip install google-api-python-client youtube-transcript-api
  2. Obtain a YouTube Data API key from the Google Cloud Console:

  3. Replace 'YOUR_API_KEY' in the Python script (Youtube.py) with your obtained API key.

Usage

The script can be used to scrape captions for either a single video or a playlist.

Usage for Single Video:

To fetch captions for a single video, modify the playlist_or_video_ids variable in Youtube.py with the desired video ID (not within a list).

playlist_or_video_ids = "YOUR_VIDEO_ID"

Run the script using the terminal with the following command

    python Youtube.py 

To fetch the captions modify the following code

    playlist_or_video_ids = ["YOUR_PLAYLIST_ID"]

Feel free to customize and expand upon this README file to include additional information, setup instructions, or any other relevant details pertaining to your project's requirements and usage.