1
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-03-09 12:50:23 -05:00
yt-dlp/yt_dlp/extractor/cablecasttv.py

37 lines
1.3 KiB
Python
Raw Normal View History

2024-05-17 08:09:46 -05:00
from .common import InfoExtractor
class CableCastTVIE(InfoExtractor):
_VALID_URL = r'https://wctv\.wilmette\.com/CablecastPublicSite/show/(?P<id>\d+)'
_TESTS = [{
'url': 'https://wctv.wilmette.com/CablecastPublicSite/show/532',
2024-05-19 11:09:27 -05:00
'md5': '17e7ed129582babf6d1ae5c3b9d70d18',
2024-05-17 08:09:46 -05:00
'info_dict': {
'id': '532',
'ext': 'mp4',
'title': 'Village Board Meeting 4/24/24',
},
2024-05-19 11:09:27 -05:00
}, {
'url': 'https://wctv.wilmette.com/CablecastPublicSite/show/53/',
'only_matching': True,
2024-05-17 08:09:46 -05:00
}]
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
2024-05-19 11:09:27 -05:00
url_video_page = self._html_search_regex(r'<iframe[^>]*class=\"trms-player\"[^>]*src=\"([^\"]+)\"', webpage, 'url_video_webpage')
webpage_video = self._download_webpage(url_video_page, video_id)
2024-05-19 10:53:01 -05:00
video_url = self._html_search_regex(r'"([^\"]*\.m3u8)"', webpage_video, 'video URL')
formats = []
formats.extend(self._extract_m3u8_formats(video_url, video_id, ext='mp4', m3u8_id='hls'))
2024-05-17 08:09:46 -05:00
2024-05-19 11:09:27 -05:00
title = self._og_search_title(webpage) or self._html_search_regex(r'<title>(.+?)</title>', webpage, 'title')
2024-05-17 08:09:46 -05:00
return {
'id': video_id,
'title': title,
'formats': formats,
}