Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """Use this to grab the comments with a video:
- yt-dlp --write-comments <Insert Video's URL>"""
- ---------------------------------------------------------------------------------------------------------------------------------------
- """The comments.json file created by yt-dlp contains comments in JSON format, which is a structured way to store data. You can read and process this file using Python. Here’s a simple script to read and display the comments:
- Install the json library if you haven't already (it's included in the Python standard library, so you don't need to install anything extra).
- Read and display the comments using this script:
- import json"""
- # Open and read the comments file
- with open('comments.json', 'r', encoding='utf-8') as file:
- comments_data = json.load(file)
- # Extract and display the comments
- for comment in comments_data['comments']:
- print(f"Author: {comment['author']}")
- print(f"Comment: {comment['text']}\n")
- """See the following for more information:
- https://www.reddit.com/r/youtubedl/comments/rom9q4/is_there_a_way_to_download_the_youtube_comments/
- https://www.reddit.com/r/youtubedl/comments/1966cnt/asking_how_to_download_comments_youtube_in_the/"""
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement