mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-16 13:23:20 +00:00
[bandcamp] fix test song uploader name, cleanup remanings " and \ in data, including album titles
This commit is contained in:
parent
37f625598c
commit
75a83afe3b
|
@ -33,9 +33,9 @@ class BandcampIE(InfoExtractor):
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '1812978515',
|
'id': '1812978515',
|
||||||
'ext': 'mp3',
|
'ext': 'mp3',
|
||||||
'title': "youtube-dl \\ - youtube-dl \"'/\\\u00e4\u21ad - youtube-dl test song \"'/\\\u00e4\u21ad",
|
'title': "youtube-dl \"'/\\\u00e4\u21ad - youtube-dl \"'/\\\u00e4\u21ad - youtube-dl test song \"'/\\\u00e4\u21ad",
|
||||||
'duration': 9.8485,
|
'duration': 9.8485,
|
||||||
'uploader': 'youtube-dl \\',
|
'uploader': "youtube-dl \"'/\\\u00e4\u21ad",
|
||||||
'timestamp': 1354224127,
|
'timestamp': 1354224127,
|
||||||
'upload_date': '20121129',
|
'upload_date': '20121129',
|
||||||
},
|
},
|
||||||
|
@ -43,7 +43,7 @@ class BandcampIE(InfoExtractor):
|
||||||
}, {
|
}, {
|
||||||
# free download
|
# free download
|
||||||
'url': 'http://benprunty.bandcamp.com/track/lanius-battle',
|
'url': 'http://benprunty.bandcamp.com/track/lanius-battle',
|
||||||
'md5': '853e35bf34aa1d6fe2615ae612564b36',
|
'md5': '5d92af55811e47f38962a54c30b07ef0',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '2650410135',
|
'id': '2650410135',
|
||||||
'ext': 'aiff',
|
'ext': 'aiff',
|
||||||
|
@ -94,11 +94,12 @@ def _real_extract(self, url):
|
||||||
duration = None
|
duration = None
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
trackinfo_block = self._search_regex(
|
trackinfo_block = self._html_search_regex(
|
||||||
r'trackinfo(?:["\']|"):\[\s*({.+?})\s*\],(?:["\']|")',
|
r'trackinfo(?:["\']|"):\[\s*({.+?})\s*\],(?:["\']|")',
|
||||||
webpage, 'track info', default='{}')
|
webpage, 'track info', default='{}')
|
||||||
unescaped_json = unescapeHTML(trackinfo_block)
|
|
||||||
track_info = self._parse_json(unescaped_json, title)
|
track_info = self._parse_json(trackinfo_block, title)
|
||||||
|
|
||||||
if track_info:
|
if track_info:
|
||||||
file_ = track_info.get('file')
|
file_ = track_info.get('file')
|
||||||
if isinstance(file_, dict):
|
if isinstance(file_, dict):
|
||||||
|
@ -120,9 +121,10 @@ def _real_extract(self, url):
|
||||||
duration = float_or_none(track_info.get('duration'))
|
duration = float_or_none(track_info.get('duration'))
|
||||||
|
|
||||||
def extract(key):
|
def extract(key):
|
||||||
return self._search_regex(
|
data = self._html_search_regex(
|
||||||
r',(["\']|")%s\1:\1(?P<value>(?:(?!\1).)+)\1' % key,
|
r',(["\']|")%s\1:\1(?P<value>(?:\\\1|((?!\1).))+)\1' % key,
|
||||||
webpage, key, default=None, group='value')
|
webpage, key, default=None, group='value')
|
||||||
|
return data.replace(r'\"', '"').replace('\\\\', '\\') if data else data
|
||||||
|
|
||||||
artist = extract('artist')
|
artist = extract('artist')
|
||||||
album = extract('album_title')
|
album = extract('album_title')
|
||||||
|
@ -319,10 +321,12 @@ def _real_extract(self, url):
|
||||||
if self._html_search_meta('duration', elem_content, default=None)]
|
if self._html_search_meta('duration', elem_content, default=None)]
|
||||||
|
|
||||||
title = self._html_search_regex(
|
title = self._html_search_regex(
|
||||||
r'album_title\s*(?:"|["\']):\s*(?:"|["\'])((?:\\.|[^"\\])+?)(?:"|["\'])',
|
r'album_title\s*(?:"|["\']):\s*("|["\'])(?P<album>(?:\\\1|((?!\1).))+)\1',
|
||||||
webpage, 'title', fatal=False)
|
webpage, 'title', fatal=False, group='album')
|
||||||
|
|
||||||
if title:
|
if title:
|
||||||
title = unescapeHTML(title)
|
title = title.replace(r'\"', '"')
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'_type': 'playlist',
|
'_type': 'playlist',
|
||||||
'uploader_id': uploader_id,
|
'uploader_id': uploader_id,
|
||||||
|
|
Loading…
Reference in a new issue