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

Code before:
                'height': int_or_none(v.get('height')),
                'fps': float_or_none(v.get('fps')),
            })

        return {
            'id': video_id,
            'formats': formats,
            # Thumbnails are conveniently in the correct format already
            'thumbnails': info.get('thumbnailList'),
            'creator': info.get('author'),
            'uploader_id': info.get('editor'),
            'duration': int_or_none(info.get('duration')),
            'upload_date': unified_strdate(info.get(
                'formattedCreationDate'), day_first=False),
            'title': title,
            'categories': info.get('keywords'),
        }


class WSJArticleIE(InfoExtractor):
    _VALID_URL = r'(?i)https?://(?:www\.)?wsj\.com/(?:articles|opinion)/(?P<id>[^/?#&]+)'
    _WEBPAGE_RE = (
        re.compile(r'(?:id=["\']video|video-|iframe\.html\?guid=|data-src=["\'])([a-fA-F0-9-]{36})'),
    )

    # WSJ started using CloudFront's bot-wall, so this works iff there's a hydrated cookiejar
    _TESTS = [{
        'url': 'https://www.wsj.com/articles/dont-like-china-no-pandas-for-you-1490366939?',
        'info_dict': {
            'id': '4B13FA62-1D8C-45DB-8EA1-4105CB20B362',
            'ext': 'mp4',
            'upload_date': '20170221',
            'uploader_id': 'ralcaraz',
            'title': 'Bao Bao the Panda Leaves for China',
        },
    }, {
        'url': 'https://www.wsj.com/opinion/hamas-hostages-caskets-bibas-family-israel-gaza-29da083b',
        'info_dict': {
            'id': 'CE68D629-8DB8-4CD3-B30A-92112C102054',
            'ext': 'mp4',
            'upload_date': '20241007',
            'uploader_id': 'Tinnes, David',
            'title': 'WSJ Opinion: "Get the Jew": The Crown Heights Riot Revisited',
        },
    }]

    def _real_extract(self, url):
        article_id = self._match_id(url)
        webpage = self._download_webpage(url, article_id, impersonate=True)
        video_id = self._search_regex(self._WEBPAGE_RE, webpage, 'video id')
        return self.url_result(f'wsj:{video_id}', WSJIE.ie_key(), video_id)

Review comment (suggestion):
revert this

the regex pattern is not being changed so keep the diff minimal

comment not necessary; the impersonation warning will raise if curl-cffi isn't present, and eventually we'll have a hatch testing env with curl-cffi
```suggestion
```

Code after:
            })

        return {
            'id': video_id,
            'formats': formats,
            # Thumbnails are conveniently in the correct format already
            'thumbnails': info.get('thumbnailList'),
            'creator': info.get('author'),
            'uploader_id': info.get('editor'),
            'duration': int_or_none(info.get('duration')),
            'upload_date': unified_strdate(info.get(
                'formattedCreationDate'), day_first=False),
            'title': title,
            'categories': info.get('keywords'),
        }


class WSJArticleIE(InfoExtractor):
    _VALID_URL = r'(?i)https?://(?:www\.)?wsj\.com/(?:articles|opinion)/(?P<id>[^/?#&]+)'
    _TESTS = [{
        'url': 'https://www.wsj.com/articles/dont-like-china-no-pandas-for-you-1490366939?',
        'info_dict': {
            'id': '4B13FA62-1D8C-45DB-8EA1-4105CB20B362',
            'ext': 'mp4',
            'upload_date': '20170221',
            'uploader_id': 'ralcaraz',
            'title': 'Bao Bao the Panda Leaves for China',
        },
    }, {
        'url': 'https://www.wsj.com/opinion/hamas-hostages-caskets-bibas-family-israel-gaza-29da083b',
        'info_dict': {
            'id': 'CE68D629-8DB8-4CD3-B30A-92112C102054',
            'ext': 'mp4',
            'upload_date': '20241007',
            'uploader_id': 'Tinnes, David',
            'title': 'WSJ Opinion: "Get the Jew": The Crown Heights Riot Revisited',
        },
    }]

    def _real_extract(self, url):
        article_id = self._match_id(url)
        webpage = self._download_webpage(url, article_id, impersonate=True)
        video_id = self._search_regex(
            r'(?:id=["\']video|video-|iframe\.html\?guid=|data-src=["\'])([a-fA-F0-9-]{36})',
            webpage, 'video id')
        return self.url_result(f'wsj:{video_id}', WSJIE.ie_key(), video_id)