From cdf41b868c5ea877fd6e1e90688f0d4e95c84a34 Mon Sep 17 00:00:00 2001 From: Redirion Date: Sat, 7 Dec 2019 12:49:42 +0100 Subject: [PATCH] Allow PlayLists with missing uploader This supports PR 2724 in NewPipe --- .../extractor/playlist/PlaylistInfo.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistInfo.java b/extractor/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistInfo.java index 87fcb947f..1b1580252 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistInfo.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistInfo.java @@ -45,6 +45,9 @@ public class PlaylistInfo extends ListInfo { extractor.getServiceId(), extractor.getLinkHandler(), extractor.getName()); + // collect uploader extraction failures until we are sure this is not + // just a playlist without an uploader + List uploaderParsingErros = new ArrayList(3); try { info.setOriginalUrl(extractor.getOriginalUrl()); @@ -64,23 +67,31 @@ public class PlaylistInfo extends ListInfo { try { info.setUploaderUrl(extractor.getUploaderUrl()); } catch (Exception e) { - info.addError(e); + info.setUploaderUrl(""); + uploaderParsingErros.add(e); } try { info.setUploaderName(extractor.getUploaderName()); } catch (Exception e) { - info.addError(e); + info.setUploaderName(""); + uploaderParsingErros.add(e); } try { info.setUploaderAvatarUrl(extractor.getUploaderAvatarUrl()); } catch (Exception e) { - info.addError(e); + info.setUploaderAvatarUrl(""); + uploaderParsingErros.add(e); } try { info.setBannerUrl(extractor.getBannerUrl()); } catch (Exception e) { info.addError(e); } + // do not fail if everything but the uploader infos could be collected + if (uploaderParsingErros.size() > 0 && + (!info.getErrors().isEmpty() || uploaderParsingErros.size() < 3)) { + info.addAllErrors(uploaderParsingErros); + } final InfoItemsPage itemsPage = ExtractorHelper.getItemsPageOrLogError(info, extractor); info.setRelatedItems(itemsPage.getItems());