diff --git a/app.py b/app.py index 8a016f1..4d62d1a 100644 --- a/app.py +++ b/app.py @@ -49,7 +49,37 @@ def player(): proxy_hls_url=proxy_hls_url, direct_url=stream_info.get("direct_url"), title=stream_info.get("title", "Video"), - thumbnail=stream_info.get("thumbnail") + thumbnail=stream_info.get("thumbnail"), + # Pass all metadata to template + description=stream_info.get("description"), + uploader=stream_info.get("uploader"), + uploader_url=stream_info.get("uploader_url"), + duration=stream_info.get("duration"), + duration_string=stream_info.get("duration_string"), + upload_date=stream_info.get("upload_date"), + view_count=stream_info.get("view_count"), + like_count=stream_info.get("like_count"), + dislike_count=stream_info.get("dislike_count"), + comment_count=stream_info.get("comment_count"), + age_limit=stream_info.get("age_limit"), + categories=stream_info.get("categories"), + tags=stream_info.get("tags"), + language=stream_info.get("language"), + license=stream_info.get("license"), + channel=stream_info.get("channel"), + channel_url=stream_info.get("channel_url"), + channel_id=stream_info.get("channel_id"), + extractor=stream_info.get("extractor"), + extractor_key=stream_info.get("extractor_key"), + display_id=stream_info.get("display_id"), + url=stream_info.get("url"), + fulltitle=stream_info.get("fulltitle"), + resolution=stream_info.get("resolution"), + format=stream_info.get("format"), + format_note=stream_info.get("format_note"), + filesize=stream_info.get("filesize"), + filesize_approx=stream_info.get("filesize_approx"), + hls_url=hls_url ) except Exception as e: logger.error(f"Error getting stream info: {e}") diff --git a/dlp.py b/dlp.py index 32d011c..fadf70c 100644 --- a/dlp.py +++ b/dlp.py @@ -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: diff --git a/templates/player.html b/templates/player.html index 51dc756..6a0dfe7 100644 --- a/templates/player.html +++ b/templates/player.html @@ -7,17 +7,18 @@ ← Back + + {% if thumbnail %} + {{ title }} + {% endif %} +

{{ title }}

+
+ + {% if description %} +
+

Description

+ {{ description }} +
+ {% endif %} + +
+

Video Information

+
+ {% if uploader %} + + {% endif %} + + {% if channel %} + + {% endif %} + + {% if duration_string %} + + {% endif %} + + {% if upload_date %} + + {% endif %} + + {% if view_count %} + + {% endif %} + + {% if like_count %} + + {% endif %} + + {% if comment_count %} + + {% endif %} + + {% if categories %} + + {% endif %} + + {% if language %} + + {% endif %} + + {% if extractor %} + + {% endif %} + + {% if resolution %} + + {% endif %} + + {% if format %} + + {% endif %} + + {% if filesize_approx %} + + {% endif %} +
+
+ + {% if tags %} +
+

Tags

+
+ {% for tag in tags %} + {{ tag }} + {% endfor %} +
+
+ {% endif %} + + {% if hls_url %} +
+

Stream URLs

+
+ + +
+ {% if direct_url %} +
+ + +
+ {% endif %} +
+ {% endif %} + - + \ No newline at end of file