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

Code before:
    }, {
        # DRM protected
        'url': 'https://www.netzkino.de/details/second-best',
        'only_matching': True,
    }]

    def _real_extract(self, url):
        video_id = self._match_id(url)
        webpage = self._download_webpage(url, video_id)
        next_js_data = self._search_nextjs_data(webpage, video_id)

        query = traverse_obj(next_js_data, (
            'props', '__dehydratedState', 'queries', ..., 'state',
            'data', 'data', lambda _, v: v['__typename'] == 'CmsMovie', any))
        if 'DRM' in traverse_obj(query, ('licenses', 'nodes', ..., 'properties', any)):
            self.report_drm(video_id)

        return {
            'id': video_id,
            **traverse_obj(query, {
                'title': ('originalTitle', {clean_html}),
                'age_limit': ('fskRating', {int_or_none}, filter),
                'alt_title': ('originalTitle', {clean_html}, filter),
                'cast': ('cast', 'nodes', ..., 'person', 'name', {clean_html}, filter, all, filter),
                'creators': (('directors', 'writers'), 'nodes', ..., 'person', 'name', {clean_html}, filter, all, filter),
                'categories': ('categories', 'nodes', ..., 'category', 'title', {clean_html}, filter, all, filter),
                'description': ('longSynopsis', {clean_html}, filter),
                'duration': ('runtimeInSeconds', {int_or_none}),
                'location': ('productionCountry', {clean_html}, filter),
                'release_year': ('productionYear', {int_or_none}),
                'thumbnail': ('coverImage', 'masterUrl', {url_or_none}),
                'url': ('videoSource', 'pmdUrl', {urljoin('https://pmd.netzkino-seite.netzkino.de')}),
            }),
        }


Review comment (suggestion):
If you're branching in the traversal path, then you only need `filter`
```suggestion
                'cast': ('cast', 'nodes', ..., 'person', 'name', {clean_html}, filter),
                'creators': (('directors', 'writers'), 'nodes', ..., 'person', 'name', {clean_html}, filter),
                'categories': ('categories', 'nodes', ..., 'category', 'title', {clean_html}, filter),
```

Code after:
    }]

    def _real_extract(self, url):
        video_id = self._match_id(url)
        webpage = self._download_webpage(url, video_id)
        next_js_data = self._search_nextjs_data(webpage, video_id)

        query = traverse_obj(next_js_data, (
            'props', '__dehydratedState', 'queries', ..., 'state',
            'data', 'data', lambda _, v: v['__typename'] == 'CmsMovie', any))
        if 'DRM' in traverse_obj(query, ('licenses', 'nodes', ..., 'properties', {str})):
            self.report_drm(video_id)

        return {
            'id': video_id,
            **traverse_obj(query, {
                'title': ('originalTitle', {clean_html}),
                'age_limit': ('fskRating', {int_or_none}),
                'alt_title': ('originalTitle', {clean_html}, filter),
                'cast': ('cast', 'nodes', ..., 'person', 'name', {clean_html}, filter),
                'creators': (('directors', 'writers'), 'nodes', ..., 'person', 'name', {clean_html}, filter),
                'categories': ('categories', 'nodes', ..., 'category', 'title', {clean_html}, filter),
                'description': ('longSynopsis', {clean_html}, filter),
                'duration': ('runtimeInSeconds', {int_or_none}),
                'location': ('productionCountry', {clean_html}, filter),
                'release_year': ('productionYear', {int_or_none}),
                'thumbnail': ('coverImage', 'masterUrl', {url_or_none}),
                'url': ('videoSource', 'pmdUrl', {urljoin('https://pmd.netzkino-seite.netzkino.de/')}),
            }),
        }