Fix comment extractor args separator (, → ;) and use comment_sort=top
yt-dlp separates extractor args with ; not ,. The malformed arg was causing max_comments to parse as a garbage string, fetching ~1 comment. Also swap max_comment_depth (not a real YouTube extractor arg) for comment_sort=top to get highest-engagement comments first. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -391,7 +391,7 @@ def fetch_video_comments(youtube_video_id: str, max_comments: int = 20) -> list[
|
||||
"yt-dlp", url,
|
||||
"--dump-json",
|
||||
"--write-comments",
|
||||
"--extractor-args", f"youtube:max_comments={max_comments},max_comment_depth=1",
|
||||
"--extractor-args", f"youtube:max_comments={max_comments};comment_sort=top",
|
||||
"--no-download",
|
||||
"--no-playlist",
|
||||
"--quiet",
|
||||
|
||||
Reference in New Issue
Block a user