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

Code before:
from .common import InfoExtractor
from ..utils import traverse_obj


class EurosportIE(InfoExtractor):
    _VALID_URL = r'https?://(?:(?:www\.)?eurosport\.(?:com(?:\.tr)?|de|dk|es|fr|hu|it|nl|no|ro)|eurosport.tvn24.pl)/[\w-]+/(?:[\w-]+/[\d-]+/)?[\w.-]+_(?P<id>vid\d+)'
    _TESTS = [{
        'url': 'https://www.eurosport.com/tennis/roland-garros/2022/highlights-rafael-nadal-brushes-aside-caper-ruud-to-win-record-extending-14th-french-open-title_vid1694147/video.shtml',
        'info_dict': {
            'id': '2480939',
            'ext': 'mp4',
            'title': 'Highlights: Rafael Nadal brushes aside Caper Ruud to win record-extending 14th French Open title',
            'description': 'md5:b564db73ecfe4b14ebbd8e62a3692c76',
            'thumbnail': 'https://imgresizer.eurosport.com/unsafe/1280x960/smart/filters:format(jpeg)/origin-imgresizer.eurosport.com/2022/06/05/3388285-69245968-2560-1440.png',
            'duration': 195.0,
            'display_id': 'vid1694147',
            'timestamp': 1654446698,
            'upload_date': '20220605',
        },
    }, {
        'url': 'https://www.eurosport.com/tennis/roland-garros/2022/watch-the-top-five-shots-from-men-s-final-as-rafael-nadal-beats-casper-ruud-to-seal-14th-french-open_vid1694283/video.shtml',
        'info_dict': {
            'id': '2481254',
            'ext': 'mp4',
            'title': 'md5:149dcc5dfb38ab7352acc008cc9fb071',
            'duration': 130.0,
            'thumbnail': 'https://imgresizer.eurosport.com/unsafe/1280x960/smart/filters:format(jpeg)/origin-imgresizer.eurosport.com/2022/06/05/3388422-69248708-2560-1440.png',
            'description': 'md5:a0c8a7f6b285e48ae8ddbe7aa85cfee6',
            'display_id': 'vid1694283',
            'timestamp': 1654456090,
            'upload_date': '20220605',

Review comment (suggestion):
Also:
~~`https://www.tntsports.co.uk/`~~ seems like this domain name has no videos on it and I'm redirected to eurosport.com, or am I geo-blocked?
`https://espanol.eurosport.com/`
Just found out that these domain names can be retrieved from the 'CHANGE VERSION' list at the bottom of the page.
![image](https://github.com/user-attachments/assets/3620679c-f312-4226-9da1-fc11a70010d5)


Code after:
from .common import InfoExtractor
from ..utils import traverse_obj


class EurosportIE(InfoExtractor):
    _VALID_URL = r'''(?x)
        https?://(?:
            (?:(?:www|espanol)\.)?eurosport\.(?:com(?:\.tr)?|de|dk|es|fr|hu|it|nl|no|ro)|
            eurosport\.tvn24\.pl
        )/[\w-]+/(?:[\w-]+/[\d-]+/)?[\w.-]+_(?P<id>vid\d+)
    '''
    _TESTS = [{
        'url': 'https://www.eurosport.com/tennis/roland-garros/2022/highlights-rafael-nadal-brushes-aside-caper-ruud-to-win-record-extending-14th-french-open-title_vid1694147/video.shtml',
        'info_dict': {
            'id': '2480939',
            'ext': 'mp4',
            'title': 'Highlights: Rafael Nadal brushes aside Caper Ruud to win record-extending 14th French Open title',
            'description': 'md5:b564db73ecfe4b14ebbd8e62a3692c76',
            'thumbnail': 'https://imgresizer.eurosport.com/unsafe/1280x960/smart/filters:format(jpeg)/origin-imgresizer.eurosport.com/2022/06/05/3388285-69245968-2560-1440.png',
            'duration': 195.0,
            'display_id': 'vid1694147',
            'timestamp': 1654446698,
            'upload_date': '20220605',
        },
    }, {
        'url': 'https://www.eurosport.com/tennis/roland-garros/2022/watch-the-top-five-shots-from-men-s-final-as-rafael-nadal-beats-casper-ruud-to-seal-14th-french-open_vid1694283/video.shtml',
        'info_dict': {
            'id': '2481254',
            'ext': 'mp4',
            'title': 'md5:149dcc5dfb38ab7352acc008cc9fb071',
            'duration': 130.0,