diff --git a/revivetube.py b/revivetube.py index 076c8c2..24cc78b 100644 --- a/revivetube.py +++ b/revivetube.py @@ -196,7 +196,6 @@ def index(): - @app.route("/watch", methods=["GET"]) def watch(): video_id = request.args.get("video_id") @@ -213,6 +212,7 @@ def watch(): is_wii = "wii" in user_agent and "wiiu" not in user_agent try: + # Metadaten des Videos abrufen response = requests.get(f"http://localhost:5000/video_metadata/{video_id}", timeout=20) if response.status_code == 200: metadata = response.json() @@ -221,6 +221,7 @@ def watch(): except requests.exceptions.RequestException as e: return f"Can't connect to Metadata-API: {str(e)}", 500 + # Kommentare des Videos abrufen comments = [] try: comments = get_video_comments(video_id) @@ -228,6 +229,35 @@ def watch(): print(f"Video-Comments Error: {str(e)}") comments = [] + # Kanal-Logo und Abonnentenanzahl über die SuperPlayCounts API abrufen + channel_logo_url = "" + subscriber_count = "Unbekannt" + try: + channel_id = metadata['channelId'] + api_url = f"https://api-superplaycounts.onrender.com/api/youtube-channel-counter/user/{channel_id}" + channel_response = requests.get(api_url, timeout=5) + if channel_response.status_code == 200: + channel_data = channel_response.json() + + # Abonnentenanzahl extrahieren + for stat in channel_data.get("statistics", []): + for count in stat.get("counts", []): + if count.get("value") == "subscribers": + subscriber_count = count.get("count", "Unbekannt") + break + + # Profilbild (PFP) extrahieren + for stat in channel_data.get("statistics", []): + for user_info in stat.get("user", []): + if user_info.get("value") == "pfp": + channel_logo_url = user_info.get("count", "") + break + except Exception as e: + print(f"SuperPlayCounts API Error: {str(e)}") + + # Anzahl der Kommentare + comment_count = len(comments) + if os.path.exists(video_mp4_path): video_duration = helper.get_video_duration_from_file(video_flv_path) alert_script = "" @@ -248,6 +278,9 @@ def watch(): likeCount=metadata['likeCount'], publishedAt=metadata['publishedAt'], comments=comments, + commentCount=comment_count, + channel_logo_url=channel_logo_url, + subscriberCount=subscriber_count, video_id=video_id, video_flv=f"/sigma/videos/{video_id}.flv", alert_message="") @@ -261,6 +294,9 @@ def watch(): likeCount=metadata['likeCount'], publishedAt=metadata['publishedAt'], comments=comments, + commentCount=comment_count, + channel_logo_url=channel_logo_url, + subscriberCount=subscriber_count, video_id=video_id, video_flv=f"/sigma/videos/{video_id}.flv", alert_message="") @@ -287,7 +323,7 @@ def process_video(video_id): "yt-dlp", "-o", temp_video_path, "--cookies", "cookies.txt", - "--proxy", "http://localhost:4000", + "--proxy", "http://localhost:4000", "-f", "worstvideo+worstaudio", f"https://youtube.com/watch?v={video_id}" ] diff --git a/site_storage/channel_template.html b/site_storage/channel_template.html index 07420d0..f46e59c 100644 --- a/site_storage/channel_template.html +++ b/site_storage/channel_template.html @@ -87,8 +87,8 @@
- +
diff --git a/site_storage/index_template.html b/site_storage/index_template.html index bcb9aa8..02b7f66 100644 --- a/site_storage/index_template.html +++ b/site_storage/index_template.html @@ -87,8 +87,8 @@
- +
diff --git a/site_storage/loading_template.html b/site_storage/loading_template.html index 27b5aec..9921602 100644 --- a/site_storage/loading_template.html +++ b/site_storage/loading_template.html @@ -90,8 +90,8 @@
- +
diff --git a/site_storage/search_template.html b/site_storage/search_template.html index fdf0946..73de5d8 100644 --- a/site_storage/search_template.html +++ b/site_storage/search_template.html @@ -87,8 +87,8 @@
- +
diff --git a/site_storage/watch_wii_template.html b/site_storage/watch_wii_template.html index 7420c4e..187bdbf 100644 --- a/site_storage/watch_wii_template.html +++ b/site_storage/watch_wii_template.html @@ -67,8 +67,6 @@ border-right:6px solid #181818; } #videooutline:hover { - width:fit-content; - margin:auto; border-bottom:6px solid #111111; border-right:6px solid #111111; } @@ -82,58 +80,15 @@ .video-container:hover { border:1px solid #0f0f0f; } - .video-grid { - display: flex; - flex-wrap: wrap; - justify-content: center; - } - .video-item { - width: 320px; - margin: 10px; - background-color: #222; - padding: 10px; - } - .video-item img { - width: 100%; - } - .video-item-title { - font-weight: bold; - font-size: 14px; - margin-top: 5px; - } - .video-item-uploader, .video-item-duration { - color: #aaa; - font-size: 12px; - } - .comments { - margin: 0 auto; - width: 80%; - text-align: left; - } - h1,h3 { - color: #ff002b - } - .dataname { - color:#c4c4c4; - } - hr { - border-top:1px solid #e91d1d; - border-bottom:1px solid #e91d1d; - border-left:1px solid #ff2e2e; - border-right:1px solid #ff2e2e; - max-width:580px; - margin-left:auto; - margin-right:auto; - margin-top:8px; - margin-bottom:8px; - }
- + +
@@ -142,48 +97,43 @@
-
-
- - - - - -
-
-

- {{ title }}

-
-

Uploader: - {{ uploader }}

-

Views: - {{ viewCount }}

-

Likes: - {{ likeCount }}

-

Upload Date: - {{ publishedAt }}

- Skip Description -

Description:

-

- {{ description | safe }}

-
-

- Comments:

-
- {% if comments %} - {% for comment in comments %} -
-

{{ comment.author }} posted:

-

{{ comment.text|safe }}

-

Likes: {{ comment.likeCount }} | Post date: {{ comment.publishedAt }}

+
+
+ + + + + +
+
+
+

{{ title }}

+
{{ viewCount }} Aufrufe • {{ publishedAt }}
+
+ +
+ {{ uploader }} +
{{ subscriberCount }} Abonnenten
+
+
+ +
+

Kommentare ({{ commentCount }})

+ {% if comments %} + {% for comment in comments %} +
+
{{ comment.author }}
+
{{ comment.text }}
+
👍 {{ comment.likeCount }} | {{ comment.publishedAt }}
+
+ {% endfor %} + {% else %} +

Keine Kommentare.

+ {% endif %}
- {% endfor %} - {% else %} -

No Comments.

- {% endif %}
-
- -