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

Code before:
        webpage = self._download_webpage(url, video_id)

        title = self._html_search_regex(r'<h1[^>]+>(.+?)</h1>', webpage, 'title')
        timestamp = unified_timestamp(self._html_search_meta('article:published_time', webpage))

        videos = re.findall(r'(?m)(<video[^>]+>)', webpage)
        entries = []
        for video in videos:
            video_data = extract_attributes(video)
            entries.append({
                '_type': 'url_transparent',
                'url': video_data.get('data-url'),
                'id': video_data.get('id'),
                'title': title,
                'timestamp': timestamp,
                'ie_key': N1InfoAssetIE.ie_key()})

        embedded_videos = re.findall(r'(<iframe[^>]+>)', webpage)
        for embedded_video in embedded_videos:
            video_data = extract_attributes(embedded_video)
            url = video_data.get('src')
            if url.startswith('https://www.youtube.com'):
                entries.append(self.url_result(url, ie=YoutubeIE.ie_key()))
            elif url.startswith('https://www.redditmedia.com'):
                url = 'https://reddit.com' + url[27:]
                entries.append(self.url_result(url, ie=RedditRIE.ie_key()))

        return {
            '_type': 'playlist',
            'id': video_id,
            'title': title,
            'timestamp': timestamp,
            'entries': entries,
            'ie_key': N1InfoAssetIE.ie_key(),
        }


Review comment (refactor):
If all URLs extracted is sure to point to some video, you can just do this
```py
        entries.extend(
			self.url_result(extract_attributes(embedded_video).get('src'))
			for embedded_video in re.findall(r'(<iframe[^>]+>)', webpage))
```
YoutubeDL code will try and figure out what extractor the URL should go to

Code after:
    }]

    def _real_extract(self, url):
        video_id = self._match_id(url)
        webpage = self._download_webpage(url, video_id)

        title = self._html_search_regex(r'<h1[^>]+>(.+?)</h1>', webpage, 'title')
        timestamp = unified_timestamp(self._html_search_meta('article:published_time', webpage))

        videos = re.findall(r'(?m)(<video[^>]+>)', webpage)
        entries = []
        for video in videos:
            video_data = extract_attributes(video)
            entries.append({
                '_type': 'url_transparent',
                'url': video_data.get('data-url'),
                'id': video_data.get('id'),
                'title': title,
                'thumbnail': video_data.get('data-thumbnail'),
                'timestamp': timestamp,
                'ie_key': N1InfoAssetIE.ie_key()})

        embedded_videos = re.findall(r'(<iframe[^>]+>)', webpage)
        for embedded_video in embedded_videos:
            video_data = extract_attributes(embedded_video)
            url = video_data.get('src')
            if url.startswith('https://www.youtube.com'):
                entries.append(self.url_result(url, ie=YoutubeIE.ie_key()))
            elif url.startswith('https://www.redditmedia.com'):
                entries.append(self.url_result(url, ie=RedditRIE.ie_key()))

        return {
            '_type': 'playlist',
            'id': video_id,
            'title': title,
            'timestamp': timestamp,
            'entries': entries,
        }