freyr-js
freyr-js copied to clipboard
YouTube Music Support
There isn't any stable YouTube Music API for freyr to be based on. The best we can do right now is to extract data off it's web client and that is subject to frequent breaking changes. (As per #3: server response changed from under us).
Support for YouTube Music would have to wait for either an official API from Google or a library that's well maintained and kept up-to-date.
- https://github.com/vladdenisov/ytmusic-api is an attempt at this but as at 18-12-2020 tree (c99fcae), they haven't fixed the issue behind #3, we can't base on that yet.
- https://github.com/sigma67/ytmusicapi seems promising, but it's in python, we could probably use a JSON IPC to exchange data.
Hey, just now first time got by your awesome tool! Feel free to open issues in my repo with missing/incorrectly working functionality, that you need to get YTMusic working in freyr-js
. I'll do my best to fix them ASAP :)
I'd love to try to make a node.js library for querying data from YouTube.
@EthanBnntt, do you mean an API client like https://github.com/vladdenisov/ytmusic-api or a provider for freyr like https://github.com/miraclx/freyr-js/blob/master/src/services/spotify.js?
If the latter, the help would be much appreciated. I'd be happy to provide any useful insight on how to go about it.
I meant a library for pulling frontend data from YouTube. It would probably just query Invidious instances, as they provide a public API. Something more like https://github.com/vladdenisov/ytmusic-api. YouTube Music is just an alternative frontend to YouTube that only includes music.
Sounds to me like what you're talking about is off-topic for freyr. Or am I missing something?
Yes, I was talking about making a library separate from freyr and integrating it into freyr.
I've tried to make my library working without grabbing a cookie (search/track info), so I will soon try to integrate it into freyr-js.
YouTube Music is just an alternative frontend to YouTube that only includes music.
@EthanBnntt, freyr is a music-downloading utility. Isn't YouTube Music all we need? Is there a benefit to supporting the full YouTube catalog?
I haven't seen this documented anywhere but adding "?pbj=1" and appropriate headers to a YouTube (but not YouTube Music) URL returns JSON.
For Search:
curl --location --request GET 'https://www.youtube.com/search?q=laya&pbj=1' --header 'X-Youtube-Client-Version: 2.20221026.05.00' --header 'X-Youtube-Client-Name: 1'
For Video URL (kinda?):
curl --location --request GET 'https://www.youtube.com/watch?v=8foPUupIUi4&pbj=1' --header 'X-Youtube-Client-Version: 2.20221026.05.00' --header 'X-Youtube-Client-Name: 1'
What's stopping this project from utilizing this other repo? https://github.com/th-ch/youtube-music/tree/master/plugins/downloader
I am not that adept at Javascript but it would be interesting to know what method they are using to pull their YouTube video downloads. This seems to a project that could be combined with this repo due to their utilization of only HTML/CSS apart from JavaScript.
@quartztester, it's the same strategy as freyr
. Find the media ID, defer to youtube-dl
to extract the feeds (freyr has a manual downloader, they may not), and encode with ffmpeg
.
freyr
does the extra step of embedding metadata with atomicparsley
.