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

Code before:
            '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 (refactor):
Extractors should never be invoked directly.
```suggestion
```

Code after:
            '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, {
                            'url': 'url',
                            'format_id': ('format', {str}),
                            'filesize': ('fileSize', {int_or_none}),
                            'height': ('height', {int_or_none}),
                            'width': ('width', {int_or_none}),
                        }))
            for caption in traverse_obj(json_data, ('videoMetadata', 'closedCaptions', lambda _, v: url_or_none(v['href']))):
                lang = caption.get('locale') or 'en-us'
                subtitles.setdefault(lang, []).append({
                    'url': caption['href'],
                    'ext': 'ttml',
                })

            return {
                'id': page_id,
                'display_id': display_id,
                'formats': formats,
                'subtitles': subtitles,