[bandcamp] use unescapeHTML instead of a simple replace of quotes

This commit is contained in:
Gilles Pietri 2020-09-26 17:34:35 +02:00
parent 9c1f99402f
commit 14194392a8

View File

@ -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',&quot;%s&quot;:(&quot;)(?P<value>(?:(?!&quot;).)+)&quot;' % key,
r',(["\']|&quot;)%s\1:\1(?P<value>(?:(?!\1).)+)\1' % key,
webpage, key, default=None, group='value')
artist = extract('artist')