mirror of
https://github.com/blackjack4494/yt-dlc.git
synced 2024-12-21 23:33:10 +00:00
[bandcamp] fix regexp for JSON matching on bandcamp
This commit is contained in:
parent
c5764b3f89
commit
9c1f99402f
1 changed files with 6 additions and 5 deletions
|
@ -91,10 +91,11 @@ class BandcampIE(InfoExtractor):
|
|||
duration = None
|
||||
|
||||
formats = []
|
||||
track_info = self._parse_json(
|
||||
self._search_regex(
|
||||
r'trackinfo\s*:\s*\[\s*({.+?})\s*\]\s*,\s*?\n',
|
||||
webpage, 'track info', default='{}'), title)
|
||||
trackinfo_block = self._search_regex(
|
||||
r'trackinfo":\[\s*({.+?})\s*\],"',
|
||||
webpage, 'track info', default='{}')
|
||||
quoted_json = trackinfo_block.replace('"', '"')
|
||||
track_info = self._parse_json(quoted_json, title)
|
||||
if track_info:
|
||||
file_ = track_info.get('file')
|
||||
if isinstance(file_, dict):
|
||||
|
@ -117,7 +118,7 @@ class BandcampIE(InfoExtractor):
|
|||
|
||||
def extract(key):
|
||||
return self._search_regex(
|
||||
r'\b%s\s*["\']?\s*:\s*(["\'])(?P<value>(?:(?!\1).)+)\1' % key,
|
||||
r',"%s":(")(?P<value>(?:(?!").)+)"' % key,
|
||||
webpage, key, default=None, group='value')
|
||||
|
||||
artist = extract('artist')
|
||||
|
|
Loading…
Reference in a new issue