revivetube update

This commit is contained in:
TheErrorExe 2025-02-26 14:07:48 +01:00
parent 9bef2e5f6f
commit 6d062fe23d
6 changed files with 86 additions and 100 deletions

View file

@ -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="")

View file

@ -87,8 +87,8 @@
</head>
<body>
<div class="header">
<div class="logo"><img src="../favicon.ico" style="width:32px; height:32px; display:inline; position:relative; top:3px; right:3px; padding-right:2px;"><span style="position:relative; top:-4px; padding-left:5px; border-left:1px solid #323232;">
ReviveTube</span></div>
<a href="/" style="text-decoration: none;"><div class="logo"><img src="../favicon.ico" style="width:32px; height:32px; display:inline; position:relative; top:3px; right:3px; padding-right:2px;"><span style="position:relative; top:-4px; padding-left:5px; border-left:1px solid #323232;">
ReviveTube</span></div></a>
<div class="search-container">
<form action="/" method="get">
<input class="search-bar" placeholder="Search YouTube" name="query" type="text">

View file

@ -87,8 +87,8 @@
</head>
<body>
<div class="header">
<div class="logo"><img src="../favicon.ico" style="width:32px; height:32px; display:inline; position:relative; top:3px; right:3px; padding-right:2px;"><span style="position:relative; top:-4px; padding-left:5px; border-left:1px solid #323232;">
ReviveTube</span></div>
<a href="/" style="text-decoration: none;"><div class="logo"><img src="../favicon.ico" style="width:32px; height:32px; display:inline; position:relative; top:3px; right:3px; padding-right:2px;"><span style="position:relative; top:-4px; padding-left:5px; border-left:1px solid #323232;">
ReviveTube</span></div></a>
<div class="search-container">
<form action="/" method="get">
<input class="search-bar" placeholder="Search YouTube" name="query" type="text">

View file

@ -90,8 +90,8 @@
</head>
<body>
<div class="header">
<div class="logo"><img src="../favicon.ico" style="width:32px; height:32px; display:inline; position:relative; top:3px; right:3px; padding-right:2px;"><span style="position:relative; top:-4px; padding-left:5px; border-left:1px solid #323232;">
ReviveTube</span></div>
<a href="/" style="text-decoration: none;"><div class="logo"><img src="../favicon.ico" style="width:32px; height:32px; display:inline; position:relative; top:3px; right:3px; padding-right:2px;"><span style="position:relative; top:-4px; padding-left:5px; border-left:1px solid #323232;">
ReviveTube</span></div></a>
<div class="search-container">
<form action="/" method="get">
<input class="search-bar" name="query" placeholder="Search YouTube" type="text">

View file

@ -87,8 +87,8 @@
</head>
<body>
<div class="header">
<div class="logo"><img src="../favicon.ico" style="width:32px; height:32px; display:inline; position:relative; top:3px; right:3px; padding-right:2px;"><span style="position:relative; top:-4px; padding-left:5px; border-left:1px solid #323232;">
ReviveTube</span></div>
<a href="/" style="text-decoration: none;"><div class="logo"><img src="../favicon.ico" style="width:32px; height:32px; display:inline; position:relative; top:3px; right:3px; padding-right:2px;"><span style="position:relative; top:-4px; padding-left:5px; border-left:1px solid #323232;">
ReviveTube</span></div></a>
<div class="search-container">
<form action="/" method="get">
<input class="search-bar" placeholder="Search YouTube" name="query" type="text">

View file

@ -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;
}
</style>
<script src="https://unpkg.com/@ruffle-rs/ruffle"></script>
</head>
<body>
<div class="header">
<div class="logo"><img src="../favicon.ico" style="width:32px; height:32px; display:inline; position:relative; top:3px; right:3px; padding-right:2px;"><span style="position:relative; top:-4px; padding-left:5px; border-left:1px solid #323232;">
ReviveTube</span></div>
<a href="/" style="text-decoration: none;"><div class="logo"><img src="../favicon.ico" style="width:32px; height:32px; display:inline; position:relative; top:3px; right:3px; padding-right:2px;">
<span style="position:relative; top:-4px; padding-left:5px; border-left:1px solid #323232;">ReviveTube</span>
</div>
</a>
<div class="search-container">
<form action="/" method="get">
<input class="search-bar" name="query" placeholder="Search YouTube" type="text">
@ -151,39 +106,34 @@
</object>
</div>
</div>
<h1 style="color:#FFF;">
{{ title }}</h1>
<hr>
<h3 class="dataname">Uploader: <a href="/channel?channel_id={{ channelId }}">
{{ uploader }}</a></h3>
<p><strong class="dataname">Views:</strong> <b style="color:#FFF;">
{{ viewCount }}</b></p>
<p><strong class="dataname">Likes:</strong> <b style="color:#FFF;">
{{ likeCount }}</b></p>
<p><strong class="dataname">Upload Date:</strong> <b style="color:#FFF;">
{{ publishedAt }}</b></p>
<a href="#comments">Skip Description</a>
<h3>Description:</h3>
<p>
{{ description | safe }}</p>
<hr>
<h3 class="comments" id="comments" style=" padding-top:3px; padding-bottom:8px; text-align:center">
Comments:</h3>
<div class="comments" style="text-align:center">
<div class="container">
<h1 class="video-title">{{ title }}</h1>
<div class="video-meta">{{ viewCount }} Aufrufe • {{ publishedAt }}</div>
<div class="channel-info">
<img src="{{ channel_logo_url }}" alt="Channel Logo" class="channel-logo">
<div>
<a href="/channel?channel_id={{ channelId }}">{{ uploader }}</a>
<div class="subscriber-count">{{ subscriberCount }} Abonnenten</div>
</div>
</div>
<div class="like-container">
<img src="/static/like.png" alt="Like" class="like-image">
<span>{{ likeCount }}</span>
</div>
<div class="comments-section">
<h2>Kommentare ({{ commentCount }})</h2>
{% if comments %}
{% for comment in comments %}
<div class="comment">
<p><strong>{{ comment.author }}</strong> posted:</p>
<p>{{ comment.text|safe }}</p>
<p style="color: gray; font-size: 12px;">Likes: {{ comment.likeCount }} | Post date: {{ comment.publishedAt }}</p>
<div class="comment-author">{{ comment.author }}</div>
<div class="comment-text">{{ comment.text }}</div>
<div class="comment-likes">👍 {{ comment.likeCount }} | {{ comment.publishedAt }}</div>
</div>
{% endfor %}
{% else %}
<p>No Comments.</p>
<p>Keine Kommentare.</p>
{% endif %}
</div>
</div>
<hr>
</body>
</html>