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

Code before:
    }]

    def _real_extract(self, url):
        video_id = self._match_id(url)
        release = self._download_json(
            f'https://api.ninaprotocol.com/v1/releases/{video_id}', video_id)['release']

        video_id = release.get('publicKey') or video_id

        common_info = traverse_obj(release, {
            'album': ('metadata', 'properties', 'title', {str}),
            'album_artist': ((('hub', 'data'), 'publisherAccount'), 'displayName', {str}),
            'timestamp': ('datetime', {parse_iso8601}),
            'thumbnail': ('metadata', 'image', {url_or_none}),
            'uploader': ('publisherAccount', 'handle', {str}),
            'uploader_id': ('publisherAccount', 'publicKey', {str}),
            'channel': ('hub', 'handle', {str}),
            'channel_id': ('hub', 'publicKey', {str}),
        }, get_all=False)
        common_info['tags'] = traverse_obj(release, ('metadata', 'properties', 'tags', ..., {str}))

        entries = []
        for i, track in enumerate(traverse_obj(release, (
                'metadata', 'properties', 'files', lambda _, v: url_or_none(v['uri']), {dict}))):
            entries.append({
                'id': f'{video_id}_{i + 1}',
                'url': track['uri'],
                **traverse_obj(track, {
                    'title': ('track_title', {str}),
                    'track': ('track_title', {str}),
                    'ext': ('type', {mimetype2ext}),
                    'track_number': ('track', {int_or_none}),
                    'duration': ('duration', {int_or_none}),
                }),
                'vcodec': 'none',
                **common_info,
            })

        return {
            '_type': 'playlist',
            'id': video_id,
            'entries': entries,
            **traverse_obj(release, {
                'display_id': ('slug', {str}),
                'title': ('metadata', 'name', {str}),
                'description': ('metadata', 'description', {str}),
            }),
            **common_info,
        }


Review comment (suggestion):
don't need to expect `{dict}` since the filter already takes care of that, and we could start the enumeration from 1
```suggestion
        for track_num, track in enumerate(traverse_obj(release, (
                'metadata', 'properties', 'files', lambda _, v: url_or_none(v['uri']))), 1):
            entries.append({
                'id': f'{video_id}_{track_num}',
```

Code after:
    }]

    def _real_extract(self, url):
        video_id = self._match_id(url)
        release = self._download_json(
            f'https://api.ninaprotocol.com/v1/releases/{video_id}', video_id)['release']

        video_id = release.get('publicKey') or video_id

        common_info = traverse_obj(release, {
            'album': ('metadata', 'properties', 'title', {str}),
            'album_artist': ((('hub', 'data'), 'publisherAccount'), 'displayName', {str}),
            'timestamp': ('datetime', {parse_iso8601}),
            'thumbnail': ('metadata', 'image', {url_or_none}),
            'uploader': ('publisherAccount', 'handle', {str}),
            'uploader_id': ('publisherAccount', 'publicKey', {str}),
            'channel': ('hub', 'handle', {str}),
            'channel_id': ('hub', 'publicKey', {str}),
        }, get_all=False)
        common_info['tags'] = traverse_obj(release, ('metadata', 'properties', 'tags', ..., {str}))

        entries = []
        for track_num, track in enumerate(traverse_obj(release, (
                'metadata', 'properties', 'files', lambda _, v: url_or_none(v['uri']))), 1):
            entries.append({
                'id': f'{video_id}_{track_num}',
                'url': track['uri'],
                **traverse_obj(track, {
                    'title': ('track_title', {str}),
                    'track': ('track_title', {str}),
                    'ext': ('type', {mimetype2ext}),
                    'track_number': ('track', {int_or_none}),
                    'duration': ('duration', {int_or_none}),
                }),
                'vcodec': 'none',
                **common_info,
            })

        return {
            '_type': 'playlist',
            'id': video_id,
            'entries': entries,
            **traverse_obj(release, {
                'display_id': ('slug', {str}),
                'title': ('metadata', 'name', {str}),
                'description': ('metadata', 'description', {str}),
            }),
            **common_info,
        }