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

Code before:
            return self.url_result(self._og_search_url(webpage))

        if date := traverse_obj(webpage, (
            {find_element(cls='article-item__date')}, {clean_html}, filter,
        )):
            day, month, year = date.replace('.', '').split()
            upload_date = f'{year}{self._MONTH_TABLE[month]:02d}{int(day):02d}'
        else:
            upload_date = None

        player = self._search_json(
            r'App\.Player\.Init\(', webpage, video_id, 'player', transform_source=js_to_json)
        m3u8_url = traverse_obj(player, ('File', {urljoin('https://vod.visir.is/')}))

        return {
            'id': video_id,
            'display_id': display_id,
            'formats': self._extract_m3u8_formats(m3u8_url, video_id, 'mp4'),
            'upload_date': upload_date,
            **traverse_obj(webpage, ({find_element(cls='article-item press-ads')}, {
                'description': ({find_element(cls='-large')}, {clean_html}, filter),
                'view_count': ({find_element(cls='article-item__viewcount')}, {clean_html}, {int_or_none}),
            })),
            **traverse_obj(player, {
                'title': ('Title', {clean_html}),
                'categories': ('Categoryname', {clean_html}, all),
                'duration': ('MediaDuration', {int_or_none}),
                'thumbnail': ('Image', {url_or_none}),
            }),
        }


Review comment (suggestion):
Since we're not branching in the `categories` traversal path, here wedo want to use `filter, all, filter`

The first `filter` is so we don't return `['']`, and the final `filter` is so we don't return an empty list

```suggestion
                'categories': ('Categoryname', {clean_html}, filter, all, filter),
```

Code after:
                raise UnsupportedError(real_url)
            return self.url_result(real_url, self.ie_key())

        upload_date = None
        date_elements = traverse_obj(webpage, (
            {find_element(cls='article-item__date')}, {clean_html}, filter, {str.split}))
        if date_elements and len(date_elements) == 3:
            day, month, year = date_elements
            day = int_or_none(day.rstrip('.'))
            month = month_by_name(month, 'is')
            if day and month and re.fullmatch(r'[0-9]{4}', year):
                upload_date = f'{year}{month:02d}{day:02d}'

        player = self._search_json(
            r'App\.Player\.Init\(', webpage, video_id, 'player', transform_source=js_to_json)
        m3u8_url = traverse_obj(player, ('File', {urljoin('https://vod.visir.is/')}))

        return {
            'id': video_id,
            'display_id': display_id,
            'formats': self._extract_m3u8_formats(m3u8_url, video_id, 'mp4'),
            'upload_date': upload_date,
            **traverse_obj(webpage, ({find_element(cls='article-item press-ads')}, {
                'description': ({find_element(cls='-large')}, {clean_html}, filter),
                'view_count': ({find_element(cls='article-item__viewcount')}, {clean_html}, {int_or_none}),
            })),
            **traverse_obj(player, {
                'title': ('Title', {clean_html}),
                'categories': ('Categoryname', {clean_html}, filter, all, filter),
                'duration': ('MediaDuration', {int_or_none}),
                'thumbnail': ('Image', {url_or_none}),
            }),
        }