1 from __future__ import unicode_literals
3 from .common import InfoExtractor
14 class TruNewsIE(InfoExtractor):
15 _VALID_URL = r'https?://(?:www\.)?trunews\.com/stream/(?P<id>[^/?#&]+)'
17 'url': 'https://www.trunews.com/stream/will-democrats-stage-a-circus-during-president-trump-s-state-of-the-union-speech',
18 'md5': 'a19c024c3906ff954fac9b96ce66bb08',
20 'id': '5c5a21e65d3c196e1c0020cc',
21 'display_id': 'will-democrats-stage-a-circus-during-president-trump-s-state-of-the-union-speech',
23 'title': "Will Democrats Stage a Circus During President Trump's State of the Union Speech?",
24 'description': 'md5:c583b72147cc92cf21f56a31aff7a670',
26 'timestamp': 1549411440,
27 'upload_date': '20190206',
32 def _real_extract(self, url):
33 display_id = self._match_id(url)
35 video = self._download_json(
36 'https://api.zype.com/videos', display_id, query={
37 'app_key': 'PUVKp9WgGUb3-JUw6EqafLx8tFVP6VKZTWbUOR-HOm__g4fNDt1bCsm_LgYf_k9H',
40 'friendly_title': display_id,
43 zype_id = video['_id']
46 thumbnails_list = video.get('thumbnails')
47 if isinstance(thumbnails_list, list):
48 for thumbnail in thumbnails_list:
49 if not isinstance(thumbnail, dict):
51 thumbnail_url = url_or_none(thumbnail.get('url'))
56 'width': int_or_none(thumbnail.get('width')),
57 'height': int_or_none(thumbnail.get('height')),
61 '_type': 'url_transparent',
62 'url': update_url_query(
63 'https://player.zype.com/embed/%s.js' % zype_id,
64 {'api_key': 'X5XnahkjCwJrT_l5zUqypnaLEObotyvtUKJWWlONxDoHVjP8vqxlArLV8llxMbyt'}),
67 'display_id': display_id,
68 'title': video.get('title'),
69 'description': dict_get(video, ('description', 'ott_description', 'short_description')),
70 'duration': int_or_none(video.get('duration')),
71 'timestamp': unified_timestamp(video.get('published_at')),
72 'average_rating': float_or_none(video.get('rating')),
73 'view_count': int_or_none(video.get('request_count')),
74 'thumbnails': thumbnails,