Rename getValidResponseBody() to getValidJsonResponseBody()

This commit is contained in:
wb9688 2020-04-03 17:23:18 +02:00
parent 8a9e137385
commit bce27a0e22
2 changed files with 5 additions and 5 deletions

View File

@ -29,7 +29,7 @@ import java.util.Map;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import static org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeParsingHelper.fixThumbnailUrl; import static org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeParsingHelper.fixThumbnailUrl;
import static org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeParsingHelper.getValidResponseBody; import static org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeParsingHelper.getValidJsonResponseBody;
import static org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeParsingHelper.getTextFromObject; import static org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeParsingHelper.getTextFromObject;
import static org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeParsingHelper.getUrlFromNavigationEndpoint; import static org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeParsingHelper.getUrlFromNavigationEndpoint;
import static org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeSearchQueryHandlerFactory.MUSIC_ALBUMS; import static org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeSearchQueryHandlerFactory.MUSIC_ALBUMS;
@ -111,7 +111,7 @@ public class YoutubeMusicSearchExtractor extends SearchExtractor {
headers.put("Referer", Collections.singletonList("music.youtube.com")); headers.put("Referer", Collections.singletonList("music.youtube.com"));
headers.put("Content-Type", Collections.singletonList("application/json")); headers.put("Content-Type", Collections.singletonList("application/json"));
final String responseBody = getValidResponseBody(getDownloader().post(url, headers, json)); final String responseBody = getValidJsonResponseBody(getDownloader().post(url, headers, json));
try { try {
initialData = JsonParser.object().from(responseBody); initialData = JsonParser.object().from(responseBody);
@ -215,7 +215,7 @@ public class YoutubeMusicSearchExtractor extends SearchExtractor {
headers.put("Referer", Collections.singletonList("music.youtube.com")); headers.put("Referer", Collections.singletonList("music.youtube.com"));
headers.put("Content-Type", Collections.singletonList("application/json")); headers.put("Content-Type", Collections.singletonList("application/json"));
final String responseBody = getValidResponseBody(getDownloader().post(pageUrl, headers, json)); final String responseBody = getValidJsonResponseBody(getDownloader().post(pageUrl, headers, json));
final JsonObject ajaxJson; final JsonObject ajaxJson;
try { try {

View File

@ -428,7 +428,7 @@ public class YoutubeParsingHelper {
return thumbnailUrl; return thumbnailUrl;
} }
public static String getValidResponseBody(final Response response) public static String getValidJsonResponseBody(final Response response)
throws ParsingException, MalformedURLException { throws ParsingException, MalformedURLException {
if (response.responseCode() == 404) { if (response.responseCode() == 404) {
throw new ContentNotAvailableException("Not found" + throw new ContentNotAvailableException("Not found" +
@ -466,7 +466,7 @@ public class YoutubeParsingHelper {
headers.put("X-YouTube-Client-Version", Collections.singletonList(getClientVersion())); headers.put("X-YouTube-Client-Version", Collections.singletonList(getClientVersion()));
final Response response = getDownloader().get(url, headers, localization); final Response response = getDownloader().get(url, headers, localization);
final String responseBody = getValidResponseBody(response); final String responseBody = getValidJsonResponseBody(response);
try { try {
return JsonParser.array().from(responseBody); return JsonParser.array().from(responseBody);