From 14194392a813a12b3a1477ec75bcd0c8626ef3bb Mon Sep 17 00:00:00 2001 From: Gilles Pietri Date: Sat, 26 Sep 2020 17:34:35 +0200 Subject: [PATCH] [bandcamp] use unescapeHTML instead of a simple replace of quotes --- youtube_dl/extractor/bandcamp.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/youtube_dl/extractor/bandcamp.py b/youtube_dl/extractor/bandcamp.py index ad1812320..55d110e28 100644 --- a/youtube_dl/extractor/bandcamp.py +++ b/youtube_dl/extractor/bandcamp.py @@ -92,10 +92,10 @@ def _real_extract(self, url): formats = [] trackinfo_block = self._search_regex( - r'trackinfo":\[\s*({.+?})\s*\],"', + r'trackinfo(?:["\']|"):\[\s*({.+?})\s*\],(?:["\']|")', webpage, 'track info', default='{}') - quoted_json = trackinfo_block.replace('"', '"') - track_info = self._parse_json(quoted_json, title) + unescaped_json = unescapeHTML(trackinfo_block) + track_info = self._parse_json(unescaped_json, title) if track_info: file_ = track_info.get('file') if isinstance(file_, dict): @@ -118,7 +118,7 @@ def _real_extract(self, url): def extract(key): return self._search_regex( - r',"%s":(")(?P(?:(?!").)+)"' % key, + r',(["\']|")%s\1:\1(?P(?:(?!\1).)+)\1' % key, webpage, key, default=None, group='value') artist = extract('artist')