1
0
Fork 0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-05-19 03:29:32 +00:00

[channelnewsasia] follow conventions

This commit is contained in:
fourjr 2020-11-22 18:04:45 +08:00
parent 59e9536b98
commit c950d57de6

View file

@ -1,40 +1,36 @@
# coding: utf-8 # coding: utf-8
from __future__ import unicode_literals from __future__ import unicode_literals
import re
from .common import InfoExtractor from .common import InfoExtractor
class ChannelNewsAsiaIE(InfoExtractor): class ChannelNewsAsiaIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?channelnewsasia\.com/(?:(?:-|\w|\d)+)/(?:(?:-|\w|\d)+)/(?P<id>(?:-|\w|\d)+)' _VALID_URL = r'https?://(?:www\.)?channelnewsasia\.com/(?:(?:-|\w|\d)+)/(?:(?:-|\w|\d)+)/(?P<id>(?:-|\w|\d)+)'
_TESTS = [ _TESTS = [{
{ 'url': 'https://www.channelnewsasia.com/news/video-on-demand/wizards-of-tech/wizards-of-tech-body-13515106',
'url': 'https://www.channelnewsasia.com/news/video-on-demand/wizards-of-tech/wizards-of-tech-body-13515106', 'md5': 'ed9ed143052f0da3ee8a8fa59ba16870',
'md5': 'ed9ed143052f0da3ee8a8fa59ba16870', 'info_dict': {
'info_dict': { 'id': 'w0ZWRzajE6qDPXDb7DSeaOCJ3bJ3GDqC',
'id': 'w0ZWRzajE6qDPXDb7DSeaOCJ3bJ3GDqC', 'ext': 'mp4',
'ext': 'mp4', 'title': 'Wizards Of Tech_2020_0_1_Body',
'title': 'Wizards Of Tech_2020_0_1_Body', 'description': 'md5:b3882dd00e329e623a179465de9f5478',
'description': 'md5:b3882dd00e329e623a179465de9f5478',
},
}, },
{ }, {
'url': 'https://www.channelnewsasia.com/news/asia/removing-the-negative-influences-of-religion-in-tibet-video-13604084', 'url': 'https://www.channelnewsasia.com/news/asia/removing-the-negative-influences-of-religion-in-tibet-video-13604084',
'md5': 'ed846cfca037823fa6d3d0d7af8a4e8f', 'md5': 'ed846cfca037823fa6d3d0d7af8a4e8f',
'info_dict': { 'info_dict': {
'id': 'ljZjd0ajE6NNMhVJ3Gb-QfL1l0p-qW6-', 'id': 'ljZjd0ajE6NNMhVJ3Gb-QfL1l0p-qW6-',
'ext': 'mp4', 'ext': 'mp4',
'title': "Removing the 'negative influences of religion' in Tibet | Video", 'title': "Removing the 'negative influences of religion' in Tibet | Video",
'description': 'md5:777989926133319de6f6501372175fbf', 'description': 'md5:777989926133319de6f6501372175fbf',
}, },
} }]
]
def _real_extract(self, url): def _real_extract(self, url):
display_id = self._match_id(url) display_id = self._match_id(url)
webpage = self._download_webpage(url, display_id) webpage = self._download_webpage(url, display_id)
ooyala_id = ( ooyala_id = (
self._search_regex( self._search_regex(
r'id="ooyala-\d+-((?:\d|\w|-)+)--\d+', webpage, 'ooyala id', r'id="ooyala-\d+-((?:\d|\w|-)+)--\d+', webpage, 'ooyala id',
@ -44,5 +40,4 @@ class ChannelNewsAsiaIE(InfoExtractor):
default=None, fatal=False)) default=None, fatal=False))
return self.url_result( return self.url_result(
'ooyala:' + ooyala_id, 'Ooyala', ooyala_id 'ooyala:' + ooyala_id, 'Ooyala', ooyala_id)
)