]>
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): | |
8 | _VALID_URL = r'http://footyroom\.com/(?P<id>[^/]+)' | |
7d2ba639 | 9 | _TESTS = [{ |
71705fa7 | 10 | 'url': 'http://footyroom.com/schalke-04-0-2-real-madrid-2015-02/', |
7d2ba639 | 11 | 'md5': 'f38d400d32f19724570040d5ce3a505f', |
71705fa7 S |
12 | 'info_dict': { |
13 | 'id': 'schalke-04-0-2-real-madrid-2015-02', | |
14 | 'title': 'Schalke 04 0 – 2 Real Madrid', | |
15 | }, | |
16 | 'playlist_count': 3, | |
7d2ba639 | 17 | }, |
18 | { | |
19 | 'url': 'http://footyroom.com/georgia-0-2-germany-2015-03/', | |
20 | 'info_dict': { | |
21 | 'id': 'georgia-0-2-germany-2015-03', | |
22 | 'title': 'Georgia 0 – 2 Germany', | |
23 | }, | |
24 | 'playlist_count': 1, | |
25 | }, | |
26 | ||
27 | ] | |
71705fa7 S |
28 | |
29 | def _real_extract(self, url): | |
30 | playlist_id = self._match_id(url) | |
31 | ||
32 | webpage = self._download_webpage(url, playlist_id) | |
33 | ||
34 | playlist = self._parse_json( | |
35 | self._search_regex( | |
36 | r'VideoSelector\.load\((\[.+?\])\);', webpage, 'video selector'), | |
37 | playlist_id) | |
38 | ||
39 | playlist_title = self._og_search_title(webpage) | |
40 | ||
41 | entries = [] | |
42 | for video in playlist: | |
43 | payload = video.get('payload') | |
44 | if not payload: | |
45 | continue | |
46 | playwire_url = self._search_regex( | |
47 | r'data-config="([^"]+)"', payload, | |
48 | 'playwire url', default=None) | |
7d2ba639 | 49 | if not playwire_url.startswith("http:"): |
50 | playwire_url = "http:" + playwire_url | |
71705fa7 S |
51 | if playwire_url: |
52 | entries.append(self.url_result(playwire_url, 'Playwire')) | |
53 | ||
54 | return self.playlist_result(entries, playlist_id, playlist_title) |