logo

youtube-dl

[mirror] Download/Watch videos from video hostersgit clone https://hacktivis.me/git/mirror/youtube-dl.git

trunews.py (1485B)


  1. from __future__ import unicode_literals
  2. from .common import InfoExtractor
  3. class TruNewsIE(InfoExtractor):
  4. _VALID_URL = r'https?://(?:www\.)?trunews\.com/stream/(?P<id>[^/?#&]+)'
  5. _TEST = {
  6. 'url': 'https://www.trunews.com/stream/will-democrats-stage-a-circus-during-president-trump-s-state-of-the-union-speech',
  7. 'info_dict': {
  8. 'id': '5c5a21e65d3c196e1c0020cc',
  9. 'display_id': 'will-democrats-stage-a-circus-during-president-trump-s-state-of-the-union-speech',
  10. 'ext': 'mp4',
  11. 'title': "Will Democrats Stage a Circus During President Trump's State of the Union Speech?",
  12. 'description': 'md5:c583b72147cc92cf21f56a31aff7a670',
  13. 'duration': 3685,
  14. 'timestamp': 1549411440,
  15. 'upload_date': '20190206',
  16. },
  17. 'add_ie': ['Zype'],
  18. }
  19. _ZYPE_TEMPL = 'https://player.zype.com/embed/%s.js?api_key=X5XnahkjCwJrT_l5zUqypnaLEObotyvtUKJWWlONxDoHVjP8vqxlArLV8llxMbyt'
  20. def _real_extract(self, url):
  21. display_id = self._match_id(url)
  22. zype_id = self._download_json(
  23. 'https://api.zype.com/videos', display_id, query={
  24. 'app_key': 'PUVKp9WgGUb3-JUw6EqafLx8tFVP6VKZTWbUOR-HOm__g4fNDt1bCsm_LgYf_k9H',
  25. 'per_page': 1,
  26. 'active': 'true',
  27. 'friendly_title': display_id,
  28. })['response'][0]['_id']
  29. return self.url_result(self._ZYPE_TEMPL % zype_id, 'Zype', zype_id)