Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Youtube): channel name & image being null #8883

Merged
merged 4 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading