muse icon indicating copy to clipboard operation
muse copied to clipboard

[bug] search filtered by videos now may include podcast/episode which throws an error

Open lovegaoshi opened this issue 1 year ago • 7 comments

I recently bumped into some failed to parse cases at libmuse/script/parsers/search.js's parse_search_song reproducible with

search("wake", {
      filter: 'songs',
    }),

the navigationEndPoint returns browseEndpoint instead of watchEndpoint: image

lovegaoshi avatar Jun 04 '24 13:06 lovegaoshi

If it's returning a browseEndpoint instead of a watchEndpoint, that means it's not a song at all. maybe it's a podcast (because of the MUSIC_PAGE_TYPE_NON_MUSIC_AUDIO_TRACK_PAGE??

In this case, podcasts aren't supported yet, and I'm not sure why YTM is returning podcasts when you are searching for songs anyway.

I can't actually reproduce this because for me everything works correctly... you can try to compare what gets returned when you search for that on music.youtube.com

vixalien avatar Jun 04 '24 13:06 vixalien

thanks for the quick response! YT changed their search priorities and above code works fine just hours later, and I found another reproducible code:

search("don't wake up", {
  filter: "videos",
}).then((v) => console.log(v.categories[0].results));

happens in filter videos not songs, my apologies. exact same error msg

lovegaoshi avatar Jun 04 '24 15:06 lovegaoshi

working for me...

image

can you tell me what happens when you search for that at https://music.youtube.com? do you get podcast results when you filtered for videos??

vixalien avatar Jun 04 '24 23:06 vixalien

you are abs right, it is indeed a podcast that shows up when filtering for video. guess ytm finally made that push after google podcast deprecation image log:

      trackingParams: 'CKsBEO3gCBgIIhMIoaKkq4LChgMVsBR2Bh1i6AIM',
      thumbnail: {
        musicThumbnailRenderer: {
          thumbnail: [Object],
          thumbnailCrop: 'MUSIC_THUMBNAIL_CROP_UNSPECIFIED',
          thumbnailScale: 'MUSIC_THUMBNAIL_SCALE_ASPECT_FIT',
          trackingParams: 'CLoBEIS_AiITCKGipKuCwoYDFbAUdgYdYugCDA=='
        }
      },
      overlay: {
        musicItemThumbnailOverlayRenderer: {
          background: [Object],
          content: [Object],
          contentPosition: 'MUSIC_ITEM_THUMBNAIL_OVERLAY_CONTENT_POSITION_CENTERED',
          displayStyle: 'MUSIC_ITEM_THUMBNAIL_OVERLAY_DISPLAY_STYLE_PERSISTENT'
        }
      },
      flexColumns: [
        }
      },
      flexColumns: [
        { musicResponsiveListItemFlexColumnRenderer: [Object] },
        { musicResponsiveListItemFlexColumnRenderer: [Object] }
      ],
      menu: {
        menuRenderer: {
          items: [Array],
          trackingParams: 'CKwBEKc7IhMIoaKkq4LChgMVsBR2Bh1i6AIM',
          topLevelButtons: [Array],
          accessibility: [Object]
        }
      },
      playlistItemData: { videoId: 'ZNqlgN_uXBk' },
      flexColumnDisplayStyle: 'MUSIC_RESPONSIVE_LIST_ITEM_FLEX_COLUMN_DISPLAY_STYLE_TWO_LINE_STACK',
      itemHeight: 'MUSIC_RESPONSIVE_LIST_ITEM_HEIGHT_TALL'
    } {
      text: "Goom Gum - Don't Wake Up (Extended Mix)",
      navigationEndpoint: {
        clickTrackingParams: 'CKsBEO3gCBgIIhMIoaKkq4LChgMVsBR2Bh1i6AIM',
        browseEndpoint: {
          browseId: 'MPEDZNqlgN_uXBk',
          browseEndpointContextSupportedConfigs: [Object]
        }
      }
    }

and btw my reproducible error log (albeit with node)


(base) PS D:\WUDownloadCache> npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.

See `npm help init` for definitive documentation on these fields
and exactly what they do.

Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.
package name: (wudownloadcache)
version: (1.0.0)
description:
entry point: (index.js)
test command:
git repository:
keywords:
author:
license: (ISC)
About to write to D:\WUDownloadCache\package.json:

{
  "name": "wudownloadcache",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}


Is this OK? (yes)
(base) PS D:\WUDownloadCache> npm install libmuse

added 3 packages, and audited 4 packages in 2s

found 0 vulnerabilities
(base) PS D:\WUDownloadCache> node
Welcome to Node.js v21.7.2.
Type ".help" for more information.
> const { search } = await import("libmuse");
undefined
> search('dont wake up', {filter: 'videos'})
Promise {
  <pending>,
  [Symbol(async_id_symbol)]: 69400,
  [Symbol(trigger_async_id_symbol)]: 6
}
> Uncaught:
MuseError: JSONPath expression "text.runs[0],navigationEndpoint.watchEndpoint.videoId" returned nothing
    at j (file:///D:/WUDownloadCache/node_modules/libmuse/esm/util.js:26:15)
    at parse_search_song (file:///D:/WUDownloadCache/node_modules/libmuse/esm/parsers/search.js:119:18)
    at parse_search_video (file:///D:/WUDownloadCache/node_modules/libmuse/esm/parsers/search.js:131:12)
    at parse_search_results (file:///D:/WUDownloadCache/node_modules/libmuse/esm/parsers/search.js:267:29)
    at search (file:///D:/WUDownloadCache/node_modules/libmuse/esm/mixins/search.js:170:49) {
  code: 10
}
>

lovegaoshi avatar Jun 05 '24 00:06 lovegaoshi

and btw my reproducible error log (albeit with node)

to be faster, you can just clone this repo and edit the client.ts file and then run it with deno task start.

you are abs right, it is indeed a podcast that shows up when filtering for video. guess ytm finally made that push after google podcast deprecation

well the folks at YTM are bizarre. anyway, I guess the actual solution would be to add support for podcasts and episodes.

vixalien avatar Jun 05 '24 00:06 vixalien

or we can try-catch wrap parse_search_song and call it a day for now ;)

lovegaoshi avatar Jun 05 '24 15:06 lovegaoshi

yes we can.

vixalien avatar Jun 05 '24 16:06 vixalien

Should be fixed by now. Please re-open if the error persists

vixalien avatar Sep 22 '24 03:09 vixalien