This repository contains a script that scrapes comments from YouTube videos using the YouTube Data API v3.
- Python 3.11.0
- A Google account with access to the YouTube Data API v3
- Clone this repository.
- Install the required dependencies by running
pip install -r requirements.txt
. - Follow the instructions here to create a project, enable the YouTube Data API v3, and obtain an API key.
- Set the
YOUTUBE_API_KEY
environment variable to your API key.
To scrape comments from a video, run the script with the video ID as an argument:
python scraper.py VIDEO_ID
you can see it in action at https://rahim-khan.azurewebsites.net/
The script will output the comments to a file named comments_VIDEO_ID.txt
.
This project is licensed under the MIT License. See the LICENSE file for details.