aboutsummaryrefslogtreecommitdiffstats
path: root/youtube_dlc/extractor/cnbc.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan@gmail.com>2020-11-20 00:52:59 +0530
committerpukkandan <pukkandan@gmail.com>2020-11-20 13:03:32 +0530
commit8bdd16b4993b8d546b4cbbdbe4710db0bc2f971b (patch)
treec5ba0d26e17bb3102c0b24886853d9a818e875c6 /youtube_dlc/extractor/cnbc.py
parent228385340e9a976f52735078218a9b8ecfe7ae7a (diff)
downloadhypervideo-pre-8bdd16b4993b8d546b4cbbdbe4710db0bc2f971b.tar.lz
hypervideo-pre-8bdd16b4993b8d546b4cbbdbe4710db0bc2f971b.tar.xz
hypervideo-pre-8bdd16b4993b8d546b4cbbdbe4710db0bc2f971b.zip
Merge 'ytdl-org/youtube-dl/master' release 2020.11.19
Old Extractors left behind: VLivePlaylistIE YoutubeSearchURLIE YoutubeShowIE YoutubeFavouritesIE If removing old extractors, make corresponding changes in docs/supportedsites.md youtube_dlc/extractor/extractors.py Not merged: .github/ISSUE_TEMPLATE/1_broken_site.md .github/ISSUE_TEMPLATE/2_site_support_request.md .github/ISSUE_TEMPLATE/3_site_feature_request.md .github/ISSUE_TEMPLATE/4_bug_report.md .github/ISSUE_TEMPLATE/5_feature_request.md test/test_all_urls.py youtube_dlc/version.py Changelog
Diffstat (limited to 'youtube_dlc/extractor/cnbc.py')
-rw-r--r--youtube_dlc/extractor/cnbc.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/youtube_dlc/extractor/cnbc.py b/youtube_dlc/extractor/cnbc.py
index 6889b0f40..7b9f4536a 100644
--- a/youtube_dlc/extractor/cnbc.py
+++ b/youtube_dlc/extractor/cnbc.py
@@ -1,6 +1,7 @@
# coding: utf-8
from __future__ import unicode_literals
+import re
from .common import InfoExtractor
from ..utils import smuggle_url
@@ -38,7 +39,7 @@ class CNBCIE(InfoExtractor):
class CNBCVideoIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?cnbc\.com/video/(?:[^/]+/)+(?P<id>[^./?#&]+)'
+ _VALID_URL = r'https?://(?:www\.)?cnbc\.com(?P<path>/video/(?:[^/]+/)+(?P<id>[^./?#&]+)\.html)'
_TEST = {
'url': 'https://www.cnbc.com/video/2018/07/19/trump-i-dont-necessarily-agree-with-raising-rates.html',
'info_dict': {
@@ -56,11 +57,15 @@ class CNBCVideoIE(InfoExtractor):
}
def _real_extract(self, url):
- display_id = self._match_id(url)
- webpage = self._download_webpage(url, display_id)
- video_id = self._search_regex(
- r'content_id["\']\s*:\s*["\'](\d+)', webpage, display_id,
- 'video id')
+ path, display_id = re.match(self._VALID_URL, url).groups()
+ video_id = self._download_json(
+ 'https://webql-redesign.cnbcfm.com/graphql', display_id, query={
+ 'query': '''{
+ page(path: "%s") {
+ vcpsId
+ }
+}''' % path,
+ })['data']['page']['vcpsId']
return self.url_result(
- 'http://video.cnbc.com/gallery/?video=%s' % video_id,
+ 'http://video.cnbc.com/gallery/?video=%d' % video_id,
CNBCIE.ie_key())