mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-25 00:00:48 +01:00
[ctsnews] Remove news count check (#4802)
That's the number of articles (or at least some constant value); view count is the number of views of the video! Also add a better description so that we can distinguish the two downloads.
This commit is contained in:
parent
03d8d4df38
commit
ec4161a57d
@ -58,7 +58,8 @@ def _real_extract(self, url):
|
|||||||
feed_url = self._html_search_regex(
|
feed_url = self._html_search_regex(
|
||||||
r'(http://news\.cts\.com\.tw/action/mp4feed\.php\?news_id=\d+)',
|
r'(http://news\.cts\.com\.tw/action/mp4feed\.php\?news_id=\d+)',
|
||||||
page, 'feed url')
|
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:
|
else:
|
||||||
self.to_screen('Not CTSPlayer video, trying Youtube...')
|
self.to_screen('Not CTSPlayer video, trying Youtube...')
|
||||||
youtube_url = self._search_regex(
|
youtube_url = self._search_regex(
|
||||||
@ -83,14 +84,6 @@ def _real_extract(self, url):
|
|||||||
datetime_str = datetime_str.replace('/', '-') + ':00+0800'
|
datetime_str = datetime_str.replace('/', '-') + ':00+0800'
|
||||||
timestamp = parse_iso8601(datetime_str, delimiter=' ')
|
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 {
|
return {
|
||||||
'id': news_id,
|
'id': news_id,
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
@ -98,5 +91,4 @@ def _real_extract(self, url):
|
|||||||
'description': description,
|
'description': description,
|
||||||
'thumbnail': thumbnail,
|
'thumbnail': thumbnail,
|
||||||
'timestamp': timestamp,
|
'timestamp': timestamp,
|
||||||
'view_count': news_count,
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user