You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.9 KiB

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