]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/footyroom.py
[ie/matchtv] Fix extractor (#10190)
[yt-dlp.git] / yt_dlp / extractor / footyroom.py
CommitLineData
71705fa7 1from .common import InfoExtractor
c452e69d 2from .streamable import StreamableIE
71705fa7
S
3
4
5class FootyRoomIE(InfoExtractor):
c452e69d 6 _VALID_URL = r'https?://footyroom\.com/matches/(?P<id>\d+)'
7d2ba639 7 _TESTS = [{
c452e69d 8 'url': 'http://footyroom.com/matches/79922154/hull-city-vs-chelsea/review',
71705fa7 9 'info_dict': {
c452e69d
YCH
10 'id': '79922154',
11 'title': 'VIDEO Hull City 0 - 2 Chelsea',
71705fa7 12 },
c452e69d
YCH
13 'playlist_count': 2,
14 'add_ie': [StreamableIE.ie_key()],
ac58e68b 15 }, {
c452e69d 16 'url': 'http://footyroom.com/matches/75817984/georgia-vs-germany/review',
7d2ba639 17 'info_dict': {
c452e69d
YCH
18 'id': '75817984',
19 'title': 'VIDEO Georgia 0 - 2 Germany',
7d2ba639 20 },
21 'playlist_count': 1,
add96eb9 22 'add_ie': ['Playwire'],
ac58e68b 23 }]
71705fa7
S
24
25 def _real_extract(self, url):
26 playlist_id = self._match_id(url)
27
28 webpage = self._download_webpage(url, playlist_id)
29
c452e69d
YCH
30 playlist = self._parse_json(self._search_regex(
31 r'DataStore\.media\s*=\s*([^;]+)', webpage, 'media data'),
71705fa7
S
32 playlist_id)
33
34 playlist_title = self._og_search_title(webpage)
35
36 entries = []
37 for video in playlist:
38 payload = video.get('payload')
39 if not payload:
40 continue
c452e69d 41 playwire_url = self._html_search_regex(
71705fa7
S
42 r'data-config="([^"]+)"', payload,
43 'playwire url', default=None)
44 if playwire_url:
504c1ced
S
45 entries.append(self.url_result(self._proto_relative_url(
46 playwire_url, 'http:'), 'Playwire'))
71705fa7 47
c452e69d
YCH
48 streamable_url = StreamableIE._extract_url(payload)
49 if streamable_url:
50 entries.append(self.url_result(
51 streamable_url, StreamableIE.ie_key()))
52
71705fa7 53 return self.playlist_result(entries, playlist_id, playlist_title)