mirror of https://github.com/yt-dlp/yt-dlp
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.8 KiB
Python
57 lines
1.8 KiB
Python
10 years ago
|
# coding: utf-8
|
||
|
from __future__ import unicode_literals
|
||
|
|
||
|
from .common import InfoExtractor
|
||
8 years ago
|
from .streamable import StreamableIE
|
||
10 years ago
|
|
||
|
|
||
|
class FootyRoomIE(InfoExtractor):
|
||
8 years ago
|
_VALID_URL = r'https?://footyroom\.com/matches/(?P<id>\d+)'
|
||
10 years ago
|
_TESTS = [{
|
||
8 years ago
|
'url': 'http://footyroom.com/matches/79922154/hull-city-vs-chelsea/review',
|
||
10 years ago
|
'info_dict': {
|
||
8 years ago
|
'id': '79922154',
|
||
|
'title': 'VIDEO Hull City 0 - 2 Chelsea',
|
||
10 years ago
|
},
|
||
8 years ago
|
'playlist_count': 2,
|
||
|
'add_ie': [StreamableIE.ie_key()],
|
||
10 years ago
|
}, {
|
||
8 years ago
|
'url': 'http://footyroom.com/matches/75817984/georgia-vs-germany/review',
|
||
10 years ago
|
'info_dict': {
|
||
8 years ago
|
'id': '75817984',
|
||
|
'title': 'VIDEO Georgia 0 - 2 Germany',
|
||
10 years ago
|
},
|
||
|
'playlist_count': 1,
|
||
8 years ago
|
'add_ie': ['Playwire']
|
||
10 years ago
|
}]
|
||
10 years ago
|
|
||
|
def _real_extract(self, url):
|
||
|
playlist_id = self._match_id(url)
|
||
|
|
||
|
webpage = self._download_webpage(url, playlist_id)
|
||
|
|
||
8 years ago
|
playlist = self._parse_json(self._search_regex(
|
||
|
r'DataStore\.media\s*=\s*([^;]+)', webpage, 'media data'),
|
||
10 years ago
|
playlist_id)
|
||
|
|
||
|
playlist_title = self._og_search_title(webpage)
|
||
|
|
||
|
entries = []
|
||
|
for video in playlist:
|
||
|
payload = video.get('payload')
|
||
|
if not payload:
|
||
|
continue
|
||
8 years ago
|
playwire_url = self._html_search_regex(
|
||
10 years ago
|
r'data-config="([^"]+)"', payload,
|
||
|
'playwire url', default=None)
|
||
|
if playwire_url:
|
||
10 years ago
|
entries.append(self.url_result(self._proto_relative_url(
|
||
|
playwire_url, 'http:'), 'Playwire'))
|
||
10 years ago
|
|
||
8 years ago
|
streamable_url = StreamableIE._extract_url(payload)
|
||
|
if streamable_url:
|
||
|
entries.append(self.url_result(
|
||
|
streamable_url, StreamableIE.ie_key()))
|
||
|
|
||
10 years ago
|
return self.playlist_result(entries, playlist_id, playlist_title)
|