From cdf41b868c5ea877fd6e1e90688f0d4e95c84a34 Mon Sep 17 00:00:00 2001 From: Redirion Date: Sat, 7 Dec 2019 12:49:42 +0100 Subject: [PATCH 1/3] 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()); From e98112ea21b8f5e686998da99e22d225ee1b4430 Mon Sep 17 00:00:00 2001 From: Redirion Date: Sat, 7 Dec 2019 14:34:15 +0100 Subject: [PATCH 2/3] Update PlaylistInfo.java Fixed typo --- .../newpipe/extractor/playlist/PlaylistInfo.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 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 1b1580252..a685f4aa8 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 @@ -47,7 +47,7 @@ public class PlaylistInfo extends ListInfo { extractor.getName()); // collect uploader extraction failures until we are sure this is not // just a playlist without an uploader - List uploaderParsingErros = new ArrayList(3); + List uploaderParsingErrors = new ArrayList(3); try { info.setOriginalUrl(extractor.getOriginalUrl()); @@ -68,19 +68,19 @@ public class PlaylistInfo extends ListInfo { info.setUploaderUrl(extractor.getUploaderUrl()); } catch (Exception e) { info.setUploaderUrl(""); - uploaderParsingErros.add(e); + uploaderParsingErrors.add(e); } try { info.setUploaderName(extractor.getUploaderName()); } catch (Exception e) { info.setUploaderName(""); - uploaderParsingErros.add(e); + uploaderParsingErrors.add(e); } try { info.setUploaderAvatarUrl(extractor.getUploaderAvatarUrl()); } catch (Exception e) { info.setUploaderAvatarUrl(""); - uploaderParsingErros.add(e); + uploaderParsingErrors.add(e); } try { info.setBannerUrl(extractor.getBannerUrl()); @@ -88,9 +88,9 @@ public class PlaylistInfo extends ListInfo { 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); + if (uploaderParsingErrors.size() > 0 && + (!info.getErrors().isEmpty() || uploaderParsingErrors.size() < 3)) { + info.addAllErrors(uploaderParsingErrors); } final InfoItemsPage itemsPage = ExtractorHelper.getItemsPageOrLogError(info, extractor); From 035994b3cf53e5da5d074a0d03f27f67f6f6b6f5 Mon Sep 17 00:00:00 2001 From: Redirion Date: Mon, 9 Dec 2019 16:55:28 +0100 Subject: [PATCH 3/3] Update PlaylistInfo.java added missing imports --- .../org/schabi/newpipe/extractor/playlist/PlaylistInfo.java | 2 ++ 1 file changed, 2 insertions(+) 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 a685f4aa8..f8c307380 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 @@ -11,6 +11,8 @@ import org.schabi.newpipe.extractor.stream.StreamInfoItem; import org.schabi.newpipe.extractor.utils.ExtractorHelper; import java.io.IOException; +import java.util.ArrayList; +import java.util.List; public class PlaylistInfo extends ListInfo {