Closed KraXen72 closed 1 year ago
Most of the time I'm downloading from music.youtube as it has less "garbage" (videos that aren't music) than youtube, by definition. Especially when downloading entire albums, the behavior is just more stable when targetting music.youtube (compared to other sources), IMO. Oh, by "behavior" I mean "probability of founding metadatas (I listen to some very alternative stuff) and/or metadata acurracy)"
However, downloading most media from music.youtube while asking other providers for all of the metadata leads to broken metadata, usually.
Therefore, to me (a mere user) this feature would be very nice.
@KraXen72 Thanks for raising the feature request. @pietrotavares Thanks for your input. I agree that Youtube Music will be very useful, especially for songs that are not hugely popular or are not available in metadata sources.
However, we will have to test with Youtube Music in order to check if it will be a good enough alternative. One major hurdle is the API. Since Youtube Music is quite new, there is just one unofficial api that actually is well built. Also, since YouTube is way older, there are a lot of tools such as the ytmdl
is using currently to search for music and such. On the other hand, Youtube Music has scarce support for such tools.
Innertube gives a lot of extra data but can search on youtube music and youtube. Innertube also has limited documentation, but it should get the job done if youtubemusicapi does not have enough data.
@Rockpods Thanks for the suggestion. inntertube
looks like a good option based on it's repo. One thing that is concerning is if innertube
will be maintained in the long run. I can see the last commit being on Nov 21 (though that's cool, if there's nothing to fix, nothing to commit in a library like this).
With https://github.com/yt-dlp/yt-dlp/commit/16aa9ea41dd0a575c6c2d6945d3f8fe3bb42b327, yt-dlp can now search youtube music
➤ yt-dlp "https://music.youtube.com/search?q=random+stuff#songs" --playlist-end 10 --get-url --flat-playlist
https://music.youtube.com/watch?v=KOYUm4diTjs
https://music.youtube.com/watch?v=byTcAuEo12M
https://music.youtube.com/watch?v=HY1gxg8Re_c
https://music.youtube.com/watch?v=JVkzn2RtFPU
https://music.youtube.com/watch?v=0EK_M2taRIM
https://music.youtube.com/watch?v=ZzP0q8jO5Lg
https://music.youtube.com/watch?v=mlttefnZab0
https://music.youtube.com/watch?v=4l_EOo1GUPc
https://music.youtube.com/watch?v=SllTcHfBhx0
https://music.youtube.com/watch?v=ck7-mUsPF5c
@pukkandan This seems like a nice feature. I'll test this out. It's not released yet, as I can see, perhaps after release we can integrate this into ytmdl
.
Thanks for pointing this out!
@pukkandan Seems like the above mentioned commit adds support for searching Youtube Music.
However, our requirement is not to just search YouTube Music but to get metadata out of yt music (possibly for playlists).
As of the latest release, we already support extracting a proper song title (from metadata of ytmusic) for playlists.
The only use of searching on YTMusic is possibly to search the song with the video ID (since YouTube and Music share the same ID) and then use the first result as option (or perhaps match based on the ID).
This would help to automatically extract song metadata but I am not sure if that is even supported through yt-dlp right now.
Other use I see is adding YoutubeMusic as a metadata provider (this can lead to automatic metadata extraction in the future) but I am not sure if yt-dlp
would support something like that at this point.
I am concerned about the fact that if yt-dlp
provides song metadata?
I understood the OP's issue as wanting to search music.youtube
instead of youtube.com
to get the music file "as it has less garbage". Maybe I misunderstood?
For single videos, yt-dlp does extract arist, track, album if youtube shows the same.
❯ yt-dlp 7wtfhZwyrcc -O title= -O track= -O artist= -O album=
title = 'Imagine Dragons - Believer'
track = 'Believer'
artist = 'Imagine Dragons'
album = 'Believer'
I believe the only other useful metadata music.youtube exposes is the lyrics (which yt-dlp can't extract). Let me know if there is anything else, and it probably can be added
For playlists, yt-dlp indeed cannot currently extract the metadata https://github.com/yt-dlp/yt-dlp/issues/622 (and the issue is not a priority atm)
@pukkandan You did not quite misunderstood. OP wanted to download albums with automatic metadata extraction as well as playlists (as far as I remember from the chat we had on Telegram).
At this point, extracting metadata for playlists is pretty mature. Earlier, we were not able to extract a proper title for the playlists item songs. However, this was changed in the last release where I added support to extract the proper title of the song from the playlist (using ytmusicapi
). This fixed the issue of incorrect title extraction from playlists to somewhat extent.
As a separate motive, I am actually considering adding ytmusic
as a metadata provider. This would be beneficial because youtube and ytmusic share ID's.
So the flow I have in mind is:
yt-dlp
to get the ytmusic metadataLooking at your example above, I think adding support for ytmusic
as a metadata provider would be a nice idea.
anyway i made this myself it's called tiger, you can find it here https://github.com/KraXen72/tiger
as described through telegram, use https://github.com/sigma67/ytmusicapi to get the correct autogenerated video for every song, and also meteadata. this would streamline the process a lot and potentially give ability to download whole albums / artists at once (this would maybe need some external downloader idk)