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