chore(YouTube - Client spoof): add logging. fix fall over logic if android client call fails

This commit is contained in:
LisoUseInAIKyrios 2023-09-26 13:05:25 +04:00
parent 09e8b3e345
commit ab9989d41f
2 changed files with 8 additions and 7 deletions

View File

@ -50,9 +50,6 @@ public class SpoofSignaturePatch {
private static volatile Future<StoryboardRenderer> rendererFuture;
@Nullable
private static volatile StoryboardRenderer renderer;
@Nullable
private static StoryboardRenderer getRenderer() {
if (rendererFuture != null) {

View File

@ -63,9 +63,8 @@ public class StoryboardRendererRequester {
@Nullable
private static StoryboardRenderer getStoryboardRendererUsingBody(@NonNull String innerTubeBody) {
final JSONObject playerResponse = fetchPlayerResponse(innerTubeBody);
Objects.requireNonNull(playerResponse);
if (isPlayabilityStatusOk(playerResponse)) return getStoryboardRendererUsingResponse(playerResponse);
if (playerResponse != null && isPlayabilityStatusOk(playerResponse))
return getStoryboardRendererUsingResponse(playerResponse);
return null;
}
@ -100,8 +99,13 @@ public class StoryboardRendererRequester {
Objects.requireNonNull(videoId);
var renderer = getStoryboardRendererUsingBody(String.format(ANDROID_INNER_TUBE_BODY, videoId));
if (renderer == null)
if (renderer == null) {
LogHelper.printDebug(() -> videoId + " not available using android client");
renderer = getStoryboardRendererUsingBody(String.format(TV_EMBED_INNER_TUBE_BODY, videoId, videoId));
if (renderer == null) {
LogHelper.printDebug(() -> videoId + " not available using tv embedded client");
}
}
return renderer;
} catch (Exception ex) {