X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Fextractor%2Fcbsnews.py;h=17bb9af4fe2a8a0066611a2bbc2d090ad7cf5e30;hb=3995d37da58ed071b54b7f81757cff4d534f5b9b;hp=480435e26114cbdf4be2bf177a2dbc2c8381420e;hpb=e9bd0f772b28176e86cfe8c641b6281a96be2ee4;p=youtube-dl diff --git a/youtube_dl/extractor/cbsnews.py b/youtube_dl/extractor/cbsnews.py index 480435e26..17bb9af4f 100644 --- a/youtube_dl/extractor/cbsnews.py +++ b/youtube_dl/extractor/cbsnews.py @@ -1,16 +1,17 @@ -# encoding: utf-8 +# coding: utf-8 from __future__ import unicode_literals -import re -import json - from .common import InfoExtractor -from ..utils import remove_start +from .cbs import CBSIE +from ..utils import ( + parse_duration, +) -class CBSNewsIE(InfoExtractor): +class CBSNewsIE(CBSIE): + IE_NAME = 'cbsnews' IE_DESC = 'CBS News' - _VALID_URL = r'http://(?:www\.)?cbsnews\.com/(?:[^/]+/)+(?P[\da-z_-]+)' + _VALID_URL = r'https?://(?:www\.)?cbsnews\.com/(?:news|videos)/(?P[\da-z_-]+)' _TESTS = [ { @@ -26,14 +27,19 @@ class CBSNewsIE(InfoExtractor): # rtmp download 'skip_download': True, }, + 'skip': 'Subscribers only', }, { 'url': 'http://www.cbsnews.com/videos/fort-hood-shooting-army-downplays-mental-illness-as-cause-of-attack/', 'info_dict': { - 'id': 'fort-hood-shooting-army-downplays-mental-illness-as-cause-of-attack', - 'ext': 'flv', + 'id': 'SNJBOYzXiWBOvaLsdzwH8fmtP1SCd91Y', + 'ext': 'mp4', 'title': 'Fort Hood shooting: Army downplays mental illness as cause of attack', - 'thumbnail': 're:^https?://.*\.jpg$', + 'description': 'md5:4a6983e480542d8b333a947bfc64ddc7', + 'upload_date': '20140404', + 'timestamp': 1396650660, + 'uploader': 'CBSI-NEW', + 'thumbnail': r're:^https?://.*\.jpg$', 'duration': 205, 'subtitles': { 'en': [{ @@ -42,66 +48,60 @@ class CBSNewsIE(InfoExtractor): }, }, 'params': { - # rtmp download + # m3u8 download 'skip_download': True, }, }, ] def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) - video_id = mobj.group('id') + video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) - video_info = json.loads(self._html_search_regex( + video_info = self._parse_json(self._html_search_regex( r'(?: