]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/cnbc.py
[ie/Boosty] Add extractor (#9144)
[yt-dlp.git] / yt_dlp / extractor / cnbc.py
CommitLineData
c02ec7d4 1from .common import InfoExtractor
94db1f7f 2from ..utils import smuggle_url
c02ec7d4 3
4
5class CNBCIE(InfoExtractor):
6 _VALID_URL = r'https?://video\.cnbc\.com/gallery/\?video=(?P<id>[0-9]+)'
7 _TEST = {
8 'url': 'http://video.cnbc.com/gallery/?video=3000503714',
c02ec7d4 9 'info_dict': {
10 'id': '3000503714',
11 'ext': 'mp4',
ce548296 12 'title': 'Fighting zombies is big business',
13 'description': 'md5:0c100d8e1a7947bd2feec9a5550e519e',
79ba9140 14 'timestamp': 1459332000,
15 'upload_date': '20160330',
16 'uploader': 'NBCU-CNBC',
ce548296 17 },
18 'params': {
19 # m3u8 download
20 'skip_download': True,
21 },
19c90e40 22 'skip': 'Dead link',
c02ec7d4 23 }
24
25 def _real_extract(self, url):
26 video_id = self._match_id(url)
27 return {
28 '_type': 'url_transparent',
29 'ie_key': 'ThePlatform',
30 'url': smuggle_url(
31 'http://link.theplatform.com/s/gZWlPC/media/guid/2408950221/%s?mbr=true&manifest=m3u' % video_id,
32 {'force_smil_url': True}),
33 'id': video_id,
34 }
ffa7b2bf 35
36
94db1f7f 37class CNBCVideoIE(InfoExtractor):
8bdd16b4 38 _VALID_URL = r'https?://(?:www\.)?cnbc\.com(?P<path>/video/(?:[^/]+/)+(?P<id>[^./?#&]+)\.html)'
ffa7b2bf 39 _TEST = {
40 'url': 'https://www.cnbc.com/video/2018/07/19/trump-i-dont-necessarily-agree-with-raising-rates.html',
41 'info_dict': {
42 'id': '7000031301',
43 'ext': 'mp4',
94db1f7f 44 'title': "Trump: I don't necessarily agree with raising rates",
ffa7b2bf 45 'description': 'md5:878d8f0b4ebb5bb1dda3514b91b49de3',
46 'timestamp': 1531958400,
47 'upload_date': '20180719',
48 'uploader': 'NBCU-CNBC',
49 },
50 'params': {
ffa7b2bf 51 'skip_download': True,
52 },
19c90e40 53 'skip': 'Dead link',
ffa7b2bf 54 }
55
ffa7b2bf 56 def _real_extract(self, url):
5ad28e7f 57 path, display_id = self._match_valid_url(url).groups()
8bdd16b4 58 video_id = self._download_json(
59 'https://webql-redesign.cnbcfm.com/graphql', display_id, query={
60 'query': '''{
61 page(path: "%s") {
62 vcpsId
63 }
64}''' % path,
65 })['data']['page']['vcpsId']
94db1f7f 66 return self.url_result(
8bdd16b4 67 'http://video.cnbc.com/gallery/?video=%d' % video_id,
94db1f7f 68 CNBCIE.ie_key())