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

Code before:
                'modified_timestamp': 1660452773,
                'modified_date': '20220814',
                'upload_date': '20220813',
                'thumbnail': 'https://cdn.nos.nl/image/2022/07/18/880346/1024x576a.jpg',
                'timestamp': 1660401384,
            },
            'playlist_count': 2,
        }, {
            # audio + video
            'url': 'https://nos.nl/artikel/2440789-wekdienst-16-8-groningse-acties-tien-jaar-na-zware-aardbeving-femke-bol-in-actie-op-ek-atletiek',
            'info_dict': {
                'id': '2440789',
                'title': 'Wekdienst 16/8: Groningse acties tien jaar na zware aardbeving • Femke Bol in actie op EK atletiek ',
                'description': 'Nieuws, weer, verkeer: met dit overzicht begin je geïnformeerd aan de dag.',
                'tags': ['wekdienst'],
                'modified_date': '20220816',
                'modified_timestamp': 1660625449,
                'timestamp': 1660625449,
                'upload_date': '20220816',
                'thumbnail': 'https://cdn.nos.nl/image/2022/08/16/888178/1024x576a.jpg',
            },
            'playlist_count': 2,
        }
    ]

    def _get_video_generator(self, nextjs_json, display_id):
        for item in nextjs_json['items']:
            if item.get('type') == 'video':
                formats, subtitle = self._extract_m3u8_formats_and_subtitles(
                    traverse_obj(item, ('source', 'url')), display_id, ext='mp4')
                yield {
                    'id': str(item['id']),
                    'title': item.get('title'),
                    'description': item.get('description'),
                    'formats': formats,
                    'subtitles': subtitle,
                    'duration': parse_duration(item.get('duration')),
                    'thumbnails': [{
                        'url': traverse_obj(image, ('url', ...), get_all=False),
                        'width': image.get('width'),
                        'height': image.get('height')
                    } for image in traverse_obj(item, ('imagesByRatio', ...))[0]],
                }

            elif item.get('type') == 'audio':
                yield {
                    'id': str(item['id']),
                    'title': item.get('title'),
                    'url': traverse_obj(item, ('media', 'src')),
                    'ext': 'mp3',
                }

Review comment (suggestion):
```suggestion
    def _entries(self, nextjs_json, display_id):
```

Code after:
                'modified_timestamp': 1660452773,
                'modified_date': '20220814',
                'upload_date': '20220813',
                'thumbnail': 'https://cdn.nos.nl/image/2022/07/18/880346/1024x576a.jpg',
                'timestamp': 1660401384,
            },
            'playlist_count': 2,
        }, {
            # audio + video
            'url': 'https://nos.nl/artikel/2440789-wekdienst-16-8-groningse-acties-tien-jaar-na-zware-aardbeving-femke-bol-in-actie-op-ek-atletiek',
            'info_dict': {
                'id': '2440789',
                'title': 'Wekdienst 16/8: Groningse acties tien jaar na zware aardbeving • Femke Bol in actie op EK atletiek ',
                'description': 'Nieuws, weer, verkeer: met dit overzicht begin je geïnformeerd aan de dag.',
                'tags': ['wekdienst'],
                'modified_date': '20220816',
                'modified_timestamp': 1660625449,
                'timestamp': 1660625449,
                'upload_date': '20220816',
                'thumbnail': 'https://cdn.nos.nl/image/2022/08/16/888178/1024x576a.jpg',
            },
            'playlist_count': 2,
        }
    ]

    def _entries(self, nextjs_json, display_id):
        for item in nextjs_json['items']:
            if item.get('type') == 'video':
                formats, subtitle = self._extract_m3u8_formats_and_subtitles(
                    traverse_obj(item, ('source', 'url')), display_id, ext='mp4')
                yield {
                    'id': str(item['id']),
                    'title': item.get('title'),
                    'description': item.get('description'),
                    'formats': formats,
                    'subtitles': subtitle,
                    'duration': parse_duration(item.get('duration')),
                    'thumbnails': [{
                        'url': traverse_obj(image, ('url', ...), get_all=False),
                        'width': image.get('width'),
                        'height': image.get('height')
                    } for image in traverse_obj(item, ('imagesByRatio', ...))[0]],
                }

            elif item.get('type') == 'audio':
                yield {
                    'id': str(item['id']),
                    'title': item.get('title'),
                    'url': traverse_obj(item, ('media', 'src')),
                    'ext': 'mp3',
                }