From 19533a17aa55fafc70d0a385928e785cb50e1ebc Mon Sep 17 00:00:00 2001 From: admin <2780501319@qq.com> Date: 星期五, 30 七月 2021 02:05:14 +0800 Subject: [PATCH] 爱奇艺视频更新 --- src/main/java/com/yeshi/buwan/util/HttpUtil.java | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/yeshi/buwan/util/HttpUtil.java b/src/main/java/com/yeshi/buwan/util/HttpUtil.java index e7abef6..56a6794 100644 --- a/src/main/java/com/yeshi/buwan/util/HttpUtil.java +++ b/src/main/java/com/yeshi/buwan/util/HttpUtil.java @@ -36,6 +36,22 @@ return ""; } + + public static String defaultGet(String url) { + HttpClient client = new HttpClient(); + GetMethod method = new GetMethod(url); + try { + client.executeMethod(method); + method.getStatusCode(); + return method.getResponseBodyAsString(); + } catch (HttpException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return ""; + } + public static String get(String url, Map<String, String> map) { HttpClient client = new HttpClient(); // client.getHostConfiguration().setProxy("192.168.1.122", 8888); @@ -88,6 +104,7 @@ public static InputStream getAsInputStream(String url) { HttpClient client = new HttpClient(); + client.getHttpConnectionManager().getParams().setConnectionTimeout(5000); GetMethod method = new GetMethod(url); try { client.executeMethod(method); -- Gitblit v1.8.0