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

Code before:
    }, {
        # Article with social embed
        'url': 'https://www.msn.com/en-in/news/techandscience/watch-earth-sets-and-rises-behind-moon-in-breathtaking-blue-ghost-video/ar-AA1zKoAc',
        'info_dict': {
            'id': 'AA1zKoAc',
            'title': 'Watch: Earth sets and rises behind Moon in breathtaking Blue Ghost video',
            'description': 'md5:0ad51cfa77e42e7f0c46cf98a619dbbf',
            'uploader': 'India Today',
            'uploader_id': 'AAyFWG',
            'tags': 'count:11',
            'timestamp': 1740485034,
            'upload_date': '20250225',
            'release_timestamp': 1740484875,
            'release_date': '20250225',
            'modified_timestamp': 1740488561,
            'modified_date': '20250225',
        },
        'playlist_count': 1,
    }]

    def _real_extract(self, url):
        locale, display_id, page_id = self._match_valid_url(url).group('locale', 'display_id', 'id')

        json_data = self._download_json(
            f'https://assets.msn.com/content/view/v2/Detail/{locale}/{page_id}', page_id,
            note='Downloading JSON metadata')

        common_metadata = traverse_obj(json_data, {
            'title': ('title', {str}),
            'description': (('abstract', ('body', {clean_html})), {str}, filter, any),
            'timestamp': ('createdDateTime', {parse_iso8601}),
            'release_timestamp': ('publishedDateTime', {parse_iso8601}),
            'modified_timestamp': ('updatedDateTime', {parse_iso8601}),
            'thumbnail': ('thumbnail', 'image', 'url', {url_or_none}),
            'duration': ('videoMetadata', 'playTime', {int_or_none}),
            'tags': ('keywords', ..., {str}),
            'uploader': ('provider', 'name', {str}),
            'uploader_id': ('provider', 'id', {str}),
        })

        page_type = traverse_obj(json_data, ('type', {str}))
        source_url = traverse_obj(json_data, ('sourceHref', {url_or_none}))
        if page_type == 'video':
            if traverse_obj(json_data, ('thirdPartyVideoPlayer', 'enabled')) and source_url:
                return self.url_result(source_url)
            formats = []
            subtitles = {}
            for file in traverse_obj(json_data, ('videoMetadata', 'externalVideoFiles', lambda _, v: url_or_none(v['url']))):
                url = file['url']
                ext = determine_ext(url)
                if ext == 'm3u8':

Review comment (suggestion):
'Downloading JSON metadata' is the default note
```suggestion
            f'https://assets.msn.com/content/view/v2/Detail/{locale}/{page_id}', page_id)
```

Code after:
            'tags': ['topthink', 'top think', 'personal growth'],
            'timestamp': 1722711620,
            'upload_date': '20240803',
            'playable_in_embed': True,
            'availability': 'public',
            'live_status': 'not_live',
        },
    }, {
        # Article with social embed
        'url': 'https://www.msn.com/en-in/news/techandscience/watch-earth-sets-and-rises-behind-moon-in-breathtaking-blue-ghost-video/ar-AA1zKoAc',
        'info_dict': {
            'id': 'AA1zKoAc',
            'title': 'Watch: Earth sets and rises behind Moon in breathtaking Blue Ghost video',
            'description': 'md5:0ad51cfa77e42e7f0c46cf98a619dbbf',
            'uploader': 'India Today',
            'uploader_id': 'AAyFWG',
            'tags': 'count:11',
            'timestamp': 1740485034,
            'upload_date': '20250225',
            'release_timestamp': 1740484875,
            'release_date': '20250225',
            'modified_timestamp': 1740488561,
            'modified_date': '20250225',
        },
        'playlist_count': 1,
    }]

    def _real_extract(self, url):
        locale, display_id, page_id = self._match_valid_url(url).group('locale', 'display_id', 'id')

        json_data = self._download_json(
            f'https://assets.msn.com/content/view/v2/Detail/{locale}/{page_id}', page_id)

        common_metadata = traverse_obj(json_data, {
            'title': ('title', {str}),
            'description': (('abstract', ('body', {clean_html})), {str}, filter, any),
            'timestamp': ('createdDateTime', {parse_iso8601}),
            'release_timestamp': ('publishedDateTime', {parse_iso8601}),
            'modified_timestamp': ('updatedDateTime', {parse_iso8601}),
            'thumbnail': ('thumbnail', 'image', 'url', {url_or_none}),
            'duration': ('videoMetadata', 'playTime', {int_or_none}),
            'tags': ('keywords', ..., {str}),
            'uploader': ('provider', 'name', {str}),
            'uploader_id': ('provider', 'id', {str}),
        })

        page_type = json_data['type']
        source_url = traverse_obj(json_data, ('sourceHref', {url_or_none}))
        if page_type == 'video':
            if traverse_obj(json_data, ('thirdPartyVideoPlayer', 'enabled')) and source_url:
                return self.url_result(source_url)