mirror of
https://github.com/TeamPiped/Piped-Backend
synced 2025-09-07 14:01:03 +02:00
24 lines
634 B
Java
24 lines
634 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();
|
|
var response = Constants.h2client.newCall(request).execute();
|
|
var responseString = response.body().string();
|
|
response.close();
|
|
|
|
return responseString;
|
|
}
|
|
}
|