music tricks

This commit is contained in:
gdlbo
2022-07-19 16:52:59 +03:00
parent 1c5316ba4e
commit ddf046cd20
2 changed files with 84 additions and 0 deletions
@@ -3,20 +3,38 @@ package ru.vtosters.lite.hooks;
import static ru.vtosters.lite.f0x1d.VTVerifications.isDeveloper;
import static ru.vtosters.lite.f0x1d.VTVerifications.isPrometheus;
import static ru.vtosters.lite.f0x1d.VTVerifications.isVerified;
import static ru.vtosters.lite.hooks.DateHook.getLocale;
import static ru.vtosters.lite.utils.Base64Utils.decode;
import static ru.vtosters.lite.utils.Globals.getContext;
import static ru.vtosters.lite.utils.Globals.getUserToken;
import static ru.vtosters.lite.utils.Preferences.dev;
import static ru.vtosters.lite.utils.Preferences.friendsblock;
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
import static ru.vtosters.lite.utils.Preferences.hasVerification;
import android.util.Log;
import com.vk.core.util.DeviceIdProvider;
import com.vtosters.lite.fragments.messages.chat.vc.MsgSendVc;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.Objects;
import java.util.Random;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
public class JsonInjectors{
private static final OkHttpClient mClient = new OkHttpClient();
public static JSONObject profileButton(JSONObject orig) throws JSONException{
if (haveDonateButton()) return orig;
@@ -98,6 +116,68 @@ public class JsonInjectors{
return json.putOpt("items", newItems);
}
public static JSONObject music(JSONObject json) throws JSONException{
var oldItems = json.optJSONObject("catalog").optJSONArray("sections");
var catalog = new JSONObject();
var newItems = new JSONArray();
String albumurl = "https://vk.com/audio?section=albums";
if (oldItems != null) {
for (int i = 0; i < oldItems.length(); i++) {
var item = oldItems.optJSONObject(i);
Log.d("VTLMusic", "Section: " + item.optString("title"));
}
catalog = fetchCatalogId(albumurl);
if (catalog != null) {
var catalogarr = catalog.optJSONObject("catalog").optJSONArray("sections").optJSONObject(0);
var title = catalogarr.optString("title");
var id = catalogarr.optString("id");
var url = catalogarr.optString("url");
Log.d("VTLMusic", "Section Playlist: " + catalogarr.optString("title"));
oldItems.put(new JSONObject().put("id", id).put("title", title).put("url", url));
}
Log.d("VTLMusic", oldItems.length() + " sections");
}
return json;
}
public static JSONObject fetchCatalogId(String section){
OkHttpClient client = new OkHttpClient();
final JSONObject[] payload = {null};
if (section == null) return null;
var request = new Request.a()
.b("https://api.vk.com/method/catalog.getAudio?v=5.119&https=1&need_blocks=1" + "&lang=" + getLocale() + "&device_id=" + DeviceIdProvider.d(getContext()) + "&url=" + section + "&access_token=" + getUserToken())
.a();
client.a(request).a(new Callback() {
@Override
public void a(Call call, IOException e) {
Log.d("VTLMusic", e+"");
}
@Override
public void a(Call call, Response response) throws IOException {
try {
payload[0] = new JSONObject(response.a().g());
Log.d("VTLMusic", payload[0].length() + " sections album");
} catch (JSONException e) {
e.printStackTrace();
}
}
});
return payload[0];
}
public static JSONObject friends(JSONObject json) throws JSONException{
JSONObject catalog = json;
boolean sectionexecute = true;
@@ -81,6 +81,10 @@
move-result-object p1
invoke-static {p1}, Lru/vtosters/lite/hooks/JsonInjectors;->music(Lorg/json/JSONObject;)Lorg/json/JSONObject;
move-result-object p1
const-string v1, "r.getJSONObject(ServerKeys.RESPONSE)"
invoke-static {p1, v1}, Lkotlin/jvm/internal/Intrinsics;->a(Ljava/lang/Object;Ljava/lang/String;)V