This terminal-based application allows you to scrape top-level comments from YouTube videos and export them to a CSV file. It also uses Gemini Flash 1.5 to analyze the sentiment of the comments.
- Export YouTube video comments to a CSV file
- Easily modify the target video by updating the video ID
- Integrate Gemini Flash 1.5 for comment sentiment analysis
-
Clone the repository
git clone https://github.com/toby-d-parsons/youtube-comments-analyzer.git
-
Navigate to the project directory
cd youtube-comments-analyzer -
Set up API keys:
- Create the files api_youtube.key and api_gemini.key.
- Paste your YouTube Data API key into api_youtube.key.
- Paste your Gemini API key into api_gemini.key.
For more information, see how to setup a Google Cloud API key and a Gemini API key
-
Update the string value for
app.run('W3id8E34cRQ')withinlib/youtube_comments_analyzer.rbto the URL video id of your choice -
Run the YouTube comments scraper:
ruby lib/youtube_comments_analyzer.rb
-
The comments will be saved in
export.csv, with each comment on a new line. The sentiment analysis of the comments will be printed in the console.