Skip to main content

YouTube Scraper Tool

The YouTube Scraper Tool is a custom tool that allows the Newsletter AI Agent to find relevant video content on YouTube using an Apify actor. It provides a way to gather video-based information and insights related to the specified topic.

Overview

The YouTube Scraper Tool is primarily used by the Researcher Agent to gather video content about the specified topic. It provides a flexible interface for searching YouTube and extracting structured data from videos, channels, and playlists.

Implementation

The YouTube Scraper Tool is implemented as a CrewAI BaseTool that interacts with an Apify YouTube scraper actor. Here’s the implementation:

Parameters

The YouTube Scraper Tool accepts the following parameters:

Usage

The YouTube Scraper Tool is used by the Researcher Agent to gather video content about the specified topic:

Return Value

The tool returns a list of YouTube videos, where each video is a dictionary containing information about the video, including:
  • title: The title of the video
  • url: The URL of the video
  • description: The description of the video
  • channelName: The name of the channel that uploaded the video
  • channelUrl: The URL of the channel
  • viewCount: The number of views the video has
  • publishedAt: The date the video was published
  • duration: The duration of the video
  • Additional metadata about the video

Apify Integration

The tool uses an Apify YouTube scraper actor, which provides several advantages:
  1. Scalability: The actor can handle large numbers of YouTube searches efficiently
  2. Reliability: The actor is designed to handle rate limiting and other issues that can arise when scraping YouTube
  3. Structured Data: The actor returns YouTube videos in a structured format that is easy to process
  4. Advanced Filtering: The actor supports advanced filtering options to narrow down search results

Configuration

To use the YouTube Scraper Tool, you need to set up the following environment variables:

Next Steps