]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/mlssoccer.py
[ie/matchtv] Fix extractor (#10190)
[yt-dlp.git] / yt_dlp / extractor / mlssoccer.py
CommitLineData
7b5f3f7c
AG
1from .common import InfoExtractor
2
3
4class MLSSoccerIE(InfoExtractor):
5 _VALID_DOMAINS = r'(?:(?:cfmontreal|intermiamicf|lagalaxy|lafc|houstondynamofc|dcunited|atlutd|mlssoccer|fcdallas|columbuscrew|coloradorapids|fccincinnati|chicagofirefc|austinfc|nashvillesc|whitecapsfc|sportingkc|soundersfc|sjearthquakes|rsl|timbers|philadelphiaunion|orlandocitysc|newyorkredbulls|nycfc)\.com|(?:torontofc)\.ca|(?:revolutionsoccer)\.net)'
add96eb9 6 _VALID_URL = rf'https?://(?:www\.)?{_VALID_DOMAINS}/video/#?(?P<id>[^/&$#?]+)'
7b5f3f7c
AG
7
8 _TESTS = [{
9 'url': 'https://www.mlssoccer.com/video/the-octagon-can-alphonso-davies-lead-canada-to-first-world-cup-since-1986#the-octagon-can-alphonso-davies-lead-canada-to-first-world-cup-since-1986',
10 'info_dict': {
11 'id': '6276033198001',
12 'ext': 'mp4',
13 'title': 'The Octagon | Can Alphonso Davies lead Canada to first World Cup since 1986?',
14 'description': 'md5:f0a883ee33592a0221798f451a98be8f',
15 'thumbnail': 'https://cf-images.us-east-1.prod.boltdns.net/v1/static/5530036772001/1bbc44f6-c63c-4981-82fa-46b0c1f891e0/5c1ca44a-a033-4e98-b531-ff24c4947608/160x90/match/image.jpg',
16 'duration': 350.165,
17 'timestamp': 1633627291,
18 'uploader_id': '5530036772001',
19 'tags': ['club/canada'],
20 'is_live': False,
7b5f3f7c 21 'upload_date': '20211007',
add96eb9 22 'filesize_approx': 255193528.83200002,
7b5f3f7c 23 },
add96eb9 24 'params': {'skip_download': True},
7b5f3f7c
AG
25 }, {
26 'url': 'https://www.whitecapsfc.com/video/highlights-san-jose-earthquakes-vs-vancouver-whitecaps-fc-october-23-2021#highlights-san-jose-earthquakes-vs-vancouver-whitecaps-fc-october-23-2021',
add96eb9 27 'only_matching': True,
7b5f3f7c
AG
28 }, {
29 'url': 'https://www.torontofc.ca/video/highlights-toronto-fc-vs-cf-montreal-october-23-2021-x6733#highlights-toronto-fc-vs-cf-montreal-october-23-2021-x6733',
add96eb9 30 'only_matching': True,
7b5f3f7c
AG
31 }, {
32 'url': 'https://www.sportingkc.com/video/post-match-press-conference-john-pulskamp-oct-27-2021#post-match-press-conference-john-pulskamp-oct-27-2021',
add96eb9 33 'only_matching': True,
7b5f3f7c
AG
34 }, {
35 'url': 'https://www.soundersfc.com/video/highlights-seattle-sounders-fc-vs-sporting-kansas-city-october-23-2021',
add96eb9 36 'only_matching': True,
7b5f3f7c
AG
37 }, {
38 'url': 'https://www.sjearthquakes.com/video/#highlights-austin-fc-vs-san-jose-earthquakes-june-19-2021',
add96eb9 39 'only_matching': True,
7b5f3f7c
AG
40 }, {
41 'url': 'https://www.rsl.com/video/2021-u-of-u-health-mic-d-up-vs-colorado-10-16-21#2021-u-of-u-health-mic-d-up-vs-colorado-10-16-21',
add96eb9 42 'only_matching': True,
7b5f3f7c
AG
43 }, {
44 'url': 'https://www.timbers.com/video/highlights-d-chara-asprilla-with-goals-in-portland-timbers-2-0-win-over-san-jose#highlights-d-chara-asprilla-with-goals-in-portland-timbers-2-0-win-over-san-jose',
add96eb9 45 'only_matching': True,
7b5f3f7c
AG
46 }, {
47 'url': 'https://www.philadelphiaunion.com/video/highlights-torvphi',
add96eb9 48 'only_matching': True,
7b5f3f7c
AG
49 }, {
50 'url': 'https://www.orlandocitysc.com/video/highlight-columbus-crew-vs-orlando-city-sc',
add96eb9 51 'only_matching': True,
7b5f3f7c
AG
52 }, {
53 'url': 'https://www.newyorkredbulls.com/video/all-access-matchday-double-derby-week#all-access-matchday-double-derby-week',
add96eb9 54 'only_matching': True,
7b5f3f7c
AG
55 }, {
56 'url': 'https://www.nycfc.com/video/highlights-nycfc-1-0-chicago-fire-fc#highlights-nycfc-1-0-chicago-fire-fc',
add96eb9 57 'only_matching': True,
7b5f3f7c
AG
58 }, {
59 'url': 'https://www.revolutionsoccer.net/video/two-minute-highlights-revs-1-rapids-0-october-27-2021#two-minute-highlights-revs-1-rapids-0-october-27-2021',
add96eb9 60 'only_matching': True,
7b5f3f7c
AG
61 }, {
62 'url': 'https://www.nashvillesc.com/video/goal-c-j-sapong-nashville-sc-92nd-minute',
add96eb9 63 'only_matching': True,
7b5f3f7c
AG
64 }, {
65 'url': 'https://www.cfmontreal.com/video/faits-saillants-tor-v-mtl#faits-saillants-orl-v-mtl-x5645',
add96eb9 66 'only_matching': True,
7b5f3f7c
AG
67 }, {
68 'url': 'https://www.intermiamicf.com/video/all-access-victory-vs-nashville-sc-by-ukg#all-access-victory-vs-nashville-sc-by-ukg',
add96eb9 69 'only_matching': True,
7b5f3f7c
AG
70 }, {
71 'url': 'https://www.lagalaxy.com/video/#moment-of-the-month-presented-by-san-manuel-casino-rayan-raveloson-scores-his-se',
add96eb9 72 'only_matching': True,
7b5f3f7c
AG
73 }, {
74 'url': 'https://www.lafc.com/video/breaking-down-lafc-s-final-6-matches-of-the-2021-mls-regular-season#breaking-down-lafc-s-final-6-matches-of-the-2021-mls-regular-season',
add96eb9 75 'only_matching': True,
7b5f3f7c
AG
76 }, {
77 'url': 'https://www.houstondynamofc.com/video/postgame-press-conference-michael-nelson-presented-by-coushatta-casino-res-x9660#postgame-press-conference-michael-nelson-presented-by-coushatta-casino-res-x9660',
add96eb9 78 'only_matching': True,
7b5f3f7c
AG
79 }, {
80 'url': 'https://www.dcunited.com/video/tony-alfaro-my-family-pushed-me-to-believe-everything-was-possible',
add96eb9 81 'only_matching': True,
7b5f3f7c
AG
82 }, {
83 'url': 'https://www.fcdallas.com/video/highlights-fc-dallas-vs-minnesota-united-fc-october-02-2021#highlights-fc-dallas-vs-minnesota-united-fc-october-02-2021',
add96eb9 84 'only_matching': True,
7b5f3f7c
AG
85 }, {
86 'url': 'https://www.columbuscrew.com/video/match-rewind-columbus-crew-vs-new-york-red-bulls-october-23-2021',
add96eb9 87 'only_matching': True,
7b5f3f7c
AG
88 }, {
89 'url': 'https://www.coloradorapids.com/video/postgame-reaction-robin-fraser-october-27#postgame-reaction-robin-fraser-october-27',
add96eb9 90 'only_matching': True,
7b5f3f7c
AG
91 }, {
92 'url': 'https://www.fccincinnati.com/video/#keeping-cincy-chill-presented-by-coors-lite',
add96eb9 93 'only_matching': True,
7b5f3f7c
AG
94 }, {
95 'url': 'https://www.chicagofirefc.com/video/all-access-fire-score-dramatic-road-win-in-cincy#all-access-fire-score-dramatic-road-win-in-cincy',
add96eb9 96 'only_matching': True,
7b5f3f7c
AG
97 }, {
98 'url': 'https://www.austinfc.com/video/highlights-colorado-rapids-vs-austin-fc-september-29-2021#highlights-colorado-rapids-vs-austin-fc-september-29-2021',
add96eb9 99 'only_matching': True,
7b5f3f7c
AG
100 }, {
101 'url': 'https://www.atlutd.com/video/goal-josef-martinez-scores-in-the-73rd-minute#goal-josef-martinez-scores-in-the-73rd-minute',
add96eb9 102 'only_matching': True,
7b5f3f7c
AG
103 }]
104
105 def _real_extract(self, url):
add96eb9 106 video_id = self._match_id(url)
107 webpage = self._download_webpage(url, video_id)
108 data_json = self._parse_json(
109 self._html_search_regex(r'data-options\=\"([^\"]+)\"', webpage, 'json'), video_id)['videoList'][0]
7b5f3f7c 110 return {
add96eb9 111 'id': video_id,
7b5f3f7c 112 '_type': 'url',
add96eb9 113 'url': 'https://players.brightcove.net/{}/default_default/index.html?videoId={}'.format(data_json['accountId'], data_json['videoId']),
7b5f3f7c
AG
114 'ie_key': 'BrightcoveNew',
115 }