From 6aadce819b42e2c0daabc7625464994010e40e51 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Fri, 9 Oct 2020 14:41:45 +0000 Subject: patches/youtube-dl: fix bandcamp --- ...x-test-song-uploader-name-cleanup-remanin.patch | 84 ++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 overlays/patches/youtube-dl/0006-bandcamp-fix-test-song-uploader-name-cleanup-remanin.patch (limited to 'overlays/patches/youtube-dl/0006-bandcamp-fix-test-song-uploader-name-cleanup-remanin.patch') diff --git a/overlays/patches/youtube-dl/0006-bandcamp-fix-test-song-uploader-name-cleanup-remanin.patch b/overlays/patches/youtube-dl/0006-bandcamp-fix-test-song-uploader-name-cleanup-remanin.patch new file mode 100644 index 000000000000..7f27661b065d --- /dev/null +++ b/overlays/patches/youtube-dl/0006-bandcamp-fix-test-song-uploader-name-cleanup-remanin.patch @@ -0,0 +1,84 @@ +From d6b4c19c0557c0486fd1d34ee2891c5fd3c583ee Mon Sep 17 00:00:00 2001 +From: Gilles Pietri +Date: Mon, 28 Sep 2020 19:42:56 +0200 +Subject: [PATCH 6/8] [bandcamp] fix test song uploader name, cleanup remanings + " and \ in data, including album titles + +From https://github.com/ytdl-org/youtube-dl/pull/26684. +--- + youtube_dl/extractor/bandcamp.py | 26 +++++++++++++++----------- + 1 file changed, 15 insertions(+), 11 deletions(-) + +diff --git a/youtube_dl/extractor/bandcamp.py b/youtube_dl/extractor/bandcamp.py +index 3d32b1e0f..3405b570a 100644 +--- a/youtube_dl/extractor/bandcamp.py ++++ b/youtube_dl/extractor/bandcamp.py +@@ -33,9 +33,9 @@ class BandcampIE(InfoExtractor): + 'info_dict': { + 'id': '1812978515', + '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, +- 'uploader': 'youtube-dl \\', ++ 'uploader': "youtube-dl \"'/\\\u00e4\u21ad", + 'timestamp': 1354224127, + 'upload_date': '20121129', + }, +@@ -43,7 +43,7 @@ class BandcampIE(InfoExtractor): + }, { + # free download + 'url': 'http://benprunty.bandcamp.com/track/lanius-battle', +- 'md5': '853e35bf34aa1d6fe2615ae612564b36', ++ 'md5': '5d92af55811e47f38962a54c30b07ef0', + 'info_dict': { + 'id': '2650410135', + 'ext': 'aiff', +@@ -94,11 +94,12 @@ class BandcampIE(InfoExtractor): + duration = None + + formats = [] +- trackinfo_block = self._search_regex( ++ trackinfo_block = self._html_search_regex( + r'trackinfo(?:["\']|"):\[\s*({.+?})\s*\],(?:["\']|")', + 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: + file_ = track_info.get('file') + if isinstance(file_, dict): +@@ -120,9 +121,10 @@ class BandcampIE(InfoExtractor): + duration = float_or_none(track_info.get('duration')) + + def extract(key): +- return self._search_regex( +- r',(["\']|")%s\1:\1(?P(?:(?!\1).)+)\1' % key, ++ data = self._html_search_regex( ++ r',(["\']|")%s\1:\1(?P(?:\\\1|((?!\1).))+)\1' % key, + webpage, key, default=None, group='value') ++ return data.replace(r'\"', '"').replace('\\\\', '\\') if data else data + + artist = extract('artist') + album = extract('album_title') +@@ -319,10 +321,12 @@ class BandcampAlbumIE(InfoExtractor): + if self._html_search_meta('duration', elem_content, default=None)] + + title = self._html_search_regex( +- r'album_title\s*(?:"|["\']):\s*(?:"|["\'])((?:\\.|[^"\\])+?)(?:"|["\'])', +- webpage, 'title', fatal=False) ++ r'album_title\s*(?:"|["\']):\s*("|["\'])(?P(?:\\\1|((?!\1).))+)\1', ++ webpage, 'title', fatal=False, group='album') ++ + if title: +- title = unescapeHTML(title) ++ title = title.replace(r'\"', '"') ++ + return { + '_type': 'playlist', + 'uploader_id': uploader_id, +-- +2.27.0 + -- cgit 1.4.1