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

Code before:
            'title': 'Theme. Andante',
            'duration': 82,
            'composers': ['Edward Elgar'],
            'artists': ['Vasily Petrenko', 'Royal Liverpool Philharmonic Orchestra'],
            'genres': ['Orchestral', 'Other Orchestral Music'],
            'track': 'Theme. Andante',
            'timestamp': 1554474370,
            'upload_date': '20190405',
        },
    }, {
        'url': 'https://app.idagio.com/recordings/20514467?trackId=20514478&utm_source=pcl',
        'md5': '3acef2ea0feadf889123b70e5a1e7fa7',
        'info_dict': {
            'id': '20514478',
            'ext': 'mp3',
            'title': 'I. Adagio sostenuto',
            'duration': 316,
            'composers': ['Ludwig van Beethoven'],
            'genres': ['Keyboard', 'Sonata (Keyboard)'],
            'track': 'I. Adagio sostenuto',
            'timestamp': 1518076337,
            'upload_date': '20180208',
        },
    }, {
        'url': 'https://app.idagio.com/de/recordings/20514467?trackId=20514483&utm_source=pcl',
        'md5': 'fe834a94294058ea54cd743ce3ecf624',
        'info_dict': {
            'id': '20514483',
            'ext': 'mp3',
            'title': 'II. Allegretto',
            'duration': 131,
            'composers': ['Ludwig van Beethoven'],
            'genres': ['Keyboard', 'Sonata (Keyboard)'],
            'track': 'II. Allegretto',
            'timestamp': 1518076337,
            'upload_date': '20180208',
        },
        'only_matching': True,
    }]

    def _real_extract(self, url):
        track_id = self._match_id(url)
        track_info = self._download_json(
            f'https://api.idagio.com/v2.0/metadata/tracks/{track_id}',
            track_id, fatal=False, expected_status=406)
        if traverse_obj(track_info, 'error_code') == 'idagio.error.blocked.location':
            self.raise_geo_restricted()

        content_info = self._download_json(
            f'https://api.idagio.com/v1.8/content/track/{track_id}', track_id,
            query={

Review comment (refactor):
For `only_matching` tests, all of the test data is ignored. And since this is just a duplicate of the test above, I would do this:
```suggestion
    }, {
        'url': 'https://app.idagio.com/de/recordings/20514467?trackId=20514483&utm_source=pcl',
        'only_matching': True,
```

Code after:
            'title': 'Theme. Andante',
            'duration': 82,
            'composers': ['Edward Elgar'],
            'artists': ['Vasily Petrenko', 'Royal Liverpool Philharmonic Orchestra'],
            'genres': ['Orchestral', 'Other Orchestral Music'],
            'track': 'Theme. Andante',
            'timestamp': 1554474370,
            'upload_date': '20190405',
        },
    }, {
        'url': 'https://app.idagio.com/recordings/20514467?trackId=20514478&utm_source=pcl',
        'md5': '3acef2ea0feadf889123b70e5a1e7fa7',
        'info_dict': {
            'id': '20514478',
            'ext': 'mp3',
            'title': 'I. Adagio sostenuto',
            'duration': 316,
            'composers': ['Ludwig van Beethoven'],
            'genres': ['Keyboard', 'Sonata (Keyboard)'],
            'track': 'I. Adagio sostenuto',
            'timestamp': 1518076337,
            'upload_date': '20180208',
        },
    }, {
        'url': 'https://app.idagio.com/de/recordings/20514467?trackId=20514478&utm_source=pcl',
        'only_matching': True,
    }]

    def _real_extract(self, url):
        track_id = self._match_id(url)
        track_info = self._download_json(
            f'https://api.idagio.com/v2.0/metadata/tracks/{track_id}',
            track_id, fatal=False, expected_status=406)
        if traverse_obj(track_info, 'error_code') == 'idagio.error.blocked.location':
            self.raise_geo_restricted()

        content_info = self._download_json(
            f'https://api.idagio.com/v1.8/content/track/{track_id}', track_id,
            query={
                'quality': '0',
                'format': '2',
                'client_type': 'web-4',
            })

        return {
            'ext': 'mp3',
            'vcodec': 'none',
            'id': track_id,
            'url': traverse_obj(content_info, ('url', {url_or_none})),
            **traverse_obj(track_info, ('result', {
                'title': ('piece', 'title', {str}),