mirror of
https://github.com/ReviveMii/revivetube
synced 2025-04-29 12:39:25 -04:00
revivetube update
This commit is contained in:
parent
9bef2e5f6f
commit
6d062fe23d
6 changed files with 86 additions and 100 deletions
|
@ -196,7 +196,6 @@ def index():
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@app.route("/watch", methods=["GET"])
|
@app.route("/watch", methods=["GET"])
|
||||||
def watch():
|
def watch():
|
||||||
video_id = request.args.get("video_id")
|
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
|
is_wii = "wii" in user_agent and "wiiu" not in user_agent
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
# Metadaten des Videos abrufen
|
||||||
response = requests.get(f"http://localhost:5000/video_metadata/{video_id}", timeout=20)
|
response = requests.get(f"http://localhost:5000/video_metadata/{video_id}", timeout=20)
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
metadata = response.json()
|
metadata = response.json()
|
||||||
|
@ -221,6 +221,7 @@ def watch():
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
return f"Can't connect to Metadata-API: {str(e)}", 500
|
return f"Can't connect to Metadata-API: {str(e)}", 500
|
||||||
|
|
||||||
|
# Kommentare des Videos abrufen
|
||||||
comments = []
|
comments = []
|
||||||
try:
|
try:
|
||||||
comments = get_video_comments(video_id)
|
comments = get_video_comments(video_id)
|
||||||
|
@ -228,6 +229,35 @@ def watch():
|
||||||
print(f"Video-Comments Error: {str(e)}")
|
print(f"Video-Comments Error: {str(e)}")
|
||||||
comments = []
|
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):
|
if os.path.exists(video_mp4_path):
|
||||||
video_duration = helper.get_video_duration_from_file(video_flv_path)
|
video_duration = helper.get_video_duration_from_file(video_flv_path)
|
||||||
alert_script = ""
|
alert_script = ""
|
||||||
|
@ -248,6 +278,9 @@ def watch():
|
||||||
likeCount=metadata['likeCount'],
|
likeCount=metadata['likeCount'],
|
||||||
publishedAt=metadata['publishedAt'],
|
publishedAt=metadata['publishedAt'],
|
||||||
comments=comments,
|
comments=comments,
|
||||||
|
commentCount=comment_count,
|
||||||
|
channel_logo_url=channel_logo_url,
|
||||||
|
subscriberCount=subscriber_count,
|
||||||
video_id=video_id,
|
video_id=video_id,
|
||||||
video_flv=f"/sigma/videos/{video_id}.flv",
|
video_flv=f"/sigma/videos/{video_id}.flv",
|
||||||
alert_message="")
|
alert_message="")
|
||||||
|
@ -261,6 +294,9 @@ def watch():
|
||||||
likeCount=metadata['likeCount'],
|
likeCount=metadata['likeCount'],
|
||||||
publishedAt=metadata['publishedAt'],
|
publishedAt=metadata['publishedAt'],
|
||||||
comments=comments,
|
comments=comments,
|
||||||
|
commentCount=comment_count,
|
||||||
|
channel_logo_url=channel_logo_url,
|
||||||
|
subscriberCount=subscriber_count,
|
||||||
video_id=video_id,
|
video_id=video_id,
|
||||||
video_flv=f"/sigma/videos/{video_id}.flv",
|
video_flv=f"/sigma/videos/{video_id}.flv",
|
||||||
alert_message="")
|
alert_message="")
|
||||||
|
@ -287,7 +323,7 @@ def process_video(video_id):
|
||||||
"yt-dlp",
|
"yt-dlp",
|
||||||
"-o", temp_video_path,
|
"-o", temp_video_path,
|
||||||
"--cookies", "cookies.txt",
|
"--cookies", "cookies.txt",
|
||||||
"--proxy", "http://localhost:4000",
|
"--proxy", "http://localhost:4000",
|
||||||
"-f", "worstvideo+worstaudio",
|
"-f", "worstvideo+worstaudio",
|
||||||
f"https://youtube.com/watch?v={video_id}"
|
f"https://youtube.com/watch?v={video_id}"
|
||||||
]
|
]
|
||||||
|
|
|
@ -87,8 +87,8 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="header">
|
<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;">
|
<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>
|
ReviveTube</span></div></a>
|
||||||
<div class="search-container">
|
<div class="search-container">
|
||||||
<form action="/" method="get">
|
<form action="/" method="get">
|
||||||
<input class="search-bar" placeholder="Search YouTube" name="query" type="text">
|
<input class="search-bar" placeholder="Search YouTube" name="query" type="text">
|
||||||
|
|
|
@ -87,8 +87,8 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="header">
|
<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;">
|
<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>
|
ReviveTube</span></div></a>
|
||||||
<div class="search-container">
|
<div class="search-container">
|
||||||
<form action="/" method="get">
|
<form action="/" method="get">
|
||||||
<input class="search-bar" placeholder="Search YouTube" name="query" type="text">
|
<input class="search-bar" placeholder="Search YouTube" name="query" type="text">
|
||||||
|
|
|
@ -90,8 +90,8 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="header">
|
<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;">
|
<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>
|
ReviveTube</span></div></a>
|
||||||
<div class="search-container">
|
<div class="search-container">
|
||||||
<form action="/" method="get">
|
<form action="/" method="get">
|
||||||
<input class="search-bar" name="query" placeholder="Search YouTube" type="text">
|
<input class="search-bar" name="query" placeholder="Search YouTube" type="text">
|
||||||
|
|
|
@ -87,8 +87,8 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="header">
|
<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;">
|
<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>
|
ReviveTube</span></div></a>
|
||||||
<div class="search-container">
|
<div class="search-container">
|
||||||
<form action="/" method="get">
|
<form action="/" method="get">
|
||||||
<input class="search-bar" placeholder="Search YouTube" name="query" type="text">
|
<input class="search-bar" placeholder="Search YouTube" name="query" type="text">
|
||||||
|
|
|
@ -67,8 +67,6 @@
|
||||||
border-right:6px solid #181818;
|
border-right:6px solid #181818;
|
||||||
}
|
}
|
||||||
#videooutline:hover {
|
#videooutline:hover {
|
||||||
width:fit-content;
|
|
||||||
margin:auto;
|
|
||||||
border-bottom:6px solid #111111;
|
border-bottom:6px solid #111111;
|
||||||
border-right:6px solid #111111;
|
border-right:6px solid #111111;
|
||||||
}
|
}
|
||||||
|
@ -82,58 +80,15 @@
|
||||||
.video-container:hover {
|
.video-container:hover {
|
||||||
border:1px solid #0f0f0f;
|
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>
|
</style>
|
||||||
<script src="https://unpkg.com/@ruffle-rs/ruffle"></script>
|
<script src="https://unpkg.com/@ruffle-rs/ruffle"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="header">
|
<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;">
|
<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;">
|
||||||
ReviveTube</span></div>
|
<span style="position:relative; top:-4px; padding-left:5px; border-left:1px solid #323232;">ReviveTube</span>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
<div class="search-container">
|
<div class="search-container">
|
||||||
<form action="/" method="get">
|
<form action="/" method="get">
|
||||||
<input class="search-bar" name="query" placeholder="Search YouTube" type="text">
|
<input class="search-bar" name="query" placeholder="Search YouTube" type="text">
|
||||||
|
@ -142,48 +97,43 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div id="videooutline">
|
<div id="videooutline">
|
||||||
<div class="video-container">
|
<div class="video-container">
|
||||||
<object data="/player.swf" height="256" type="application/x-shockwave-flash" width="384">
|
<object data="/player.swf" height="256" type="application/x-shockwave-flash" width="384">
|
||||||
<param name="wmode" value="transparent">
|
<param name="wmode" value="transparent">
|
||||||
<param name="allowFullScreen" value="false">
|
<param name="allowFullScreen" value="false">
|
||||||
<param name="flashvars" value="filename={{ video_flv }}">
|
<param name="flashvars" value="filename={{ video_flv }}">
|
||||||
</object>
|
</object>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<h1 style="color:#FFF;">
|
<div class="container">
|
||||||
{{ title }}</h1>
|
<h1 class="video-title">{{ title }}</h1>
|
||||||
<hr>
|
<div class="video-meta">{{ viewCount }} Aufrufe • {{ publishedAt }}</div>
|
||||||
<h3 class="dataname">Uploader: <a href="/channel?channel_id={{ channelId }}">
|
<div class="channel-info">
|
||||||
{{ uploader }}</a></h3>
|
<img src="{{ channel_logo_url }}" alt="Channel Logo" class="channel-logo">
|
||||||
<p><strong class="dataname">Views:</strong> <b style="color:#FFF;">
|
<div>
|
||||||
{{ viewCount }}</b></p>
|
<a href="/channel?channel_id={{ channelId }}">{{ uploader }}</a>
|
||||||
<p><strong class="dataname">Likes:</strong> <b style="color:#FFF;">
|
<div class="subscriber-count">{{ subscriberCount }} Abonnenten</div>
|
||||||
{{ likeCount }}</b></p>
|
</div>
|
||||||
<p><strong class="dataname">Upload Date:</strong> <b style="color:#FFF;">
|
</div>
|
||||||
{{ publishedAt }}</b></p>
|
<div class="like-container">
|
||||||
<a href="#comments">Skip Description</a>
|
<img src="/static/like.png" alt="Like" class="like-image">
|
||||||
<h3>Description:</h3>
|
<span>{{ likeCount }}</span>
|
||||||
<p>
|
</div>
|
||||||
{{ description | safe }}</p>
|
<div class="comments-section">
|
||||||
<hr>
|
<h2>Kommentare ({{ commentCount }})</h2>
|
||||||
<h3 class="comments" id="comments" style=" padding-top:3px; padding-bottom:8px; text-align:center">
|
{% if comments %}
|
||||||
Comments:</h3>
|
{% for comment in comments %}
|
||||||
<div class="comments" style="text-align:center">
|
<div class="comment">
|
||||||
{% if comments %}
|
<div class="comment-author">{{ comment.author }}</div>
|
||||||
{% for comment in comments %}
|
<div class="comment-text">{{ comment.text }}</div>
|
||||||
<div class="comment">
|
<div class="comment-likes">👍 {{ comment.likeCount }} | {{ comment.publishedAt }}</div>
|
||||||
<p><strong>{{ comment.author }}</strong> posted:</p>
|
</div>
|
||||||
<p>{{ comment.text|safe }}</p>
|
{% endfor %}
|
||||||
<p style="color: gray; font-size: 12px;">Likes: {{ comment.likeCount }} | Post date: {{ comment.publishedAt }}</p>
|
{% else %}
|
||||||
|
<p>Keine Kommentare.</p>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
|
||||||
{% else %}
|
|
||||||
<p>No Comments.</p>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<hr>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Add table
Reference in a new issue