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.

43 lines
1.5 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. from ..compat import compat_str
  5. from ..utils import int_or_none
  6. class GameInformerIE(InfoExtractor):
  7. _VALID_URL = r'https?://(?:www\.)?gameinformer\.com/(?:[^/]+/)*(?P<id>.+)\.aspx'
  8. _TEST = {
  9. 'url': 'http://www.gameinformer.com/b/features/archive/2015/09/26/replay-animal-crossing.aspx',
  10. 'info_dict': {
  11. 'id': '4515472681001',
  12. 'ext': 'm3u8',
  13. 'title': 'Replay - Animal Crossing',
  14. 'description': 'md5:2e211891b215c85d061adc7a4dd2d930',
  15. 'timestamp': 1443457610706,
  16. },
  17. 'params': {
  18. # m3u8 download
  19. 'skip_download': True,
  20. },
  21. }
  22. def _real_extract(self, url):
  23. display_id = self._match_id(url)
  24. webpage = self._download_webpage(url, display_id)
  25. bc_api_url = self._search_regex(r"getVideo\('([^']+)'", webpage, 'brightcove api url')
  26. json_data = self._download_json(
  27. bc_api_url + '&video_fields=id,name,shortDescription,publishedDate,videoStillURL,length,IOSRenditions',
  28. display_id)
  29. return {
  30. 'id': compat_str(json_data['id']),
  31. 'display_id': display_id,
  32. 'url': json_data['IOSRenditions'][0]['url'],
  33. 'title': json_data['name'],
  34. 'description': json_data.get('shortDescription'),
  35. 'timestamp': int_or_none(json_data.get('publishedDate')),
  36. 'duration': int_or_none(json_data.get('length')),
  37. }