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