mirror of
https://github.com/l1ving/youtube-dl
synced 2025-02-09 13:45:40 +08:00
Update cnbc.py
This commit is contained in:
parent
3b65a6fbf3
commit
082893d66d
@ -1,14 +1,19 @@
|
||||
# coding: utf-8
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import re
|
||||
|
||||
from .common import InfoExtractor
|
||||
from ..utils import smuggle_url
|
||||
from ..utils import (
|
||||
smuggle_url,
|
||||
js_to_json,
|
||||
)
|
||||
|
||||
|
||||
class CNBCIE(InfoExtractor):
|
||||
_VALID_URL = r'https?://video\.cnbc\.com/gallery/\?video=(?P<id>[0-9]+)'
|
||||
_VALID_URL = r'https?://www\.cnbc\.com/video/[0-9]{4}/[0-9]{2}/[0-9]{2}/(?P<title>.+)\.html'
|
||||
_TEST = {
|
||||
'url': 'http://video.cnbc.com/gallery/?video=3000503714',
|
||||
'url': 'https://www.cnbc.com/video/2016/03/30/fighting-zombies-is-big-business.html',
|
||||
'info_dict': {
|
||||
'id': '3000503714',
|
||||
'ext': 'mp4',
|
||||
@ -25,12 +30,23 @@ class CNBCIE(InfoExtractor):
|
||||
}
|
||||
|
||||
def _real_extract(self, url):
|
||||
video_id = self._match_id(url)
|
||||
mob = re.search(self._VALID_URL, url)
|
||||
video_id = mob.group('title')
|
||||
webpage = self._download_webpage(url, video_id)
|
||||
mobj = re.search(
|
||||
r'mpscall\s*=\s*(?P<json_data>[^)]+),\s*mpsopts',
|
||||
webpage)
|
||||
if mobj is None:
|
||||
raise ExtractorError('Unable to extract video urls')
|
||||
|
||||
urls_info = self._parse_json(
|
||||
mobj.group('json_data'), video_id, transform_source = js_to_json)
|
||||
|
||||
return {
|
||||
'_type': 'url_transparent',
|
||||
'ie_key': 'ThePlatform',
|
||||
'url': smuggle_url(
|
||||
'http://link.theplatform.com/s/gZWlPC/media/guid/2408950221/%s?mbr=true&manifest=m3u' % video_id,
|
||||
'http://link.theplatform.com/s/gZWlPC/media/guid/2408950221/%s?mbr=true&manifest=m3u' % urls_info.get('content_id'),
|
||||
{'force_smil_url': True}),
|
||||
'id': video_id,
|
||||
'id': urls_info.get('content_id'),
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user