Skip to content

Commit

Permalink
fix(Youtube): channel name & image being null (#8883)
Browse files Browse the repository at this point in the history
* fix(Youtube): channel name being null

* fix(Youtube): version bump

* fix(Youtube): fix channel logo"

* Update presence.ts

Signed-off-by: github plz bring back DarkVIllager <[email protected]>

---------

Signed-off-by: github plz bring back DarkVIllager <[email protected]>
  • Loading branch information
darkvillager2 authored Nov 15, 2024
1 parent 8452f51 commit 4d280ef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion websites/Y/YouTube/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"www.youtube.com",
"studio.youtube.com"
],
"version": "5.13.3",
"version": "5.13.4",
"logo": "https://cdn.rcd.gg/PreMiD/websites/Y/YouTube/assets/logo.png",
"thumbnail": "https://cdn.rcd.gg/PreMiD/websites/Y/YouTube/assets/thumbnail.jpg",
"color": "#E40813",
Expand Down
10 changes: 7 additions & 3 deletions websites/Y/YouTube/presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,10 +328,10 @@ presence.on("UpdateData", async () => {
).textContent;
// Get channel name when viewing a channel
} else if (
!document.querySelector("#text.ytd-channel-name")?.textContent &&
documentTitle.includes(
document.querySelector("#text.ytd-channel-name")?.textContent
)
) &&
document.querySelector("#text.ytd-channel-name")?.textContent
)
user = document.querySelector("#text.ytd-channel-name").textContent;
// Get channel name from website's title
Expand Down Expand Up @@ -399,7 +399,11 @@ presence.on("UpdateData", async () => {
// When viewing a community post
document.querySelector<HTMLImageElement>(
"#author-thumbnail > a > yt-img-shadow > img"
)
) ??
// When viewing a channel on the normal channel page
document
.querySelector(".yt-spec-avatar-shape")
?.querySelector("img")
)?.src.replace(/=s[0-9]+/, "=s512") ?? YouTubeAssets.Logo;
if (channelImg) presenceData.largeImageKey = channelImg;
}
Expand Down

0 comments on commit 4d280ef

Please sign in to comment.