Enhance video metadata extraction and update player template to display additional information

This commit is contained in:
Mikhail Yevchenko
2026-04-01 18:25:35 +00:00
parent 9bbbbc5a65
commit 3ec080dbd3
3 changed files with 250 additions and 8 deletions
+37 -4
View File
@@ -138,14 +138,47 @@ def _get_video_info(video_url: str) -> dict:
def get_stream_info(video_url: str) -> dict:
"""Get video info (title, hls_url, thumbnail)."""
"""Get video info with all available metadata."""
info = _get_video_info(video_url)
return {
# Extract useful metadata from raw_info
raw = info.get("raw_info", {})
metadata = {
"title": info["title"],
"hls_url": info["hls_url"],
"direct_url": info.get("direct_url"),
"thumbnail": info["thumbnail"],
"hls_url": info.get("hls_url"),
"direct_url": info.get("direct_url"),
# Additional metadata
"description": raw.get("description"),
"uploader": raw.get("uploader"),
"uploader_url": raw.get("uploader_url"),
"duration": raw.get("duration"),
"upload_date": raw.get("upload_date"),
"view_count": raw.get("view_count"),
"like_count": raw.get("like_count"),
"dislike_count": raw.get("dislike_count"),
"comment_count": raw.get("comment_count"),
"age_limit": raw.get("age_limit"),
"categories": raw.get("categories"),
"tags": raw.get("tags"),
"language": raw.get("language"),
"license": raw.get("license"),
"channel": raw.get("channel"),
"channel_url": raw.get("channel_url"),
"channel_id": raw.get("channel_id"),
"extractor": raw.get("extractor"),
"extractor_key": raw.get("extractor_key"),
"display_id": raw.get("display_id"),
"url": raw.get("url"),
"fulltitle": raw.get("fulltitle"),
"duration_string": raw.get("duration_string"),
"resolution": raw.get("resolution"),
"format": raw.get("format"),
"format_note": raw.get("format_note"),
"filesize": raw.get("filesize"),
"filesize_approx": raw.get("filesize_approx"),
}
return metadata
def get_hls_playlist(video_url: str) -> str: