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

Best way to determine if an item will be playable with YTM? #89

Closed
4 tasks done
polds opened this issue Jul 3, 2022 · 2 comments
Closed
4 tasks done

Best way to determine if an item will be playable with YTM? #89

polds opened this issue Jul 3, 2022 · 2 comments
Labels
question Further information is requested

Comments

@polds
Copy link

polds commented Jul 3, 2022

Question

I'm wondering if there is a solid way if it's possible, given a single Video Id, to determine if that video/song will be playable within YouTube Music.

For example, given the Video Id: t5YjeAYnD8c if you call youtube.getDetails('t5YjeAYnD8c') you get some results that show the item has category "Music", is not unlisted, available in my country (US), and everything else that shows that it might be available in YouTube Music. But if you try to load it, it says it's unavailable. (Is it a quality thing? 480p is the highest available for that particular song?)

I could try youtube.search('title', { client: "YTMUSIC" }) but I've found that can be difficult to match up the exact title to song.

I've also stumbled on a few songs that do not have a Music category, but are playable within YouTube Music.

So I'm wondering if there's a good way to determine if a given video will be playable within YTM.

Other details

No response

Checklist

  • I am running the latest version.
  • I checked the documentation and found no answer.
  • I have searched the existing issues and made sure this is not a duplicate.
  • I have provided sufficient information.
@polds polds added the question Further information is requested label Jul 3, 2022
@LuanRT
Copy link
Owner

LuanRT commented Jul 4, 2022

There's no official way to do that in v1.4.3. But if you switch to the dev version (more info here), you can try this:

const payload = {
  videoId: 't5YjeAYnD8c',
  client: 'YTMUSIC'
};
  
const info = await youtube.actions.execute('/player', payload);
console.info(info.data.playabilityStatus);

Which outputs:

{
  status: 'UNPLAYABLE',  
  reason: 'This video is not available'
}

@polds
Copy link
Author

polds commented Jul 5, 2022

This is great! I confirmed several of my suspected "MUSIC" yet unplayable within YTM and using the dev version correctly identified all of them as UNPLAYABLE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants