From adb94a475fe1146e88edd091ac62f489ce7ec113 Mon Sep 17 00:00:00 2001 From: WardPearce Date: Wed, 2 Apr 2025 16:10:27 +1300 Subject: [PATCH] Fix embed --- README.md | 1 - materialious/src/lib/patches/youtubejs.ts | 6 ++++-- .../src/routes/(no-layout)/embed/[slug]/+page@.svelte | 5 ++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 086453bf..00a9f198 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,6 @@ Deploy Materialious for your Invidious instance using Docker. Follow the steps o - [SecularSteve](https://github.com/SecularSteve) for creating Materialious' logo. - [Invidious](https://github.com/iv-org) - [Clipious](https://github.com/lamarios/clipious) for inspiration & a good source for learning more about undocumented Invidious routes. -- [Vidstack player](https://github.com/vidstack/player) - [Beer CSS](https://github.com/beercss/beercss) (Especially the [YouTube template](https://github.com/beercss/beercss/tree/main/src/youtube) what was used as the base for Materialious.) - Every dependency in [package.json](/materialious/package.json). diff --git a/materialious/src/lib/patches/youtubejs.ts b/materialious/src/lib/patches/youtubejs.ts index e9ade3a7..0e1864b0 100644 --- a/materialious/src/lib/patches/youtubejs.ts +++ b/materialious/src/lib/patches/youtubejs.ts @@ -71,6 +71,8 @@ export async function patchYoutubeJs(videoId: string): Promise { const video = new YT.VideoInfo([rawPlayerResponse, rawNextResponse], youtube!.actions, ''); + console.log(video); + if (!video.primary_info || !video.secondary_info) { throw new Error('Yt.js: Unable to pull video info from youtube.js'); } @@ -151,8 +153,8 @@ export async function patchYoutubeJs(videoId: string): Promise { return { type: 'video', title: video.primary_info.title?.toString() || '', - viewCount: Number(video.primary_info.view_count?.original_view_count || 0), - viewCountText: video.primary_info.view_count?.original_view_count.toString() || '0', + viewCount: Number(video.basic_info.view_count || 0), + viewCountText: video.basic_info.view_count?.toString() || '0', likeCount: video.basic_info.like_count || 0, dislikeCount: 0, allowRatings: false, diff --git a/materialious/src/routes/(no-layout)/embed/[slug]/+page@.svelte b/materialious/src/routes/(no-layout)/embed/[slug]/+page@.svelte index 7e8fe770..7679e37e 100644 --- a/materialious/src/routes/(no-layout)/embed/[slug]/+page@.svelte +++ b/materialious/src/routes/(no-layout)/embed/[slug]/+page@.svelte @@ -1,10 +1,9 @@ - +