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

Code before:
from .common import InfoExtractor
from ..utils import (
    parse_duration,
    traverse_obj,
)


class WimbledonIE(InfoExtractor):
    _VALID_URL = r'https?://(?:www\.)?wimbledon\.com/en_GB/video/media/(?P<id>[0-9]+).html'
    BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/%s/default_default/index.html?videoId=%s'

    _TESTS = [{
        'url': 'https://www.wimbledon.com/en_GB/video/media/6330247525112.html',
        'info_dict': {
            'id': '6330247525112',
            'ext': 'mp4',
            'timestamp': 1687972186,
            'description': '',
            'thumbnail': 'https://cf-images.eu-west-1.prod.boltdns.net/v1/static/3506358525001/97312363-ba01-4158-8a45-1e51e518c0ff/806b5b8a-22dc-4618-aac9-f73bd6202715/1920x1080/match/image.jpg',
            'upload_date': '20230628',
            'title': 'Coco Gauff | My Wimbledon Inspiration',
            'tags': ['features', 'trending', 'homepage'],
            'uploader_id': '3506358525001',
            'duration': 163072.0,
        },
    }, {
        'url': 'https://www.wimbledon.com/en_GB/video/media/6308703111112.html',
        'info_dict': {
            'id': '6308703111112',
            'ext': 'mp4',
            'thumbnail': 'https://cf-images.eu-west-1.prod.boltdns.net/v1/jit/3506358525001/3144a401-e6b3-4d49-9dfc-627866a2e2de/main/1920x1080/50s720ms/match/image.jpg',
            'description': 'null',
            'upload_date': '20220629',
            'uploader_id': '3506358525001',
            'title': 'Roblox | WimbleWorld ',
            'duration': 101440.0,
            'tags': ['features', 'kids'],
            'timestamp': 1656500867,
        },
    }]

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

Review comment (refactor):
You can use regex for thumbnail URLs if they are too long or if they may change
```suggestion
            'thumbnail': r're:^https://[\w-]+\.prod\.boltdns\.net/[^?#]+/image\.jpg',
```

Code after:
from .common import InfoExtractor
from ..utils import (
    parse_duration,
    traverse_obj,
)


class WimbledonIE(InfoExtractor):
    _VALID_URL = r'https?://(?:www\.)?wimbledon\.com/\w+/video/media/(?P<id>\d+).html'
    _TESTS = [{
        'url': 'https://www.wimbledon.com/en_GB/video/media/6330247525112.html',
        'info_dict': {
            'id': '6330247525112',
            'ext': 'mp4',
            'timestamp': 1687972186,
            'description': '',
            'thumbnail': r're:^https://[\w.-]+\.prod\.boltdns\.net/[^?#]+/image\.jpg',
            'upload_date': '20230628',
            'title': 'Coco Gauff | My Wimbledon Inspiration',
            'tags': ['features', 'trending', 'homepage'],
            'uploader_id': '3506358525001',
            'duration': 163072.0,
        },
    }, {
        'url': 'https://www.wimbledon.com/en_GB/video/media/6308703111112.html',
        'info_dict': {
            'id': '6308703111112',
            'ext': 'mp4',
            'thumbnail': r're:^https://[\w.-]+\.prod\.boltdns\.net/[^?#]+/image\.jpg',
            'description': 'null',
            'upload_date': '20220629',
            'uploader_id': '3506358525001',
            'title': 'Roblox | WimbleWorld ',
            'duration': 101440.0,
            'tags': ['features', 'kids'],
            'timestamp': 1656500867,
        },
    }, {
        'url': 'https://www.wimbledon.com/en_US/video/media/6309327106112.html',
        'only_matching': True,
    }, {
        'url': 'https://www.wimbledon.com/es_Es/video/media/6308377909112.html',
        'only_matching': True,
    }]