Piped-Backend/src/main/java/me/kavin/piped/utils/RequestUtils.java

20 lines
530 B
Java

package me.kavin.piped.utils;
import me.kavin.piped.consts.Constants;
import okhttp3.Request;
import java.io.IOException;
public class RequestUtils {
public static String sendGet(String url) throws IOException {
return sendGet(url, Constants.USER_AGENT);
}
public static String sendGet(String url, String ua) throws IOException {
var request = new Request.Builder().header("User-Agent", ua).url(url).build();
return Constants.h2client.newCall(request).execute().body().string();
}
}