[FootyTube] Fixed wrong md5 checksum
[youtube-dl] / youtube_dl / extractor / footyroom.py
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>[^/]+)'
9     _TESTS = [{
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         '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,
24     },
25
26     ]
27
28     def _real_extract(self, url):
29         playlist_id = self._match_id(url)
30
31         webpage = self._download_webpage(url, playlist_id)
32
33         playlist = self._parse_json(
34             self._search_regex(
35                 r'VideoSelector\.load\((\[.+?\])\);', webpage, 'video selector'),
36             playlist_id)
37
38         playlist_title = self._og_search_title(webpage)
39
40         entries = []
41         for video in playlist:
42             payload = video.get('payload')
43             if not payload:
44                 continue
45             playwire_url = self._search_regex(
46                 r'data-config="([^"]+)"', payload,
47                 'playwire url', default=None)
48             if not playwire_url.startswith("http:"):
49                 playwire_url = "http:" + playwire_url
50             if playwire_url:
51                 entries.append(self.url_result(playwire_url, 'Playwire'))
52
53         return self.playlist_result(entries, playlist_id, playlist_title)