]>
Commit | Line | Data |
---|---|---|
71705fa7 S |
1 | # coding: utf-8 |
2 | from __future__ import unicode_literals | |
3 | ||
4 | from .common import InfoExtractor | |
5 | ||
6 | ||
7 | class FootyRoomIE(InfoExtractor): | |
5886b38d | 8 | _VALID_URL = r'https?://footyroom\.com/(?P<id>[^/]+)' |
7d2ba639 | 9 | _TESTS = [{ |
71705fa7 S |
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, | |
2d929564 | 16 | 'skip': 'Video for this match is not available', |
ac58e68b | 17 | }, { |
7d2ba639 | 18 | 'url': 'http://footyroom.com/georgia-0-2-germany-2015-03/', |
19 | 'info_dict': { | |
20 | 'id': 'georgia-0-2-germany-2015-03', | |
21 | 'title': 'Georgia 0 – 2 Germany', | |
22 | }, | |
23 | 'playlist_count': 1, | |
ac58e68b | 24 | }] |
71705fa7 S |
25 | |
26 | def _real_extract(self, url): | |
27 | playlist_id = self._match_id(url) | |
28 | ||
29 | webpage = self._download_webpage(url, playlist_id) | |
30 | ||
31 | playlist = self._parse_json( | |
32 | self._search_regex( | |
33 | r'VideoSelector\.load\((\[.+?\])\);', webpage, 'video selector'), | |
34 | playlist_id) | |
35 | ||
36 | playlist_title = self._og_search_title(webpage) | |
37 | ||
38 | entries = [] | |
39 | for video in playlist: | |
40 | payload = video.get('payload') | |
41 | if not payload: | |
42 | continue | |
43 | playwire_url = self._search_regex( | |
44 | r'data-config="([^"]+)"', payload, | |
45 | 'playwire url', default=None) | |
46 | if playwire_url: | |
504c1ced S |
47 | entries.append(self.url_result(self._proto_relative_url( |
48 | playwire_url, 'http:'), 'Playwire')) | |
71705fa7 S |
49 | |
50 | return self.playlist_result(entries, playlist_id, playlist_title) |