Enhance video metadata extraction and update player template to display additional information
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user