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

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

Open
lovegaoshi opened this issue Jun 4, 2024 · 7 comments

Comments

@lovegaoshi
Copy link

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

@vixalien
Copy link
Owner

vixalien commented Jun 4, 2024

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

@lovegaoshi
Copy link
Author

lovegaoshi commented Jun 4, 2024

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

@vixalien
Copy link
Owner

vixalien commented Jun 4, 2024

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??

@lovegaoshi
Copy link
Author

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
}
>

@vixalien
Copy link
Owner

vixalien commented Jun 5, 2024

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.

@lovegaoshi lovegaoshi changed the title [bug] search sometimes fails to parse [bug] search filtered by videos now may include podcast/episode which throws an error Jun 5, 2024
@lovegaoshi
Copy link
Author

lovegaoshi commented Jun 5, 2024

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

@vixalien
Copy link
Owner

vixalien commented Jun 5, 2024

yes we can.

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

No branches or pull requests

2 participants