1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-08 04:02:40 +01:00

[bandcamp] Revert test song title, and extract title generally (which may fail, as the other title json values might come up), instead of out of trackinfo, as bandcamp prefixes it with artist -

This commit is contained in:
Gilles Pietri 2020-09-29 12:09:55 +02:00
parent 75a83afe3b
commit 03edd545a9

View File

@ -33,7 +33,7 @@ class BandcampIE(InfoExtractor):
'info_dict': { 'info_dict': {
'id': '1812978515', 'id': '1812978515',
'ext': 'mp3', 'ext': 'mp3',
'title': "youtube-dl \"'/\\\u00e4\u21ad - youtube-dl \"'/\\\u00e4\u21ad - youtube-dl test song \"'/\\\u00e4\u21ad", 'title': "youtube-dl \"'/\\\u00e4\u21ad - youtube-dl test song \"'/\\\u00e4\u21ad",
'duration': 9.8485, 'duration': 9.8485,
'uploader': "youtube-dl \"'/\\\u00e4\u21ad", 'uploader': "youtube-dl \"'/\\\u00e4\u21ad",
'timestamp': 1354224127, 'timestamp': 1354224127,
@ -99,7 +99,6 @@ def _real_extract(self, url):
webpage, 'track info', default='{}') webpage, 'track info', default='{}')
track_info = self._parse_json(trackinfo_block, 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):
@ -115,7 +114,7 @@ def _real_extract(self, url):
'acodec': ext, 'acodec': ext,
'abr': int_or_none(abr_str), 'abr': int_or_none(abr_str),
}) })
track = track_info.get('title')
track_id = str_or_none(track_info.get('track_id') or track_info.get('id')) track_id = str_or_none(track_info.get('track_id') or track_info.get('id'))
track_number = int_or_none(track_info.get('track_num')) track_number = int_or_none(track_info.get('track_num'))
duration = float_or_none(track_info.get('duration')) duration = float_or_none(track_info.get('duration'))
@ -126,6 +125,7 @@ def extract(key):
webpage, key, default=None, group='value') webpage, key, default=None, group='value')
return data.replace(r'\"', '"').replace('\\\\', '\\') if data else data return data.replace(r'\"', '"').replace('\\\\', '\\') if data else data
track = extract('title')
artist = extract('artist') artist = extract('artist')
album = extract('album_title') album = extract('album_title')
timestamp = unified_timestamp( timestamp = unified_timestamp(