X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Fextractor%2Ffootyroom.py;h=118325b6d5cd6f29645f94c0d5cc6c719715e400;hb=HEAD;hp=2b4691ae85dd7c254d03f35d424fb8fc25268037;hpb=dc03a42537cba83597ca8acb2bbe03f686f2136c;p=youtube-dl diff --git a/youtube_dl/extractor/footyroom.py b/youtube_dl/extractor/footyroom.py index 2b4691ae8..118325b6d 100644 --- a/youtube_dl/extractor/footyroom.py +++ b/youtube_dl/extractor/footyroom.py @@ -2,27 +2,36 @@ from __future__ import unicode_literals from .common import InfoExtractor +from .streamable import StreamableIE class FootyRoomIE(InfoExtractor): - _VALID_URL = r'http://footyroom\.com/(?P[^/]+)' - _TEST = { - 'url': 'http://footyroom.com/schalke-04-0-2-real-madrid-2015-02/', + _VALID_URL = r'https?://footyroom\.com/matches/(?P\d+)' + _TESTS = [{ + 'url': 'http://footyroom.com/matches/79922154/hull-city-vs-chelsea/review', 'info_dict': { - 'id': 'schalke-04-0-2-real-madrid-2015-02', - 'title': 'Schalke 04 0 – 2 Real Madrid', + 'id': '79922154', + 'title': 'VIDEO Hull City 0 - 2 Chelsea', }, - 'playlist_count': 3, - } + 'playlist_count': 2, + 'add_ie': [StreamableIE.ie_key()], + }, { + 'url': 'http://footyroom.com/matches/75817984/georgia-vs-germany/review', + 'info_dict': { + 'id': '75817984', + 'title': 'VIDEO Georgia 0 - 2 Germany', + }, + 'playlist_count': 1, + 'add_ie': ['Playwire'] + }] def _real_extract(self, url): playlist_id = self._match_id(url) webpage = self._download_webpage(url, playlist_id) - playlist = self._parse_json( - self._search_regex( - r'VideoSelector\.load\((\[.+?\])\);', webpage, 'video selector'), + playlist = self._parse_json(self._search_regex( + r'DataStore\.media\s*=\s*([^;]+)', webpage, 'media data'), playlist_id) playlist_title = self._og_search_title(webpage) @@ -32,10 +41,16 @@ class FootyRoomIE(InfoExtractor): payload = video.get('payload') if not payload: continue - playwire_url = self._search_regex( + playwire_url = self._html_search_regex( r'data-config="([^"]+)"', payload, 'playwire url', default=None) if playwire_url: - entries.append(self.url_result(playwire_url, 'Playwire')) + entries.append(self.url_result(self._proto_relative_url( + playwire_url, 'http:'), 'Playwire')) + + streamable_url = StreamableIE._extract_url(payload) + if streamable_url: + entries.append(self.url_result( + streamable_url, StreamableIE.ie_key())) return self.playlist_result(entries, playlist_id, playlist_title)