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

get album name from DOM #588

Merged
merged 1 commit into from
Feb 9, 2022
Merged

get album name from DOM #588

merged 1 commit into from
Feb 9, 2022

Conversation

Araxeus
Copy link
Collaborator

@Araxeus Araxeus commented Jan 30, 2022

Problem

$('ytmusic-player-page').__data.playerPageWatchMetadata isn't reliable at all

Solution

Grabs album name from dom (available only if in "song" mode, else will be undefined)

  • $$(".byline.ytmusic-player-bar > .yt-simple-endpoint")
    gets the links in the footer which will be either [channel] for video mode or [artist, album] for song mode
    image

  • .find(e => e.href?.includes("browse"))
    this should only match album links

    • artist/channel link is https://music.youtube.com/channel/UCxxxxxxxx
    • album link is https://music.youtube.com/browse/MPREb_xxxxxxx

grabbing straight from DOM because I can't find the album name anywhere else now

Copy link
Owner

@th-ch th-ch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! ✅

@th-ch th-ch merged commit 621c5de into th-ch:master Feb 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants