X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;ds=sidebyside;f=youtube_dl%2Fextractor%2Fctsnews.py;h=1622fc844a1b8d4794fc12694f03f37c00076f15;hb=1058f56e96316e778ed74ad008949c634a582e84;hp=35f3756f5be6a6da1e08875345b44f61845d4730;hpb=e683a48d0e8650e1d9e8c323cacb468b104ea7bc;p=youtube-dl diff --git a/youtube_dl/extractor/ctsnews.py b/youtube_dl/extractor/ctsnews.py index 35f3756f5..1622fc844 100644 --- a/youtube_dl/extractor/ctsnews.py +++ b/youtube_dl/extractor/ctsnews.py @@ -2,13 +2,13 @@ from __future__ import unicode_literals from .common import InfoExtractor -from ..compat import compat_urllib_request from ..utils import parse_iso8601, ExtractorError class CtsNewsIE(InfoExtractor): + IE_DESC = '華視新聞' # https connection failed (Connection reset) - _VALID_URL = r'http://news\.cts\.com\.tw/[a-z]+/[a-z]+/\d+/(?P\d+)\.html' + _VALID_URL = r'https?://news\.cts\.com\.tw/[a-z]+/[a-z]+/\d+/(?P\d+)\.html' _TESTS = [{ 'url': 'http://news.cts.com.tw/cts/international/201501/201501291578109.html', 'md5': 'a9875cb790252b08431186d741beaabe', @@ -58,7 +58,8 @@ class CtsNewsIE(InfoExtractor): feed_url = self._html_search_regex( r'(http://news\.cts\.com\.tw/action/mp4feed\.php\?news_id=\d+)', page, 'feed url') - video_url = self._download_webpage(feed_url, news_id) + video_url = self._download_webpage( + feed_url, news_id, note='Fetching feed') else: self.to_screen('Not CTSPlayer video, trying Youtube...') youtube_url = self._search_regex( @@ -83,14 +84,6 @@ class CtsNewsIE(InfoExtractor): datetime_str = datetime_str.replace('/', '-') + ':00+0800' timestamp = parse_iso8601(datetime_str, delimiter=' ') - # Note: the news count may decrease as time goes by - # It should be a bug in CTS website - req = compat_urllib_request.Request( - 'http://news.cts.com.tw/action/news_count.php?callback=cb&news_id=' + news_id) - req.add_header('Referer', url) - newscount_page = self._download_webpage(req, news_id) - news_count = self._search_regex(r'cb\((\d+)\)', newscount_page, 'news count') - return { 'id': news_id, 'url': video_url, @@ -98,5 +91,4 @@ class CtsNewsIE(InfoExtractor): 'description': description, 'thumbnail': thumbnail, 'timestamp': timestamp, - 'view_count': news_count, }