]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/footyroom.py
[footyroom] Add extractor (Closes #5000)
[yt-dlp.git] / youtube_dl / extractor / footyroom.py
CommitLineData
71705fa7
S
1# coding: utf-8
2from __future__ import unicode_literals
3
4from .common import InfoExtractor
5
6
7class FootyRoomIE(InfoExtractor):
8 _VALID_URL = r'http://footyroom\.com/(?P<id>[^/]+)'
9 _TEST = {
10 'url': 'http://footyroom.com/schalke-04-0-2-real-madrid-2015-02/',
11 'info_dict': {
12 'id': 'schalke-04-0-2-real-madrid-2015-02',
13 'title': 'Schalke 04 0 – 2 Real Madrid',
14 },
15 'playlist_count': 3,
16 }
17
18 def _real_extract(self, url):
19 playlist_id = self._match_id(url)
20
21 webpage = self._download_webpage(url, playlist_id)
22
23 playlist = self._parse_json(
24 self._search_regex(
25 r'VideoSelector\.load\((\[.+?\])\);', webpage, 'video selector'),
26 playlist_id)
27
28 playlist_title = self._og_search_title(webpage)
29
30 entries = []
31 for video in playlist:
32 payload = video.get('payload')
33 if not payload:
34 continue
35 playwire_url = self._search_regex(
36 r'data-config="([^"]+)"', payload,
37 'playwire url', default=None)
38 if playwire_url:
39 entries.append(self.url_result(playwire_url, 'Playwire'))
40
41 return self.playlist_result(entries, playlist_id, playlist_title)