From 38383ea31323ea8ccb859897bafb6cd16fbaa34b Mon Sep 17 00:00:00 2001 From: N/Ame <173015200+grqz@users.noreply.github.com> Date: Fri, 18 Oct 2024 13:34:07 +1300 Subject: [PATCH] use `re.sub` instead in description extraction Co-authored-by: dirkf --- yt_dlp/extractor/boomplay.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/yt_dlp/extractor/boomplay.py b/yt_dlp/extractor/boomplay.py index 24ba2dffa9..1254e50fa7 100644 --- a/yt_dlp/extractor/boomplay.py +++ b/yt_dlp/extractor/boomplay.py @@ -110,12 +110,10 @@ class BoomplayBaseIE(InfoExtractor): def _extract_page_metadata(self, webpage, _id, playlist=False): metadata_div = self._get_element_by_class_and_tag('summary', 'div', webpage) or '' metadata_entries = re.findall(r'(?si)(?P.*?)', metadata_div) or [] - description = ( - self._get_element_by_class_and_tag('description_content', 'span', webpage) - or 'Listen and download music for free on Boomplay!') - description = clean_html(description.strip()) - if description == 'Listen and download music for free on Boomplay!': - description = None + description = re.sub( + '(?i)Listen and download music for free on Boomplay!', '', + clean_html(self._get_element_by_class_and_tag( + 'description_content', 'span', webpage)) or '') or None details_section = self._get_element_by_class_and_tag('songDetailInfo', 'section', webpage) or '' metadata_entries.extend(re.findall(r'(?si)
  • (?P.*?)
  • ', details_section) or [])