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