import re from .common import InfoExtractor from ..utils import ( ExtractorError, determine_ext, float_or_none, int_or_none, js_to_json, traverse_obj, url_or_none, ) class MuseAIIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?muse\.ai/(?:v|embed)/(?P\w+)' _TESTS = [{ 'url': 'https://muse.ai/embed/YdTWvUW', 'md5': 'f994f9a38be1c3aaf9e37cbd7d76fe7c', 'info_dict': { 'id': 'YdTWvUW', 'ext': 'mp4', 'title': '2023-05-28-Grabien-1941111 (1)', 'description': '', 'uploader': 'Today News Africa', 'uploader_id': 'TodayNewsAfrica', 'upload_date': '20230528', 'timestamp': 1685285044, 'duration': 1291.3, 'view_count': int, 'availability': 'public', }, }, { 'url': 'https://muse.ai/v/gQ4gGAA-0756', 'md5': '52dbfc78e865e56dc19a1715badc35e8', 'info_dict': { 'id': 'gQ4gGAA', 'ext': 'mp4', 'title': '0756', 'description': 'md5:0ca1483f9aac423e9a96ad00bb3a0785', 'uploader': 'Aerial.ie', 'uploader_id': 'aerial', 'upload_date': '20210306', 'timestamp': 1615072842, 'duration': 21.4, 'view_count': int, 'availability': 'public', }, }] _WEBPAGE_TESTS = [{ 'url': 'https://muse.ai/docs', 'playlist_mincount': 4, 'info_dict': { 'id': 'docs', 'title': 'muse.ai | docs', 'description': 'md5:6c0293431481582739c82ee8902687fa', 'age_limit': 0, 'thumbnail': 'https://muse.ai/static/imgs/poster-img-docs.png', }, 'params': {'allowed_extractors': ['all', '-html5']}, }] _EMBED_REGEX = [r']*\bsrc=["\'](?Phttps://muse\.ai/embed/\w+)'] @classmethod def _extract_embed_urls(cls, url, webpage): yield from super()._extract_embed_urls(url, webpage) for embed_id in re.findall(r'