Uploaded image for project: 'ListenBrainz'
  1. ListenBrainz
  2. LB-1176

Use Youtube Music links on a MusicBrainz release to better match songs played in the ListenBrainz Player

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • None
    • None

      As I understand it, LB uses a YouTube search by track title to match songs being played in the Music Player on LB. It could be better if it could take advantage of a YouTube playlist being linked to the associated MB release being used in the LB playlist to better match songs to their YouTube counterpart...

      <Lotheric6> lucifer, I'm using a userscript to listen (on listenbrainz) to a MusicBrainz album (the script adds a button above the album cover and sends the playlist to LB
      6<Lotheric6> but I'm getting a clean version instead of the explicit version
      6<Lotheric6> How does it work exactly ? Is it match by track title on youtube ? Is there a way for me to fix that ?
      2<29lucifer2> can you link me to the listens on LB?
      6<Lotheric6> I know both clean and explicit versions are on youtube
      6<Lotheric6> https://listenbrainz.org/player/release/01572994-f0b5-41df-ab56-7ce5463dbde5/
      6<Lotheric6> https://beta.musicbrainz.org/release/01572994-f0b5-41df-ab56-7ce5463dbde5
      6<Lotheric6> and the clean version https://beta.musicbrainz.org/release/9d5fe383-1238-4a3e-b7c0-f0028589a583
      2<8lucifer2> Lotheric: sorry, not sure from this where the clean vs explicit version comes in. for this page, we use the exact mbids from the release on MB.
      6<Lotheric6> but songs are played from youtube right ?
      6<Lotheric6> I'm not familiar with how the player match the songs
      2<29lucifer2> right.
      2<29lucifer2> ah i see, you mean the wrong version is played from youtube?
      2<29lucifer2> we play the first search result returned by youtube.
      6<Lotheric6> yeah
      6<Lotheric6> ok so it's a search that is done with the track title ? maybe it could be refined like in my example, both MB releases have their youtube music playlist linked
      2<29lucifer2> yes makes sense. we can improve in that case. can you open a ticket for that?
      6<Lotheric6> I'll do that 
      2<29lucifer2> thanks!

          [LB-1176] Use Youtube Music links on a MusicBrainz release to better match songs played in the ListenBrainz Player

          cherryblossom000 added a comment - - edited

          It is possible to get the tracks from a YT Music playlist using their API:

          getTracks() {
            curl "https://music.youtube.com/youtubei/v1/browse?browseId=VL$1&key=AIzaSyC9XL3ZjWddXya6X74dJoCTL-WEYFDNX30" \
              -H Origin:https://music.youtube.com \
              -H Content-Type:application/json \
              -H Accept:application/json \
              -H Cookie:Consent=YES+1 \
              -d '{"context":{"client":{"clientName":"WEB_REMIX","clientVersion":"1.20220502.01.00","hl":"en"}}}' |
              jq '.contents.singleColumnBrowseResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents[0].musicPlaylistShelfRenderer.contents | .[] | .musicResponsiveListItemRenderer | {id: .playlistItemData.videoId, name: .flexColumns[0].musicResponsiveListItemFlexColumnRenderer.text.runs[0].text}'
          }
          
          > getTracks OLAK5uy_msBP0AmgnhfaownQDTYhhzdjWnnlgRNOc
          {
            "id": "3Y0i0thFnNQ",
            "name": "For a Pessimist, I'm Pretty Optimistic"
          }
          {
            "id": "aVbdEnIolPo",
            "name": "That's What You Get"
          }
          {
            "id": "Te_XfT8CgvM",
            "name": "Hallelujah"
          }
          {
            "id": "1VPotzhpAGE",
            "name": "Misery Business"
          }
          {
            "id": "6MuF-bAMgbk",
            "name": "When It Rains"
          }
          {
            "id": "WopgkUWG28k",
            "name": "Let the Flames Begin"
          }
          {
            "id": "oX8N5AaBnhk",
            "name": "Miracle"
          }
          {
            "id": "p1Gr_Bg2Eag",
            "name": "crushcrushcrush"
          }
          {
            "id": "QTmAXxg03b4",
            "name": "We Are Broken"
          }
          {
            "id": "zyUMk-XiVsA",
            "name": "Fences"
          }
          {
            "id": "RZWZMTLYufc",
            "name": "Born for This"
          }
          {
            "id": "POdHu29lbOY",
            "name": "Misery Business (Acoustic Version)"
          }
          

          Alternatively, some recordings have a YouTube Music or YouTube external link that could be used.

          cherryblossom000 added a comment - - edited It is possible to get the tracks from a YT Music playlist using their API: getTracks() { curl "https://music.youtube.com/youtubei/v1/browse?browseId=VL $1 &key=AIzaSyC9XL3ZjWddXya6X74dJoCTL-WEYFDNX30" \ -H Origin:https://music.youtube.com \ -H Content-Type:application/json \ -H Accept:application/json \ -H Cookie:Consent=YES+1 \ -d '{ "context" :{ "client" :{ "clientName" : "WEB_REMIX" , "clientVersion" : "1.20220502.01.00" , "hl" : "en" }}}' | jq '.contents.singleColumnBrowseResultsRenderer.tabs[0].tabRenderer.content.sectionListRenderer.contents[0].musicPlaylistShelfRenderer.contents | .[] | .musicResponsiveListItemRenderer | {id: .playlistItemData.videoId, name: .flexColumns[0].musicResponsiveListItemFlexColumnRenderer.text.runs[0].text}' } > getTracks OLAK5uy_msBP0AmgnhfaownQDTYhhzdjWnnlgRNOc { "id" : "3Y0i0thFnNQ" , "name" : "For a Pessimist, I'm Pretty Optimistic" } { "id" : "aVbdEnIolPo" , "name" : "That's What You Get" } { "id" : "Te_XfT8CgvM" , "name" : "Hallelujah" } { "id" : "1VPotzhpAGE" , "name" : "Misery Business" } { "id" : "6MuF-bAMgbk" , "name" : "When It Rains" } { "id" : "WopgkUWG28k" , "name" : "Let the Flames Begin" } { "id" : "oX8N5AaBnhk" , "name" : "Miracle" } { "id" : "p1Gr_Bg2Eag" , "name" : "crushcrushcrush" } { "id" : "QTmAXxg03b4" , "name" : "We Are Broken" } { "id" : "zyUMk-XiVsA" , "name" : "Fences" } { "id" : "RZWZMTLYufc" , "name" : "Born for This" } { "id" : "POdHu29lbOY" , "name" : "Misery Business (Acoustic Version)" } Alternatively, some recordings have a YouTube Music or YouTube external link that could be used.

          Monkey added a comment - - edited

          Does anyone have a good idea for how to retrieve the correct video id when all we have is a YT playlist, and a track name that might or might not be similar ?

           

          Can we get the position in the release based on the recording, and match it to the position in the playlist?
          That sounds like it would be very frail though.

          Monkey added a comment - - edited Does anyone have a good idea for how to retrieve the correct video id when all we have is a YT playlist, and a track name that might or might not be similar ?   Can we get the position in the release based on the recording, and match it to the position in the playlist? That sounds like it would be very frail though.

            Unassigned Unassigned
            lotheric Lotheric
            Votes:
            13 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:

                Version Package