For comments on a video:
There are plenty of ways to do it, but these fit into my workflow. Using
yt-dlp to grab video comments:
Get a .json file with the comments:
Code:
yt-dlp --no-config --no-download --get-comments -o comments.json <youtube url>
Create an easily viewable list of the comments:
Code:
jq -r '.comments[] | "\(.author) - \(._time_text)\nhttps://youtube.com/channel/\(.author_id) \n\(.text)\n"' comments.json > comments.txt
WARNING: Don't share the .json info file that yt-dlp creates without scrubbing it for personal data first. Your IP is visible in the googlevideo.com urls located in the file!
For livestream chats:
Code:
chat_downloader <youtube url> --message_groups "messages superchat tickers banners donations engagement purchases mode_changes deleted bans placeholder" --output outputfilename.json | tee -a outputfilename.txt
Code:
chat_downloader <twitch url> --message_groups "messages bans deleted_messages hosts room_states user_states notices chants other bits subscriptions upgrades raids rituals mods colours commercials vips charity" --output outputfilename.json | tee -a outputfilename.txt
There is a way to do this with yt-dlp, but I don't have it handy. Chat-downloader is useful because it can grab the live chat as it happens, so you can see messages before they get swept. It can also grab a post-stream copy of the chat the same as yt-dlp can do.