]> git.bitcoin.ninja Git - youtube-dl/blob - youtube_dl/extractor/foxsports.py
[yandexmusic] Capture and output API errors
[youtube-dl] / youtube_dl / extractor / foxsports.py
1 from __future__ import unicode_literals
2
3 from .common import InfoExtractor
4 from ..utils import smuggle_url
5
6
7 class FoxSportsIE(InfoExtractor):
8     _VALID_URL = r'https?://(?:www\.)?foxsports\.com/(?:[^/]+/)*(?P<id>[^/]+)'
9
10     _TEST = {
11         'url': 'http://www.foxsports.com/video?vid=432609859715',
12         'info_dict': {
13             'id': 'gA0bHB3Ladz3',
14             'ext': 'flv',
15             'title': 'Courtney Lee on going up 2-0 in series vs. Blazers',
16             'description': 'Courtney Lee talks about Memphis being focused.',
17         },
18         'add_ie': ['ThePlatform'],
19     }
20
21     def _real_extract(self, url):
22         video_id = self._match_id(url)
23
24         webpage = self._download_webpage(url, video_id)
25
26         config = self._parse_json(
27             self._search_regex(
28                 r"data-player-config='([^']+)'", webpage, 'data player config'),
29             video_id)
30
31         return self.url_result(smuggle_url(
32             config['releaseURL'] + '&manifest=f4m', {'force_smil_url': True}))