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

Code before:
        },
        'expected_warnings': ['unable to extract player_data'],
    }]

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

        webpage = self._download_webpage(url, video_id)

        player_data = self._search_json(
            r'<rainews-player\s*data=\'', webpage, 'player_data', video_id,
            transform_source=clean_html, fatal=False)
        track_info = player_data.get('track_info')
        relinker_url = player_data.get('mediapolis') or player_data.get('content_url') or None

        if not relinker_url:
            # fallback on old implementation for some old content
            try:
                return self._extract_from_content_id(video_id, url)
            except GeoRestrictedError:
                raise
            except ExtractorError:
                raise ExtractorError('Relinker URL not found')

        relinker_info = self._extract_relinker_info(
            urljoin(url, relinker_url), video_id)
        self._sort_formats(relinker_info['formats'])

        info = {
            'id': video_id,
            'title': track_info.get('title') or self._og_search_title(webpage),
            'upload_date': unified_strdate(track_info.get('date')),
            'uploader': strip_or_none(track_info.get('editor') or None),
        }

        info.update(relinker_info)

        return info


Review comment (refactor):
```suggestion
        relinker_info = self._extract_relinker_info(urljoin(url, relinker_url), video_id)
```

Code after:
            'title': 'Weekend al cinema, da Hollywood arriva il thriller di Tate Taylor "La ragazza del treno"',
            'description': 'I film in uscita questa settimana.',
            'thumbnail': r're:^https?://.*\.png$',
            'duration': 833,
            'upload_date': '20161103'
        },
        'expected_warnings': ['unable to extract player_data'],
    }]

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

        webpage = self._download_webpage(url, video_id)

        player_data = self._search_json(
            r'<rainews-player\s*data=\'', webpage, 'player_data', video_id,
            transform_source=clean_html, fatal=False)
        track_info = player_data.get('track_info')
        relinker_url = traverse_obj(player_data, 'mediapolis', 'content_url')

        if not relinker_url:
            # fallback on old implementation for some old content
            try:
                return self._extract_from_content_id(video_id, url)
            except GeoRestrictedError:
                raise
            except ExtractorError as e:
                raise ExtractorError('Relinker URL not found', cause=e)

        relinker_info = self._extract_relinker_info(urljoin(url, relinker_url), video_id)
        self._sort_formats(relinker_info['formats'])

        return {
            'id': video_id,
            'title': track_info.get('title') or self._og_search_title(webpage),
            'upload_date': unified_strdate(track_info.get('date')),
            'uploader': strip_or_none(track_info.get('editor') or None),
            **relinker_info
        }