xxxxxxxxxx
import yt_dlp
video = "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
with yt_dlp.YoutubeDL({"quiet": True}) as ydl:
info_dict = ydl.extract_info(video, download=False)
# Print each information in the info_dict
for key, value in info_dict.items():
# Do something with the info dict
pass
yt_dlp info keys:
title: The title of the video
url: The direct URL of the video file
description: The description of the video
thumbnail: The URL of the thumbnail image of the video
formats: A list of dictionaries containing information about each available format of the video
uploader: The name of the uploader of the video
channel_id: The ID of the channel that uploaded the video
duration: The duration of the video in seconds
view_count: The number of views of the video
like_count: The number of likes of the video
dislike_count: The number of dislikes of the video
average_rating: The average rating of the video
tags: A list of tags associated with the video
categories: A list of categories associated with the video