Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/idagio.py (Python)

Code before:
            'composers': ['Ludwig van Beethoven'],
            'genres': ['Keyboard', 'Sonata (Keyboard)'],
            'timestamp': 1518076337,
            'upload_date': '20180208',
            'modified_timestamp': 1518076337,
            'modified_date': '20180208',
        },
        'playlist_count': 3,
    }]
    _API_URL_TMPL = 'https://api.idagio.com/v2.0/metadata/recordings/{}'

    def _parse_playlist_metadata(self, playlist_info):
        return traverse_obj(playlist_info, {
            'title': ('work', 'title', {str}),
            'timestamp': ('created_at', {int_or_none(scale=1000)}),
            'modified_timestamp': ('created_at', {int_or_none(scale=1000)}),
            'location': ('location', {str}),
            'artists': (('conductor', ('ensembles', ...), ('soloists', ...)), 'name', {str}),
            'composers': ('work', 'composer', 'name', {str}, all),
            'genres': ('work', ('genre', 'subgenre'), 'title', {str}),
            'tags': ('tags', ..., {str}),
        })


class IdagioAlbumIE(IdagioPlaylistBaseIE):
    _VALID_URL = r'https?://(?:www\.)?app\.idagio\.com(?:/[a-z]+)?/albums/(?P<id>[\w-]+)'
    _TESTS = [{
        'url': 'https://app.idagio.com/albums/elgar-enigma-variations-in-the-south-serenade-for-strings',
        'info_dict': {
            'id': 'a9f139b8-f70d-4b8a-a9a4-5fe8d35eaf9c',
            'display_id': 'elgar-enigma-variations-in-the-south-serenade-for-strings',
            'title': 'Elgar: Enigma Variations, In the South, Serenade for Strings',
            'description': '',
            'thumbnail': 'https://idagio-images.global.ssl.fastly.net/albums/880040420521/main.jpg',
            'artists': ['Vasily Petrenko', 'Royal Liverpool Philharmonic Orchestra', 'Edward Elgar'],
            'timestamp': 1553817600,
            'upload_date': '20190329',
            'modified_timestamp': 1562566559.0,
            'modified_date': '20190708',
        },
        'playlist_count': 19,
    }, {
        'url': 'https://app.idagio.com/de/albums/brahms-ein-deutsches-requiem-3B403DF6-62D7-4A42-807B-47173F3E0192',
        'info_dict': {
            'id': '2862ad4e-4a61-45ad-9ce4-7fcf0c2626fe',
            'display_id': 'brahms-ein-deutsches-requiem-3B403DF6-62D7-4A42-807B-47173F3E0192',
            'title': 'Brahms: Ein deutsches Requiem',
            'description': 'GRAMOPHONE CLASSICAL MUSIC AWARDS 2025 Recording of the Year & Choral',
            'thumbnail': 'https://idagio-images.global.ssl.fastly.net/albums/3149020954522/main.jpg',
            'artists': ['Sabine Devieilhe', 'Stéphane Degout', 'Raphaël Pichon', 'Pygmalion', 'Johannes Brahms'],
            'timestamp': 1760054400,

Review comment (suggestion):
```suggestion
    _VALID_URL = r'https?://(?:www\.)?app\.idagio\.com(?:/[a-z]{2})?/albums/(?P<id>[\w-]+)'
```

Code after:
        'info_dict': {
            'id': '20514467',
            'title': 'Sonata for Piano No. 14 in C sharp minor op. 27/2',
            'composers': ['Ludwig van Beethoven'],
            'genres': ['Keyboard', 'Sonata (Keyboard)'],
            'timestamp': 1518076337,
            'upload_date': '20180208',
            'modified_timestamp': 1518076337,
            'modified_date': '20180208',
        },
        'playlist_count': 3,
    }]
    _API_URL_TMPL = 'https://api.idagio.com/v2.0/metadata/recordings/{}'

    def _parse_playlist_metadata(self, playlist_info):
        return traverse_obj(playlist_info, {
            'title': ('work', 'title', {str}),
            'timestamp': ('created_at', {int_or_none(scale=1000)}),
            'modified_timestamp': ('created_at', {int_or_none(scale=1000)}),
            'location': ('location', {str}),
            'artists': (('conductor', ('ensembles', ...), ('soloists', ...)), 'name', {str}),
            'composers': ('work', 'composer', 'name', {str}, all),
            'genres': ('work', ('genre', 'subgenre'), 'title', {str}),
            'tags': ('tags', ..., {str}),
        })


class IdagioAlbumIE(IdagioPlaylistBaseIE):
    _VALID_URL = r'https?://(?:www\.)?app\.idagio\.com(?:/[a-z]{2})?/albums/(?P<id>[\w-]+)'
    _TESTS = [{
        'url': 'https://app.idagio.com/albums/elgar-enigma-variations-in-the-south-serenade-for-strings',
        'info_dict': {
            'id': 'a9f139b8-f70d-4b8a-a9a4-5fe8d35eaf9c',
            'display_id': 'elgar-enigma-variations-in-the-south-serenade-for-strings',
            'title': 'Elgar: Enigma Variations, In the South, Serenade for Strings',
            'description': '',
            'thumbnail': r're:https://.+/albums/880040420521/main\.jpg',
            'artists': ['Vasily Petrenko', 'Royal Liverpool Philharmonic Orchestra', 'Edward Elgar'],
            'timestamp': 1553817600,
            'upload_date': '20190329',
            'modified_timestamp': 1562566559.0,
            'modified_date': '20190708',
        },
        'playlist_count': 19,
    }, {
        'url': 'https://app.idagio.com/de/albums/brahms-ein-deutsches-requiem-3B403DF6-62D7-4A42-807B-47173F3E0192',
        'info_dict': {
            'id': '2862ad4e-4a61-45ad-9ce4-7fcf0c2626fe',
            'display_id': 'brahms-ein-deutsches-requiem-3B403DF6-62D7-4A42-807B-47173F3E0192',
            'title': 'Brahms: Ein deutsches Requiem',
            'description': 'GRAMOPHONE CLASSICAL MUSIC AWARDS 2025 Recording of the Year & Choral',