1
Fork 0

fix reccomendations

This commit is contained in:
Ashley //// 2024-02-01 10:06:22 +00:00
parent 5ca70870d7
commit 91dcd8ec7b

View file

@ -1601,8 +1601,35 @@ Recommended Videos
<% if (!f) { %>
<% k.Video.Recommendations?.Video?.forEach(x => { %> <div class="fade-in video"> <% if (!optout) { %><a class="thumbnail" href="/watch?v=<%= x.id %>" style="background-image:url(<%- media_proxy_url %>/proxy?url=https://vid.puffyan.us/vi/<%= x.id %>/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLBy_x4UUHLNDZtJtH0PXeQGoRFTgw);border-radius:9.5px" alt="<%= x.Title %>"><span class="video-length"><%- x.duration || "LIVE"%></span><% } %><% if (optout) { %><a class="thumbnail"href="/watch?v=<%= x.id %>&m=f"style="background-image:url(<%- media_proxy_url %>/proxy?url=https://vid.puffyan.us/vi/<%= x.id %>/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLBy_x4UUHLNDZtJtH0PXeQGoRFTgw);border-radius:9.5px"alt="<%= x.Title %>"><span class="video-length"><%- x.duration || "LIVE"%></span><% } %></a><div class="info"><% if (!optout) { %><a class="max-lines-2 title" href="/watch?v=<%= x.id %>" style="font-stretch:ultra-expanded;font-weight:850" title="<%= x.Title %>"><%= x.Title %></a><% } %><% if (optout) { %><a class="max-lines-2 title" href="/watch?v=<%= x.id %>&m=f" style="font-stretch:100%;font-weight:800" title="<%= x.Title %>"><%= x.Title %></a><% } %><div><a class="max-lines-2" href="/channel?id=<%= x.Channel.id %>@youtube.com" style="-webkit-line-clamp:1;width:12em;word-wrap:break-word"><%=x.Channel.Name %></a><div class="video-views"><% if (universe) { %><%= x.uploadedAt.replace("Streamed ", " ") %> <br> <%= convert(x.views) %> views <% } %> <% if (!universe) { %><%= x.uploadedAt.replace("Streamed", " ") %> • <%= convert(x.views) %> views <% } %> </div></div></div></div><% }) %><% } %>
<% inv_vid?.recommendedVideos.forEach(x => { %>
<div class="fade-in video">
<% if (!optout) { %><a class="thumbnail" href="/watch?v=<%= x.videoId %>" style="background-image:url(<%- media_proxy_url %>/proxy?url=https://vid.puffyan.us/vi/<%= x.videoId %>/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLBy_x4UUHLNDZtJtH0PXeQGoRFTgw);border-radius:9.5px" alt="<%= x.Title %>"><span class="video-length"><%- turntomins(x.lengthSeconds) || "LIVE"%></span><% } %><% if (optout) { %><a class="thumbnail"href="/watch?v=<%= x.videoId %>&m=f"style="background-image:url(<%- media_proxy_url %>/proxy?url=https://vid.puffyan.us/vi/<%= x.videoId %>/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLBy_x4UUHLNDZtJtH0PXeQGoRFTgw);border-radius:9.5px"alt="<%= x.Title %>"><span class="video-length"><%- x.duration || "LIVE"%></span><% } %></a>
<div class="info">
<% if (!optout) { %>
<a class="max-lines-2 title" href="/watch?v=<%= x.videoId %>" style="font-stretch:ultra-expanded;font-weight:850" title="<%= x.Title %>">
<%= x.title %>
</a>
<% } %>
<% if (optout) { %>
<a class="max-lines-2 title" href="/watch?v=<%= x.videoId %>&m=f" style="font-stretch:100%;font-weight:800" title="<%= x.Title %>">
<%= x.title %>
</a>
<% } %>
<div>
<a class="max-lines-2" href="/channel?id=<%= x.authorId %>@youtube.com" style="-webkit-line-clamp:1;width:12em;word-wrap:break-word">
<%=x.author %>
</a>
<div class="video-views">
<%= convert(x.viewCount) %> views
</div>
</div>
</div>
</div>
<% }) %>
<% } %>
<% if (f) { %>
<% tj.forEach(x => { %>
@ -1703,7 +1730,7 @@ Recommended Videos
}
<% if (k.Video.Recommendations.Video) { %>
<% if (inv_vid?.recommendedVideos) { %>
let checkbox = document.getElementById("continue");
@ -1711,10 +1738,10 @@ checkbox.addEventListener('change', function(e) {
if (checkbox.checked) {
console.log("[AUTOPLAY] enabled");
document.getElementById('video').addEventListener('ended', autoplaynextvideo, false);
let url = window.location.hostname + "/watch?v=<%- k?.Video?.Recommendations?.Video[0]?.id%>";
let url = window.location.hostname + "/watch?v=<%- inv_vid?.recommendedVideos[0].videoId %>";
function autoplaynextvideo(e) {
location.href = "/watch?v=<%- k.Video.Recommendations.Video[0].id%>&autoplay=<%-btoa("1f739d935676111cfff4b4693e3816e664797050" + k.Video.Recommendations.Video[0].id ) %>";
location.href = "/watch?v=<%- inv_vid?.recommendedVideos[0].videoId%>&autoplay=<%-btoa("1f739d935676111cfff4b4693e3816e664797050" + inv_vid?.recommendedVideos[0].videoId) %>";
}
}
if (/[?&]autoplay=/.test(location.search)) {
@ -1725,7 +1752,7 @@ checkbox.addEventListener('change', function(e) {
if (/[?&]autoplay=/.test(location.search)) {
if (checkbox.checked) {
fetch("https://" + window.location.hostname + "/watch?v=<%- k.Video.Recommendations?.Video[0].id%>").then(() => {})
fetch("https://" + window.location.hostname + "/watch?v=<%- inv_vid?.recommendedVideos[0].videoId%>").then(() => {})
}
}
});
@ -1749,7 +1776,7 @@ checkbox.addEventListener('change', function(e) {
if (/[?&]autoplay=/.test(location.search)) {
checkbox.checked = true;
console.log("[AUTOPLAY] enabled");
let url = window.location.hostname + "/watch?v=<%- k.Video.Recommendations?.Video[0].id%>";
let url = window.location.hostname + "/watch?v=<%- inv_vid?.recommendedVideos[0].videoId%>";
document.body.style.cursor = "wait"; // set cursor to "wait" before the fetch request starts
fetch(url)
.then(response => response.json())
@ -1764,11 +1791,11 @@ if (/[?&]autoplay=/.test(location.search)) {
document.getElementById('video').addEventListener('ended', autoplaynextvideo, false);
if (/[?&]autoplay=/.test(location.search)) {
if (checkbox.checked) {
fetch("https://" + window.location.hostname + "/watch?v=<%- k.Video.Recommendations?.Video[0].id%>").then(() => {})
fetch("https://" + window.location.hostname + "/watch?v=<%- inv_vid?.recommendedVideos[0].videoId%>").then(() => {})
}
}
function autoplaynextvideo(e) {
location.href = "/watch?v=<%- k.Video.Recommendations?.Video[0].id%>&autoplay=<%-btoa("1f739d935676111cfff4b4693e3816e664797050" + k.Video.Recommendations.Video[0].id ) %>";
location.href = "/watch?v=<%- inv_vid?.recommendedVideos[0].videoId%>&autoplay=<%-btoa("1f739d935676111cfff4b4693e3816e664797050" + inv_vid?.recommendedVideos[0].videoId) %>";
}
}
<% } %>
@ -2872,33 +2899,32 @@ More Epic options owo~
<% if (!f) { %>
<% k?.Video.Recommendations.Video.forEach(x => { %>
<div class="video">
<% if (!optout) { %>
<a href="/watch?v=<%= x.id %>" class="thumbnail" style="background-image: url('<%- media_proxy_url %>/proxy?url=https://vid.puffyan.us/vi/<%= x.id %>/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLBy_x4UUHLNDZtJtH0PXeQGoRFTgw');border-radius: 9.5px;border: 2px solid white;" > <span class="video-length"><%=x.duration %></span>
<% } %>
<% if (optout) { %>
<a href="/watch?v=<%= x.id %>&m=f" class="thumbnail" style="background-image: url('<%- media_proxy_url %>/proxy?url=https://vid.puffyan.us/vi/<%= x.id %>/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLBy_x4UUHLNDZtJtH0PXeQGoRFTgw');border-radius: 9.5px;border: 2px solid white;" > <span class="video-length"><%=x.duration %></span>
<% } %>
</a>
<div class="info">
<% if (!optout) { %>
<a href="/watch?v=<%= x.id %>" class="title max-lines-2" style="margin-top: 4px;"><%= x.Title %></a>
<% } %>
<% if (optout) { %>
<a href="/watch?v=<%= x.id %>&m=f" style="margin-top: 4px;" class="title max-lines-2"><%= x.Title %></a>
<% } %>
<div style="color:#fff" >
<a class="max-lines-2" style="color:#fff" href="/channel?id=<%= x.Channel.id %>"><%=x.Channel.Name %></a> • <div>
<%= x.uploadedAt %> </div>
</div>
</div>
</div>
<% }) %>
<% inv_vid?.recommendedVideos.forEach(x => { %>
<div class="fade-in video">
<% if (!optout) { %><a class="thumbnail" href="/watch?v=<%= x.videoId %>" style="background-image:url(<%- media_proxy_url %>/proxy?url=https://vid.puffyan.us/vi/<%= x.videoId %>/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLBy_x4UUHLNDZtJtH0PXeQGoRFTgw);border-radius:9.5px" alt="<%= x.Title %>"><span class="video-length"><%- turntomins(x.lengthSeconds) || "LIVE"%></span><% } %><% if (optout) { %><a class="thumbnail"href="/watch?v=<%= x.videoId %>&m=f"style="background-image:url(<%- media_proxy_url %>/proxy?url=https://vid.puffyan.us/vi/<%= x.videoId %>/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLBy_x4UUHLNDZtJtH0PXeQGoRFTgw);border-radius:9.5px"alt="<%= x.Title %>"><span class="video-length"><%- x.duration || "LIVE"%></span><% } %></a>
<div class="info">
<% if (!optout) { %>
<a class="max-lines-2 title" href="/watch?v=<%= x.videoId %>" style="font-stretch:ultra-expanded;font-weight:850" title="<%= x.Title %>">
<%= x.title %>
</a>
<% } %>
<% if (optout) { %>
<a class="max-lines-2 title" href="/watch?v=<%= x.videoId %>&m=f" style="font-stretch:100%;font-weight:800" title="<%= x.Title %>">
<%= x.title %>
</a>
<% } %>
<div>
<a class="max-lines-2" href="/channel?id=<%= x.authorId %>@youtube.com" style="-webkit-line-clamp:1;width:12em;word-wrap:break-word;acolor:#fff">
<%=x.author %>
</a>
<div class="video-views">
</div>
</div>
</div>
</div>
<% }) %>
<% } %>
<% if (f) { %>
@ -3044,7 +3070,7 @@ checkbox.addEventListener('change', function(e) {
document.getElementById('video').addEventListener('ended',autoplaynextvideo,false);
function autoplaynextvideo(e) {
location.href = "/watch?v=<%- k.Video.Recommendations.Video[0].id%>&autoplay=<%-btoa("1f739d935676111cfff4b4693e3816e664797050" + k.Video.Recommendations.Video[0].id ) %>"
location.href = "/watch?v=<%- inv_vid?.recommendedVideos[0].videoId%>&autoplay=<%-btoa("1f739d935676111cfff4b4693e3816e664797050" + inv_vid?.recommendedVideos[0].videoId) %>"
}
}
@ -3064,7 +3090,7 @@ if (/[?&]autoplay=/.test(location.search)) {
document.getElementById('video').addEventListener('ended',autoplaynextvideo,false);
function autoplaynextvideo(e) {
location.href = "/watch?v=<%- k.Video.Recommendations.Video[0].id%>&autoplay=<%-btoa("1f739d935676111cfff4b4693e3816e664797050" + k.Video.Recommendations.Video[0].id ) %>"
location.href = "/watch?v=<%- inv_vid?.recommendedVideos[0].videoId%>&autoplay=<%-btoa("1f739d935676111cfff4b4693e3816e664797050" + inv_vid?.recommendedVideos[0].videoId) %>"
}
}
var anchor = document.getElementById("sub");