miraclx / freyr-js

A tool for downloading songs from music streaming services like Spotify and Apple Music.
https://git.io/freyr-js
Apache License 2.0
1.53k stars 95 forks source link

YouTube Music Support #6

Open miraclx opened 3 years ago

miraclx commented 3 years ago

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.

vladdenisov commented 2 years ago

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 :)

EthanBnntt commented 1 year ago

I'd love to try to make a node.js library for querying data from YouTube.

miraclx commented 1 year ago

@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.

EthanBnntt commented 1 year ago

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.

miraclx commented 1 year ago

Sounds to me like what you're talking about is off-topic for freyr. Or am I missing something?

EthanBnntt commented 1 year ago

Yes, I was talking about making a library separate from freyr and integrating it into freyr.

vladdenisov commented 1 year ago

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.

miraclx commented 1 year ago

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?

ghost commented 1 year ago

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'

quartztester commented 1 year ago

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.

miraclx commented 1 year ago

@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.