Olá, tudo bem?
Segue minha sugestão para consultar receitas no The Meal DB Api:
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.Scanner;
public class ConsultaReceita {
public static void main(String[] args) throws Exception {
Scanner leitura = new Scanner(System.in);
System.out.println("Digite uma receita: ");
var nomeDaReceita = leitura.nextLine();
String endereco = "https://www.themealdb.com/api/json/v1/1/search.php?s=" + nomeDaReceita;
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder().uri(URI.create(endereco)).build();
HttpResponse<String> response;
try {
response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
} catch (IOException e) {
e.printStackTrace();
}
}
}