import re from .common import InfoExtractor from ..utils import ( clean_html, extract_attributes, int_or_none, strip_or_none, unified_strdate, ) from ..utils.traversal import find_element, traverse_obj class MonstercatIE(InfoExtractor): _VALID_URL = r'https?://www\.monstercat\.com/release/(?P\d{12}|MC[A-Z]+\d+)' _TESTS = [{ 'url': 'https://www.monstercat.com/release/742779548009', 'playlist_count': 20, 'info_dict': { 'title': 'The Secret Language of Trees', 'id': '742779548009', 'thumbnail': 'https://www.monstercat.com/release/742779548009/cover', 'release_date': '20230711', 'album': 'The Secret Language of Trees', 'album_artists': ['BT'], }, }, { 'url': 'https://www.monstercat.com/release/MCRAB001', 'playlist_count': 1, 'info_dict': { 'title': 'Crab Rave', 'id': 'MCRAB001', 'thumbnail': 'https://www.monstercat.com/release/MCRAB001/cover', 'release_date': '20180401', 'album': 'Crab Rave', 'album_artists': ['Noisestorm'], }, }, { 'url': 'https://www.monstercat.com/release/MCEP209', 'playlist_count': 5, 'info_dict': { 'title': 'Somewhere New', 'id': 'MCEP209', 'thumbnail': 'https://www.monstercat.com/release/MCEP209/cover', 'release_date': '20210415', 'album': 'Somewhere New', 'album_artists': ['Bad Computer'], }, }] def _extract_tracks(self, table, album_meta): for td in re.findall(r'((?:(?!)[\w\W])+)', table): # regex by chatgpt due to lack of get_elements_by_tag title = traverse_obj(td, ( {find_element(cls='d-inline-flex flex-column')}, {lambda x: x.partition('