extract_youtube_comments
Extract comments from any YouTube video with support for pagination, sorting by popular or recent, and including replies. Optionally save the full comment list to a JSON file.
Instructions
Extract YouTube video comments. Supports pagination via comment_offset. Use output_path to persist the full unsliced comment list to disk as JSON; the response is then slimmed to metadata only.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | YouTube video URL | |
| sort_by | No | 'popular'|'recent' | popular |
| max_comments | No | Max comments to retrieve (1-1000) | |
| comment_offset | No | Number of comments to skip (for pagination) | |
| include_replies | No | Include reply comments | |
| content_offset | No | Start position for content (0-indexed) | |
| content_limit | No | Max characters to return (0=unlimited) | |
| output_path | No | Absolute file path (auto .json extension) to persist the full unsliced/untruncated comment list. When set, the complete comment array is written to disk BEFORE the internal token-limit reduction, and the response is slimmed (extracted_data.comments removed but comment_count etc. kept). | |
| include_content_in_response | No | When True (with output_path set), keep the comment list in the response too. Note: the response copy is still subject to content_limit/content_offset slicing and the token-limit comment-array reduction; only the on-disk file holds the full list. Defaults to False. | |
| overwrite | No | Overwrite an existing output file at output_path. Defaults to False. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||