]>
Commit | Line | Data |
---|---|---|
7e760fc1 S |
1 | from __future__ import unicode_literals |
2 | ||
3 | from .common import InfoExtractor | |
69f85952 | 4 | from ..utils import remove_end |
7e760fc1 S |
5 | |
6 | ||
7 | class ESPNIE(InfoExtractor): | |
8 | _VALID_URL = r'https?://espn\.go\.com/(?:[^/]+/)*(?P<id>[^/]+)' | |
7e760fc1 S |
9 | _TESTS = [{ |
10 | 'url': 'http://espn.go.com/video/clip?id=10365079', | |
11 | 'info_dict': { | |
12 | 'id': 'FkYWtmazr6Ed8xmvILvKLWjd4QvYZpzG', | |
13 | 'ext': 'mp4', | |
69f85952 | 14 | 'title': '30 for 30 Shorts: Judging Jewell', |
9f9f7664 | 15 | 'description': None, |
7e760fc1 S |
16 | }, |
17 | 'params': { | |
18 | # m3u8 download | |
19 | 'skip_download': True, | |
20 | }, | |
930087f2 JMF |
21 | }, { |
22 | # intl video, from http://www.espnfc.us/video/mls-highlights/150/video/2743663/must-see-moments-best-of-the-mls-season | |
23 | 'url': 'http://espn.go.com/video/clip?id=2743663', | |
24 | 'info_dict': { | |
25 | 'id': '50NDFkeTqRHB0nXBOK-RGdSG5YQPuxHg', | |
26 | 'ext': 'mp4', | |
69f85952 | 27 | 'title': 'Must-See Moments: Best of the MLS season', |
930087f2 JMF |
28 | }, |
29 | 'params': { | |
30 | # m3u8 download | |
31 | 'skip_download': True, | |
32 | }, | |
7e760fc1 S |
33 | }, { |
34 | 'url': 'https://espn.go.com/video/iframe/twitter/?cms=espn&id=10365079', | |
35 | 'only_matching': True, | |
36 | }, { | |
37 | 'url': 'http://espn.go.com/nba/recap?gameId=400793786', | |
38 | 'only_matching': True, | |
39 | }, { | |
40 | 'url': 'http://espn.go.com/blog/golden-state-warriors/post/_/id/593/how-warriors-rapidly-regained-a-winning-edge', | |
41 | 'only_matching': True, | |
42 | }, { | |
43 | 'url': 'http://espn.go.com/sports/endurance/story/_/id/12893522/dzhokhar-tsarnaev-sentenced-role-boston-marathon-bombings', | |
44 | 'only_matching': True, | |
45 | }, { | |
46 | 'url': 'http://espn.go.com/nba/playoffs/2015/story/_/id/12887571/john-wall-washington-wizards-no-swelling-left-hand-wrist-game-5-return', | |
47 | 'only_matching': True, | |
48 | }] | |
49 | ||
50 | def _real_extract(self, url): | |
51 | video_id = self._match_id(url) | |
52 | ||
53 | webpage = self._download_webpage(url, video_id) | |
54 | ||
55 | video_id = self._search_regex( | |
83ab8a79 S |
56 | r'class=(["\']).*?video-play-button.*?\1[^>]+data-id=["\'](?P<id>\d+)', |
57 | webpage, 'video id', group='id') | |
7e760fc1 | 58 | |
930087f2 JMF |
59 | cms = 'espn' |
60 | if 'data-source="intl"' in webpage: | |
61 | cms = 'intl' | |
62 | player_url = 'https://espn.go.com/video/iframe/twitter/?id=%s&cms=%s' % (video_id, cms) | |
7e760fc1 | 63 | player = self._download_webpage( |
930087f2 | 64 | player_url, video_id) |
7e760fc1 S |
65 | |
66 | pcode = self._search_regex( | |
67 | r'["\']pcode=([^"\']+)["\']', player, 'pcode') | |
68 | ||
69f85952 JMF |
69 | title = remove_end( |
70 | self._og_search_title(webpage), | |
71 | '- ESPN Video').strip() | |
72 | ||
73 | return { | |
74 | '_type': 'url_transparent', | |
75 | 'url': 'ooyalaexternal:%s:%s:%s' % (cms, video_id, pcode), | |
76 | 'ie_key': 'OoyalaExternal', | |
77 | 'title': title, | |
78 | } |