Skip to content

[ytmusic] Parse metadata from music.youtube.com #622

Description

@benggc

Checklist

  • I'm reporting a site feature request
  • I've verified that I'm running yt-dlp version 2021.08.02
  • I've searched the bugtracker for similar site feature requests including closed ones

Description

Hello, I'd like to ask for help another time. Would someone be able to implement the following feature:
If using following syntax:
--output "x:/muzik/%%(artist)s %%(album)s %%(release_year)s
It will work as expected, extract the song artists album name and song release year. But in most cases, there are many artist on a song and the song's were released in different year which produces multiple folders instead of ARTIST-ALBUM-RELEASE_YEAR it creates multiple folders: ARTIST1_ARTIST2_ALBUM_RELEASE_YEAR1 and ARTIST1_ARTIST2_ARTIST3_ALBUM_RELEASEYEAR2 which becomes confusing.

In my opinion the best solution would be able to to parse the album main artist and album release year (pic related) with a tag like %%(main_artist)s and %%(album_release_year). Maybe there is such a option, I tried various tags like 'creator' or 'uploader' or 'album_artist' but none of them work!
image

Thanks for reading and any input is appreciated!

Activity

  1. pukkandan commented on Aug 3, 2021

    @pukkandan
    Member

    Give example URL

  2. benggc commented on Aug 3, 2021

    @benggc
    Author

    Thanks for the input, here wait till track number 3.
    my full output template:
    --output X:/ytdlp/%(artist)s %(album)s %(release_year)s/%(playlist_index)s %(artist)s %(track)s.%(ext)s
    https://music.youtube.com/playlist?list=OLAK5uy_mRIIP5Yb0dvfvSWmIhYXicwNU0TKpN68w

    Multiple artist, not even listed on ytmusic site getting parsed.

  3. pukkandan commented on Aug 4, 2021

    @pukkandan
    Member

    Multiple artist, not even listed on ytmusic site getting parsed.

    While yt-dlp accepts music URL, we actually parse data from youtube.com not ytmusic

    The equivalent youtube page doesnt seem to contain this information - https://www.youtube.com/playlist?list=OLAK5uy_mRIIP5Yb0dvfvSWmIhYXicwNU0TKpN68w

  4. changed the title [-][ytmusic]Parse only main album artist and album release year.[/-] [+][ytmusic] Parse metadata from music.youtube.com[/+] on Aug 4, 2021
  5. benggc commented on Aug 4, 2021

    @benggc
    Author

    Any plans to add this feature? Would be really useful.

  6. coletdjnz commented on Sep 26, 2021

    @coletdjnz
    Member

    Does this metadata only show up for playlist ids starting with OLAK?

    If so, I notice we could probably squeeze at least the page download in here:

    if smuggled_data.get('is_music_url'):
    if item_id[:2] == 'VL':
    # Youtube music VL channels have an equivalent playlist
    item_id = item_id[2:]
    pre, tab, post, is_channel = 'https://www.youtube.com/playlist?list=%s' % item_id, '', '', False
    elif item_id[:2] == 'MP':
    # Youtube music albums (/channel/MP...) have a OLAK playlist that can be extracted from the webpage
    item_id = self._search_regex(
    r'\\x22audioPlaylistId\\x22:\\x22([0-9A-Za-z_-]+)\\x22',
    self._download_webpage('https://music.youtube.com/channel/%s' % item_id, item_id),
    'playlist id')
    pre, tab, post, is_channel = 'https://www.youtube.com/playlist?list=%s' % item_id, '', '', False
    elif mobj['channel_type'] == 'browse':
    # Youtube music /browse/ should be changed to /channel/
    pre = 'https://www.youtube.com/channel/%s' % item_id

  7. benggc commented on Sep 29, 2021

    @benggc
    Author

    @coletdjnz
    Hey, sorry for the late reply been AFK lately. Thanks for your contribution to this issue!
    I didn't see that those id's begin with OLAK until you mentioned this.
    I checked some albums and indeed they all begin with OLAK!
    Could you please elaborate a little more, how we could fix this issue with the information you provided? I can't really understand it from the snippet.
    Greetings

  8. coletdjnz commented on Sep 29, 2021

    @coletdjnz
    Member

    I checked some albums and indeed they all begin with OLAK!

    Cool, so that's one way we could detect to check for the extra metadata. Thanks.

    Could you please elaborate a little more, how we could fix this issue with the information you provided? I can't really understand it from the snippet.

    Don't worry about that, I'm just referencing ways we could implement this in code 😃

  9. kasper9n commented on Apr 25, 2022

    @kasper9n

    Another thing here is that the YouTube Music cover artwork should be used as the thumbnail, instead of the youtube.com 16:9 one

  10. Esokrates commented on Jul 16, 2022

    @Esokrates
    Contributor

    @pukkandan I saw your comment in deepjyoti30/ytmdl#202 (comment) however, this is not reproducible anymore:

    yt-dlp 7wtfhZwyrcc -O title= -O track= -O artist= -O album=
    title = 'Imagine Dragons - Believer (Official Music Video)'
    track = 'NA'
    artist = 'NA'
    album = 'NA'
    

    Would be really awesome if all the metadata could be fetched from Youtube music directly, this would eliminate the need to use third party tools that use youtube-dl to download the song and fetch metadata from other sources requiring careful manual intervention in order not to fetch the wrong metadata. So this would make things much better in terms of music collections!

  11. pukkandan commented on Jul 16, 2022

    @pukkandan
    Member

    @Esokrates Metadata extraction of songs is currently broken #4217

  12. ge9 commented on Sep 27, 2022

    @ge9

    Thanks for the input, here wait till track number 3. my full output template: --output X:/ytdlp/%(artist)s %(album)s %(release_year)s/%(playlist_index)s %(artist)s %(track)s.%(ext)s https://music.youtube.com/playlist?list=OLAK5uy_mRIIP5Yb0dvfvSWmIhYXicwNU0TKpN68w

    Multiple artist, not even listed on ytmusic site getting parsed.

    The playlist seems to have different IDs between the "music.youtube.com" and "www.youtube.com" versions (another example from me is: https://music.youtube.com/playlist?list=OLAK5uy_nHB9DSjQxYMXFKwFIZz1WXXoZuQ4AxYuQ).
    In such cases, yt-dlp cannot collect IDs from the "music.youtube.com" version (even with the --extractor-args "youtube:player_client=web_music" option).
    If needed, I'll create another issue.

  13. moved this to Youtube Music in Major siteson Nov 21, 2022
  14. github-account1111 commented on Apr 30, 2023

    @github-account1111

    Another thing here is that the YouTube Music cover artwork should be used as the thumbnail, instead of the youtube.com 16:9 one

    Would be very useful, because it would eliminate having to do the cropping hacks described in #429 and probably result in higher quality artwork.

  15. lc-guy commented on Oct 15, 2023

    @lc-guy

    yt-dlp's still missing the Album Artist metadata that's available on YT Music. Channel/Uploader name can't be trusted, as the format varies (- Topic vs. official channel, ...), and the description sadly doesn't contain the album artist for feat. tracks/compilations/etc.

  16. anthoncast commented on Nov 19, 2023

    @anthoncast

    I also have to mention this: Cobalt dot tools can parse metadata from description. So not only the year is parsed but also the exact date.
    image
    Would be cool to see this?

  17. IlIllIl commented on May 30, 2025

    @IlIllIl

    Songs uploaded to YTM by user have wrong metadata. The Artists is Music Library Uploads and the date is upload date. Can this also be parsed correctly? And here are some additional metadata under View song credits like https://music.youtube.com/browse/MPTCbLNri2zIij8 (MPTC prefix + video id under browse page).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions