]> git.bitcoin.ninja Git - youtube-dl/blob - youtube_dl/extractor/espn.py
[dailymotion] Error spelling
[youtube-dl] / youtube_dl / extractor / espn.py
1 from __future__ import unicode_literals
2
3 from .common import InfoExtractor
4
5
6 class ESPNIE(InfoExtractor):
7     _VALID_URL = r'https?://espn\.go\.com/(?:[^/]+/)*(?P<id>[^/]+)'
8     _WORKING = False
9     _TESTS = [{
10         'url': 'http://espn.go.com/video/clip?id=10365079',
11         'info_dict': {
12             'id': 'FkYWtmazr6Ed8xmvILvKLWjd4QvYZpzG',
13             'ext': 'mp4',
14             'title': 'dm_140128_30for30Shorts___JudgingJewellv2',
15             'description': '',
16         },
17         'params': {
18             # m3u8 download
19             'skip_download': True,
20         },
21     }, {
22         'url': 'https://espn.go.com/video/iframe/twitter/?cms=espn&id=10365079',
23         'only_matching': True,
24     }, {
25         'url': 'http://espn.go.com/nba/recap?gameId=400793786',
26         'only_matching': True,
27     }, {
28         'url': 'http://espn.go.com/blog/golden-state-warriors/post/_/id/593/how-warriors-rapidly-regained-a-winning-edge',
29         'only_matching': True,
30     }, {
31         'url': 'http://espn.go.com/sports/endurance/story/_/id/12893522/dzhokhar-tsarnaev-sentenced-role-boston-marathon-bombings',
32         'only_matching': True,
33     }, {
34         'url': 'http://espn.go.com/nba/playoffs/2015/story/_/id/12887571/john-wall-washington-wizards-no-swelling-left-hand-wrist-game-5-return',
35         'only_matching': True,
36     }]
37
38     def _real_extract(self, url):
39         video_id = self._match_id(url)
40
41         webpage = self._download_webpage(url, video_id)
42
43         video_id = self._search_regex(
44             r'class="video-play-button"[^>]+data-id="(\d+)',
45             webpage, 'video id')
46
47         player = self._download_webpage(
48             'https://espn.go.com/video/iframe/twitter/?id=%s' % video_id, video_id)
49
50         pcode = self._search_regex(
51             r'["\']pcode=([^"\']+)["\']', player, 'pcode')
52
53         return self.url_result(
54             'ooyalaexternal:espn:%s:%s' % (video_id, pcode),
55             'OoyalaExternal')