A lightweight CLI tool to extract YouTube comment data without the overhead. Built for speed, complex pattern recognition.
- Fetch paginated comments from a YouTube video
- Support for standard URLs, short links, and YouTube Shorts
- Extract:
authornametextof the commentreply_countlikescountpfp_url(author profile picture)
- Modular architecture for easier maintenance
- Export comments to
JSON
Python 3.xrequests
Install dependencies:
pip install requestsRun the script by passing a YouTube URL or Video ID as a positional argument:
python main.py https://www.youtube.com/watch?v=dQw4w9WgXcQ| Argument | Description | Default |
|---|---|---|
input |
YouTube video URL, Shorts URL, or ID | (Required) |
--limit |
Number of comment pages to fetch | 5 |
--output |
Target JSON filename | comments.json |
-v, --verbose |
Print author pfp_url in the console |
False |
--minimal |
Remove type key from the saved JSON file |
False |
helpers.py: Logic forextract_video_idandJSONI/O operations.scraper.py: Managesrequests.SessionandYTScraperorchestration.parser.py: UsesCommentParserto scrapeyoutubei/v1/nextJSON payloads.generator.py: Generates the initial continuation token.
Page 1...
[standard] User123: Nice video!
└── Reply count(s): 5
└── Like count(s): 42
- Add threaded replies support
- Add
CSVexport support - Improve request handling and performance
