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

Code before:
            json_data.get('title') or
            self._html_search_meta(('og:title', 'title'), webpage, default=None) or
            f'MSN video {page_id}'
        )
        description = json_data.get('description') or self._html_search_meta('description', webpage, default=None)
        duration = int_or_none(video_metadata.get('duration'))
        uploader = video_metadata.get('uploader') or self._html_search_meta('author', webpage, default=None)
        uploader_id = video_metadata.get('uploaderId')

        # Return result
        return {
            'id': page_id,
            'display_id': display_id,
            'title': unescapeHTML(title),
            'description': unescapeHTML(description) if description else None,
            'duration': duration,
            'uploader': uploader,
            'uploader_id': uploader_id,
            'formats': formats,
        }

    def _extract_embedded_urls(self, webpage, video_id):
        """Extract URLs of embedded videos (e.g., YouTube, Dailymotion) from the webpage."""
        embed_urls = []
        # Use re.findall to extract all iframe src attributes
        iframe_matches = re.findall(r'<iframe[^>]+src=["\'](.*?)["\']', webpage)
        for iframe_src in iframe_matches:
            embed_url = url_or_none(iframe_src)
            if embed_url and any(host in embed_url for host in ('youtube.com', 'dailymotion.com', 'nbcsports.com')):
                embed_urls.append(embed_url)
        # Optional debug: Uncomment to inspect found URLs
        # self._downloader.to_screen(f"Found embedded URLs: {embed_urls}")
        return embed_urls


# Optional: Add to yt-dlp's extractor list if this is a standalone file
if __name__ == '__main__':
    from ..extractor import gen_extractors
    extractors = gen_extractors()
    msn_extractor = MSNIE()
    # Example test
    url = 'https://www.msn.com/en-in/money/video/7-ways-to-get-rid-of-chest-congestion/vi-BBPxU6d'
    result = msn_extractor._real_extract(url)
    print(result)


Review comment (suggestion):
Are the embeds really loaded as iframes? For the couple examples I found they were provided as the `sourceHref` key.

Code after:
            '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)
            formats = []
            subtitles = {}
            for file in traverse_obj(json_data, ('videoMetadata', 'externalVideoFiles', lambda _, v: url_or_none(v['url']))):
                file_url = file['url']
                ext = determine_ext(file_url)
                if ext == 'm3u8':
                    fmts, subs = self._extract_m3u8_formats_and_subtitles(
                        file_url, page_id, 'mp4', m3u8_id='hls', fatal=False)
                    formats.extend(fmts)
                    self._merge_subtitles(subs, target=subtitles)
                elif ext == 'mpd':
                    fmts, subs = self._extract_mpd_formats_and_subtitles(
                        file_url, page_id, mpd_id='dash', fatal=False)
                    formats.extend(fmts)
                    self._merge_subtitles(subs, target=subtitles)
                else:
                    formats.append(
                        traverse_obj(file, {