th-ch / youtube-music

YouTube Music Desktop App bundled with custom plugins (and built-in ad blocker / downloader)
https://th-ch.github.io/youtube-music/
MIT License
7.02k stars 427 forks source link

Last.fm Scrobble Improvements #1121

Open Harry-Dang opened 1 year ago

Harry-Dang commented 1 year ago

Currently the Last.fm plugin scrobbles using the provided song title and author. However, many Youtube channels I listen to don't appear to have proper metadata for their videos so it ends up scrobbling like:

{
  track: "Artist - Title",
  artist: "Youtube Channel"
}

Would it be possible for the plugin to be modified such that it can parse the video title to see if the video title has the artist and track title?

The expected behavior can be seen in the Web Scrobbler Chrome extension

Araxeus commented 1 year ago

Would it be possible for the plugin to be modified such that it can parse the video title to see if the video title has the artist and track title?

how would we know if the video title has the artist and track title?


Looking at the code of Web Scrobbler: https://github.com/web-scrobbler/web-scrobbler/blob/f7ca2f3fb488afb3717f2681f6f5cd82608c6e3a/src/connectors/youtube-music.ts#L80-L96

it seems that they check if an album is available: - if it is then the artist name is the channel name if not then they assume the video title is artist - trackname

but thats a false assumption... there are many artists that have a channel page that is their name, and then the video name is only the trackname (for example https://music.youtube.com/watch?v=e7VveWeRwUU)

Harry-Dang commented 1 year ago

but thats a false assumption... there are many artists that have a channel page that is their name, and then the video name is only the trackname (for example https://music.youtube.com/watch?v=e7VveWeRwUU)

In this example, the channel is RÜFÜS DU SOL and the video title is "RÜFÜS DU SOL - Alive (Official Music Video)" and it was able to correctly scrobble it, because it has the correct song metadata (you can see it if you go to description of the Youtube video rather than the Youtube Music page). Usually if the channel is the official artist page, then they usually have the correct metadata for Youtube Music to natively detect it correctly.

Here are two examples where their algorithm works well: https://youtu.be/GE0DhtpadWs Channel: Trap Nation, Title: San Holo - All The Highs https://youtu.be/SQK4xjionNQ Channel: Cloud Kid, Title: Golden Features - Vigil

The first here is scrobbled using the extension, the bottom two are with the Youtube Music desktop app:

image

I do understand the fact that the assumptions made won't work for all videos, such as those in Trackname - Artist format or those similar to Artist - Trackname (Lyrics), etc. But from my experience using the Web Scrobbler extension, their rudimentary algorithm is able to correctly scrobble most channels I use and it would be an improvement over the naive approach currently used.

However, I do understand my use case is sort of niche, because most of my music is from these label or "curation" channels rather than from official artist channels. In which case, if you believe this isn't necessary, I'd be open to working on it myself and creating a PR for it