Don't call getUploaderInfo() in onFetchPage() for playlists

This way YouTube Music playlists will keep working in NewPipe
This commit is contained in:
wb9688 2020-02-27 09:27:56 +01:00
parent 2399d46ab0
commit 951ed9f0d8

View File

@ -28,7 +28,6 @@ import javax.annotation.Nonnull;
@SuppressWarnings("WeakerAccess") @SuppressWarnings("WeakerAccess")
public class YoutubePlaylistExtractor extends PlaylistExtractor { public class YoutubePlaylistExtractor extends PlaylistExtractor {
private JsonObject initialData; private JsonObject initialData;
private JsonObject uploaderInfo;
private JsonObject playlistInfo; private JsonObject playlistInfo;
public YoutubePlaylistExtractor(StreamingService service, ListLinkHandler linkHandler) { public YoutubePlaylistExtractor(StreamingService service, ListLinkHandler linkHandler) {
@ -57,7 +56,6 @@ public class YoutubePlaylistExtractor extends PlaylistExtractor {
} }
initialData = ajaxJson.getObject(1).getObject("response"); initialData = ajaxJson.getObject(1).getObject("response");
uploaderInfo = getUploaderInfo();
playlistInfo = getPlaylistInfo(); playlistInfo = getPlaylistInfo();
} }
@ -140,7 +138,7 @@ public class YoutubePlaylistExtractor extends PlaylistExtractor {
public String getUploaderUrl() throws ParsingException { public String getUploaderUrl() throws ParsingException {
try { try {
return YoutubeChannelExtractor.CHANNEL_URL_BASE + return YoutubeChannelExtractor.CHANNEL_URL_BASE +
uploaderInfo.getObject("navigationEndpoint").getObject("browseEndpoint").getString("browseId"); getUploaderInfo().getObject("navigationEndpoint").getObject("browseEndpoint").getString("browseId");
} catch (Exception e) { } catch (Exception e) {
throw new ParsingException("Could not get playlist uploader url", e); throw new ParsingException("Could not get playlist uploader url", e);
} }
@ -149,7 +147,7 @@ public class YoutubePlaylistExtractor extends PlaylistExtractor {
@Override @Override
public String getUploaderName() throws ParsingException { public String getUploaderName() throws ParsingException {
try { try {
return uploaderInfo.getObject("title").getArray("runs").getObject(0).getString("text"); return getUploaderInfo().getObject("title").getArray("runs").getObject(0).getString("text");
} catch (Exception e) { } catch (Exception e) {
throw new ParsingException("Could not get playlist uploader name", e); throw new ParsingException("Could not get playlist uploader name", e);
} }
@ -158,7 +156,7 @@ public class YoutubePlaylistExtractor extends PlaylistExtractor {
@Override @Override
public String getUploaderAvatarUrl() throws ParsingException { public String getUploaderAvatarUrl() throws ParsingException {
try { try {
return uploaderInfo.getObject("thumbnail").getArray("thumbnails").getObject(0).getString("url"); return getUploaderInfo().getObject("thumbnail").getArray("thumbnails").getObject(0).getString("url");
} catch (Exception e) { } catch (Exception e) {
throw new ParsingException("Could not get playlist uploader avatar", e); throw new ParsingException("Could not get playlist uploader avatar", e);
} }